Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of UGRID (part 1 of 2) #272

Merged
merged 43 commits into from
Nov 15, 2023

Conversation

davidhassell
Copy link
Contributor

@davidhassell davidhassell commented Sep 26, 2023

Fixes #270

Changes

New data model constructs that describe meshes

Misc.

Data

A whole bunch of changes for representing mesh arrays found in UGRID netCDF files, following the compressed array framework

mesh_id

The new recording of a "mesh_id" (netcdfready.py, fielddomain.py, field.py) is forward looking to the time when we write these things out (see #271). However, it's possible that when it comes to it we find that we don't need it.

As a result it is deliberate that, for now, the various *_mesh_id methods remain undocumented in cfdm/docs/

@davidhassell davidhassell added enhancement New feature or request UGRID Relating to UGRID mesh topologies labels Sep 26, 2023
@davidhassell
Copy link
Contributor Author

A big ol' PR this one - I shall add guidance before requesting a review!

@davidhassell davidhassell modified the milestones: 1.11.0.0, Next release Oct 23, 2023
Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm mid-review, though probably not even half-way yet in terms of eyeballing the code and functionality checks. Only minor comments (mostly typos) so far. Possibly #272 (comment) is slightly more important as the logic might be wrong on one line.

(Submitting this intermediate review since I am in the office and might be WFH early next week and even though GitHub might be clever preserve the review state in terms of notably comments raised, I don't want to risk losing the comments.)

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of my new, and (for some strange reason) old, comments are marked as 'pending' so just submitting a intermediate review to get those to appear. I'll submit my full final review later today.

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just doing final high-level checks, but this is looking all very good. For now I will submit more minor comments, raised in-line. Feel free to address these whist I finish my reviewing, though I won't take long (by tomorrow morning I will be done).

Also:

  • a few of my comments pertain to packaging and how scipy should be dealt with in cfdm and downstream in cf-python;
  • I've noticed there are some source class .rst issues meaning that the Sphinx build fails early. Some changes that need to be made include:
  1. Typos:
diff --git a/docs/source/class/cfdm.GatheredArray.rst b/docs/source/class/cfdm.GatheredArray.rst
index 0f6d60aa9..96cd5cb96 100644
--- a/docs/source/class/cfdm.GatheredArray.rst
+++ b/docs/source/class/cfdm.GatheredArray.rst
@@ -101,7 +101,7 @@ Docstring substitutions
    :toctree: ../method/                   
    :template: method.rst                  
                                           
-   ~cfdm.GatherArray._docstring_special_substitutions
-   ~cfdm.GatherArray._docstring_substitutions        
-   ~cfdm.GatherArray._docstring_package_depth        
-   ~cfdm.GatherArray._docstring_method_exclusions    
+   ~cfdm.GatheredArray._docstring_special_substitutions
+   ~cfdm.GatheredArray._docstring_substitutions        
+   ~cfdm.GatheredArray._docstring_package_depth        
+   ~cfdm.GatheredArray._docstring_method_exclusions    
  1. More typos:
diff --git a/docs/source/class/cfdm.core.Bounds.rst b/docs/source/class/cfdm.core.Bounds.rst
index a827601e2..2ec0e463b 100644
--- a/docs/source/class/cfdm.core.Bounds.rst
+++ b/docs/source/class/cfdm.core.Bounds.rst
@@ -92,7 +92,7 @@ Docstring substitutions
    :toctree: ../method/                        
    :template: method.rst                       
                                                
-   ~cfdm.core.Bounds_special_substitutions
-   ~cfdm.core.Bounds_substitutions        
-   ~cfdm.core.Bounds_package_depth        
-   ~cfdm.core.Bounds_method_exclusions    
+   ~cfdm.core.Bounds._special_substitutions
+   ~cfdm.core.Bounds._substitutions        
+   ~cfdm.core.Bounds._package_depth        
+   ~cfdm.core.Bounds._method_exclusions    
  1. Removing methods which aren't valid as referenced in the following Sphinx traceback I see:
WARNING: [autosummary] failed to import cfdm.Array.get_filename.
Possible hints:
* PycodeError: no source found for module 'builtins'
* ModuleNotFoundError: No module named 'cfdm.Array'
* AttributeError: type object 'Array' has no attribute 'get_filename'
WARNING: [autosummary] failed to import cfdm.Array.get_filenames.
Possible hints:
* PycodeError: no source found for module 'builtins'
* ModuleNotFoundError: No module named 'cfdm.Array'
* AttributeError: type object 'Array' has no attribute 'get_filenames'
WARNING: [autosummary] failed to import cfdm.CompressedArray.get_filename.
Possible hints:
* AttributeError: type object 'CompressedArray' has no attribute 'get_filename'
* ModuleNotFoundError: No module named 'cfdm.CompressedArray'
* PycodeError: no source found for module 'builtins'
WARNING: [autosummary] failed to import cfdm.CoordinateConversion.__nonzero__.
Possible hints:
* AttributeError: type object 'CoordinateConversion' has no attribute '__nonzero__'
* ModuleNotFoundError: No module named 'cfdm.CoordinateConversion'
* PycodeError: no source found for module 'builtins'
WARNING: [autosummary] failed to import cfdm.Datum.__nonzero__.
Possible hints:
* PycodeError: no source found for module 'builtins'
* ModuleNotFoundError: No module named 'cfdm.Datum'
* AttributeError: type object 'Datum' has no attribute '__nonzero__'

So it would be a good idea to attempt to build the dev-scrub version of the docs to find some issues that need fixing on the docs side.

@davidhassell
Copy link
Contributor Author

Hi Sadie - 1., 2., and 3. fixed in db3a0a4

@sadielbartholomew
Copy link
Member

Hi @davidhassell, thanks for your comments and clarifications. Very useful. The feedback responses all look good (bar the odd inevitable copy-paste typo which I'll raise as part of my final review submission). I'll submit the final review by the early afternoon (I forgot I had a meeting 10-12 I am in right now so slightly later than I said yesterday).

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Briefly, it looks like the latest SciPy, scipy>=1.11.3, which we request here now, only works with Python 3.9+:

...
Could not solve for environment specs
The following packages are incompatible
└─ scipy 1.11.3  is installable with the potential options
   ├─ scipy 1.11.3 would require
   │  └─ python >=3.10,<3.11.0a0 , which can be installed;
   ├─ scipy 1.11.3 would require
   │  └─ python >=3.11,<3.12.0a0 , which can be installed;
   ├─ scipy 1.11.3 would require
   │  └─ python >=3.12,<3.13.0a0 , which can be installed;
   └─ scipy 1.11.3 would require
      └─ python >=3.9,<3.10.0a0 , which can be installed.
...

so we might have to stop supporting Python 3.8... To avoid that complication is an earlier version of SciPy sufficient for the new logic?

@davidhassell
Copy link
Contributor Author

davidhassell commented Nov 8, 2023

Good catch. Let's just change it to the newest scipy version that supports python 3.8: a086e8a

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy! The approach to incorporating UGRID is very well considered, with the data model at its heart which is a major advantage and will be going forward. The functionality all works as best as I can determine, without being a UGRID expert.

I've raised a final batch of minor comments for your consideration. Once those are addressed, please merge when you feel ready.

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments on responses to some comments I previously raised...

sadielbartholomew pushed a commit to sadielbartholomew/cfdm that referenced this pull request Nov 10, 2023
Squashed commit of 124 commits made towards the PR NCAS-CMS#272. Code by
@davidhassell and squash performed by @sadielbartholomew.
@sadielbartholomew
Copy link
Member

For future reference, we are now force-pushing the squashed branch referenced above onto the current un-squashed branch to effectively squash down all of the development commits before the post-review commits, to tidy...

@davidhassell davidhassell added the netCDF read Relating to reading netCDF datasets label Nov 15, 2023
@sadielbartholomew sadielbartholomew mentioned this pull request Nov 15, 2023
davidhassell and others added 7 commits November 15, 2023 14:57
Squashed commit of 124 commits made towards the PR NCAS-CMS#272. Code by
@davidhassell and squash performed by @sadielbartholomew.
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
davidhassell and others added 24 commits November 15, 2023 15:00
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
@sadielbartholomew
Copy link
Member

Squash complete. Just doing a final sanity check that the code is as it was (running unit tests locally etc.) and then I will merge...

@sadielbartholomew
Copy link
Member

All good! Merging...

@sadielbartholomew sadielbartholomew merged commit 51cffd7 into NCAS-CMS:main Nov 15, 2023
@davidhassell
Copy link
Contributor Author

Hooray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request netCDF read Relating to reading netCDF datasets UGRID Relating to UGRID mesh topologies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementation of UGRID (part 1 of 2)
2 participants