Proposed new feature or change:
It would be quite helpful if we could improve flexibillity in uxarray.open_dataset(). In particular, I encounter the following pattern often:
import os
import uxarray as ux
datapath = "path/to/where/data/is/stored"
ds = ux.open_dataset(os.path.join(datapath, 'grid.nc'), os.path.join(datapath, 'data.nc'))
I would love to instead be able to do something like:
import uxarray as ux
datapath = "path/to/where/data/is/stored"
ds = ux.open_dataset('grid.nc', 'data.nc', path=datapath)
(Is path a good name for that kwarg?)
Even better, for a simple case where the file names really are just 'grid.nc' and 'data.nc', it would be awesome to do:
import uxarray as ux
datapath = "path/to/where/data/is/stored"
ds = ux.open_dataset(datapath)
We can't always support opening based on a folder, but I think there are a few unambiguous and somewhat common cases where we could support it, and it would be very convenient. Those cases seem to be:
- (1) the folder contains files with exactly the names 'grid.nc' and 'data.nc', regardless of any other files in the folder --> open_dataset(datapath) == open_dataset('grid.nc', 'data.nc', path=datapath).
- (2) the folder contains only two files with supported extensions (e.g. two .nc files, and no files ending in .exo, .g, .nc4, .cpg, .dbf, …), and they differ only in that one says 'grid' and the other says 'data', e.g. 'gradient_data_subset.nc' and 'gradient_grid_subset.nc'. --> open_dataset(datapath) uses those two files.
- (3) the folder contains only one supported data file (e.g. one .nc file) and one .ug file --> open_dataset(datapath) == open_dataset(theugfile, thedatafile, path=datapath)
I believe the downside of slightly more complexity in the open_dataset signature and docstring would be outweighed by the upside of making uxarray easier to set up and use, especially initially for new users or in new analysis pipelines.
Tangentially related to #1479.
Proposed new feature or change:
It would be quite helpful if we could improve flexibillity in
uxarray.open_dataset(). In particular, I encounter the following pattern often:I would love to instead be able to do something like:
(Is
patha good name for that kwarg?)Even better, for a simple case where the file names really are just 'grid.nc' and 'data.nc', it would be awesome to do:
We can't always support opening based on a folder, but I think there are a few unambiguous and somewhat common cases where we could support it, and it would be very convenient. Those cases seem to be:
I believe the downside of slightly more complexity in the open_dataset signature and docstring would be outweighed by the upside of making uxarray easier to set up and use, especially initially for new users or in new analysis pipelines.
Tangentially related to #1479.