Add fetch_remote_topo; deprecate read_netcdf; refactor etopotools - #726
Add fetch_remote_topo; deprecate read_netcdf; refactor etopotools#726mandli wants to merge 7 commits into
Conversation
Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-4-8
|
@rjleveque this was an attempt at removing some of the now duplicated functionality and unifying it. Another PR will also work towards unifying some of the divergent language. |
…tent); fix buffer type Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-4-8
…ime clash) Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-4-8
…fix dtopo reader) Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-4-8
|
This isn't working for me for some reason. The url I specify gets a local file directory path pre-pended to it somehow, so it is looking for Here's the error: Going |
…wpack#726) Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-4-8
|
It looks like |
|
I should have added that this includes some fixes for naming conventions that were confusing. The attribute Region / crop vocabulary — before vs. after
Argument renames / deprecations
Signatures confirming before → after: # main
def crop(self, filter_region=None, coarsen=1, buffer=0, align=None):
def read(self, ..., filter_region=None, ...):
def interp_unstructured(self, fill_topo, extent=None, ...):
# this PR
def crop(self, crop_extent=None, coarsen=1, buffer=0, align=None, filter_region=_CROP_EXTENT_UNSET):
def read(self, ..., crop_extent=None, ..., filter_region=_CROP_EXTENT_UNSET):
def interp_unstructured(self, fill_topo, crop_extent=None, ..., extent=_CROP_EXTENT_UNSET):
def fetch_remote_topo(name_or_url, crop_extent=None, coarsen=1, buffer=0, align=None, ...): # new |
|
I'm looking at the latest version and it seems like the When reading a netCDF file with So e.g. if But when reading an ASCII file with The See the attached notebook for an example: |
|
I think there's an incompatibility with the way stride is implemented in the ASCII and netCDF code which then leads to an issue with alignment. It looks like the netCDF is correct though and has just not been implemented fully in the ASCII. I am going to come up with a fix that ensures that these match and test it against your notebook example. Hopefully it won't be too much of a fix, just a little bit more coordinate arithmetic. |
|
The way stride is implemented for netCDF, the resulting file is always aligned with the first So my preference would be to implement the But happy to hear other views... |
…ride read() now takes coarsen/align/buffer and both file types produce identical, lattice-aligned grids via a shared _crop_indices helper; the netCDF read drives its lazy hyperslab (incl. descending-lat mapping) from the same routine. Fixes @rjleveque's report of netCDF/ASCII coarsen misalignment. Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-4-8
|
Agreed — that's exactly the direction I took. The To your CUDEM point: the old
topo.read('tile.nc', topo_type=4, crop_extent=ce, coarsen=3,
align=[-124.25, 47.0]) # integer/quarter-degree aligned
One thing to keep in mind with I did use your notebook to verify against. Type 3 and type 4 now return identical |
Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5
This PR adds a common function built on the newer
topotoolsthat handles remote fetching of files. This functionality replaces the internals ofread_netcdfandetopotools, which remain as compatibility shims for now. Deprecation warnings have been added, but can be customized/changed depending on what we are willing to mark as deprecated.Assisted-by: claude claude-opus-4-8