I'm trying to use xdatasets to be able to work on the local frequency analysis in xhydro. I've managed to install everything and my code work:
import xdatasets as xd
ds = xd.Query(
**{
"datasets": {
"deh": {
"id": ["03????"], # , "04????", "05????", "06????"],
"regulated": ["Natural", "Influenced (daily)"],
"variables": ["streamflow"]
}
},
"time": {"start": "1970-01-01",
"minimum_duration": (15*365, 'd')}
}
).data
<xarray.Dataset>
Dimensions: (id: 40, time: 20454, variable: 1, spatial_agg: 1,
timestep: 1, time_agg: 1, source: 1)
Coordinates: (12/15)
drainage_area (id) float32 562.0 1.55e+03 344.0 ... 1.051e+03 46.5 246.0
end_date (variable, id, spatial_agg, timestep, time_agg, source) datetime64[ns] ...
* id (id) object '030101' '030103' '030106' ... '030920' '030921'
latitude (id) float32 45.79 46.06 46.07 45.45 ... 45.09 45.08 45.1
longitude (id) float32 -71.97 -72.31 -71.98 ... -74.17 -73.85 -73.76
name (id) object 'Nicolet Sud' 'Nicolet' ... 'Noire' 'Des Anglais'
... ...
* spatial_agg (spatial_agg) object 'watershed'
start_date (variable, id, spatial_agg, timestep, time_agg, source) datetime64[ns] ...
* time (time) datetime64[ns] 1970-01-01 1970-01-02 ... 2025-12-31
* time_agg (time_agg) object 'mean'
* timestep (timestep) object 'D'
* variable (variable) object 'streamflow'
Data variables:
streamflow (id, time, variable, spatial_agg, timestep, time_agg, source) float32 dask.array<chunksize=(1, 20454, 1, 1, 1, 1, 1), meta=np.ndarray>
However, I've noticed that "streamflow" has no attributes at all. I'd uggest something like what exists in xclim:
streamflow:
units: m3 s-1
cell_methods: "time: mean"
description: The amount of water, in all phases, flowing in the river channel and flood plain.
standard_name: water_volume_transport_in_river_channel
P.S. A few standard_name are possible. The one above is the most generic, but incoming_water_volume_transport_in_river_channel and outgoing_water_volume_transport_in_river_channel are also valid alternatives if you know that information.
I'm trying to use
xdatasetsto be able to work on the local frequency analysis inxhydro. I've managed to install everything and my code work:However, I've noticed that "streamflow" has no attributes at all. I'd uggest something like what exists in
xclim:P.S. A few standard_name are possible. The one above is the most generic, but
incoming_water_volume_transport_in_river_channelandoutgoing_water_volume_transport_in_river_channelare also valid alternatives if you know that information.