Open hrodmn opened 1 month ago
🤯 there are too many ways to handle
First, I think we should rename bands_regex
-> assets_regex
I think I lost tracks but for xarray dataset we need a Variable=
option, right? I'm not sure why we need to pass bands_regex
to the reader (with read_options
), the variable
should be one asset from the list of assets returned
The mixed xarray
/rasterio
logic is starting to get a bit messy with conditional checks in the single CMRBackend
class. Maybe we are at the point where it would be cleaner to have several backends: CMRRasterioBackend
and CMRXarrayBackend
. There could be some shared utility functions but this structure might make it easier to do the right thing for each of these cases.
Right now titiler-cmr can handle the case where granules are defined by a distinct time point and where each granule has the same set of variables. There many datasets in CMR where each granule represents the same timestep but have a different variable. For example, the Regridded Harmonized World Soil Database v1.2 dataset has 27 granules that each contain estimates of a different soil property.
To handle this case we could use the
bands_regex
parameter for thexarray
backend case that would filter the granule results down to one that matches the regex. We would need to change the format of themosaic_assets
in this case since theZarrReader
can't handle the dictionary of{band: url}
keysget_assets
produces when you provideband_regex
.I hacked a solution together just to see if it is feasible, here are some tiles from the soil PH layer of that dataset: