py-eddy-tracker icon indicating copy to clipboard operation
py-eddy-tracker copied to clipboard

NetCDF Compatibility and requirements.txt update

Open wienkers opened this issue 1 year ago • 0 comments

This modification to grid.py allows py-eddy-tracker to intake a netCDF data variable directly, e.g. via xarray.

Example:

da = ds.isel(time=0).ssh   # xarray data array now holding one time slice
da_netcdf = Dataset('in-mem-file', mode='r', memory=da.to_netcdf())  # This keeps the netCDF variable in memory (no IO to disk!)
g = RegularGridDataset(None, "lon", "lat", centered=True, nc4file= da_netcdf)  
# NOTE: Using 'None' for the .nc file path then requires specifying directly the netCDF variable in memory
#             Still compatible with specifying the .nc file path using the "filename" required input. I this case, variable "nc4file" is ignored

Finally, this PR also updates the requirements.txt which has a long-standing error with matplotlib versions after 3.7.1 due to their updated contour algorithm. Across a number of participants at a hackathon, it was determined that v3.7.1 is necessary. Without matplotlib v3.7.1 no errors are raised, but also 0 eddies are ever identified...

wienkers avatar Jan 15 '24 14:01 wienkers