Add code to generate coordinates datasets#8
Conversation
Codecov Report
@@ Coverage Diff @@
## main #8 +/- ##
===========================================
+ Coverage 60.00% 92.50% +32.50%
===========================================
Files 1 2 +1
Lines 5 40 +35
===========================================
+ Hits 3 37 +34
- Misses 2 3 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
@pyNEMO/pydomcfg I'm going to move the function to create the horizontal Cartesian grid under the tests directory. Then other functions could use that one to add different bathy (e.g., channel, ...). The inputs should be 1D array-like so we are not constrained to regular grids. Currently the function inputs are deltas (just because I thought that's what really matters), and the first point is at (0, 0). Would you guys prefer to switch to x/y coordinates for input? I.e., input lat lon rather than e1 e2? Also, this is the dataset structure: Anything missing/redundant? Can we get rid of nav_* and/or mask, or are they gonna be needed? |
|
I slightly changed the original structure. Line 9 in 3e2b18a I've also introduced a class to generate test datasets: pyDOMCFG/pydomcfg/tests/bathymetry.py Line 11 in 3e2b18a Example usage: from pydomcfg.tests.bathymetry import Bathymetry
square = Bathymetry(range(10), range(10))
shallow = square.flat(10)
deep = square.flat(1.0e3)If it looks OK let's merge this so @oceandie has a test dataset to get started and @jdha can add methods to |
I like the idea, just a minor cooment: maybe in the future I would just add some more comments/documentation - it is not immediately clear what you mean by face and center (it depends from where you start) and to track this nomenclature with the Arakawa-C structure.
|
|
minor semantics, but would it not be cleaner for |
|
Makes sense! How about if |
I agree with both your suggestions - than in the end this will be just for testing our zgr developments .... |
It won't be just for testing zgr dev as the unit tests will probably continue to use this (+ it'll be integrated into hgr later). Happy to go with @malmans2 hybrid suggestion. |
I have some doubts regarding the later integration into hgr - I think if we'll go towards a general curvilinear grid approach (where the cartesian grid is just a special case), the structure will be a bit different - but happy to go now and think about this later on |
|
OK, I think it's in good shape now. Please have another look and feel free to merge if it's good to go! |
pre-commit run --all-fileswhats-new.rstapi.rstI added a function to generate rectilinear grids. It could be handy in general, so it's public under utils.
E.g.,
I also created a couple of simple bathymetry datasets (flat and island), we can come up with something more interesting when we actually need datasets to test. There's also a placeholder test, just to show how we could make use of this datasets.
Test datasets are not exposed to users in the documentation, but can be accessed with:
Hopefully I got NEMO's Arakawa right, but double-check!