STOFS 3D¶
# Install required libraries
# !pip install -q xarray_subset_grid@git+https://github.com/asascience-open/xarray-subset-grid.git
# !pip install -q s3fs cftime xarray cf-xarray fsspec dask h5netcdf
We use the Stofs-3d-Atl Out2d file to compute a subset selector and then reuse it to subset other files like temperature, salinity, etc.
In this example, we reuse it for temperature.
import cf_xarray #noqa
import fsspec
import xarray as xr
import xarray_subset_grid
# Open the dataset from NODD s3 bucket directly
fs = fsspec.filesystem("s3", anon=True)
ds = xr.open_dataset(
fs.open(
"s3://noaa-nos-stofs3d-pds/STOFS-3D-Atl-shadow-VIMS/20240716/out2d_20240717.nc"
),
chunks={},
engine='h5netcdf',
drop_variables=['nvel']
)
ds
<xarray.Dataset> Size: 4GB
Dimensions: (time: 24, one: 1, nSCHISM_hgrid_node: 2973769,
nSCHISM_hgrid_face: 5728020,
nSCHISM_hgrid_edge: 8701944,
nMaxSCHISM_hgrid_face_nodes: 4, two: 2)
Coordinates:
* time (time) datetime64[ns] 192B 2024-07-17T01:00:00 ....
SCHISM_hgrid_node_x (nSCHISM_hgrid_node) float64 24MB dask.array<chunksize=(495629,), meta=np.ndarray>
SCHISM_hgrid_node_y (nSCHISM_hgrid_node) float64 24MB dask.array<chunksize=(495629,), meta=np.ndarray>
SCHISM_hgrid_face_x (nSCHISM_hgrid_face) float64 46MB dask.array<chunksize=(520730,), meta=np.ndarray>
SCHISM_hgrid_face_y (nSCHISM_hgrid_face) float64 46MB dask.array<chunksize=(520730,), meta=np.ndarray>
SCHISM_hgrid_edge_x (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
SCHISM_hgrid_edge_y (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
Dimensions without coordinates: one, nSCHISM_hgrid_node, nSCHISM_hgrid_face,
nSCHISM_hgrid_edge,
nMaxSCHISM_hgrid_face_nodes, two
Data variables: (12/17)
minimum_depth (one) float64 8B dask.array<chunksize=(1,), meta=np.ndarray>
SCHISM_hgrid (one) |S1 1B dask.array<chunksize=(1,), meta=np.ndarray>
crs (one) int32 4B dask.array<chunksize=(1,), meta=np.ndarray>
depth (nSCHISM_hgrid_node) float32 12MB dask.array<chunksize=(991257,), meta=np.ndarray>
bottom_index_node (nSCHISM_hgrid_node) int32 12MB dask.array<chunksize=(991257,), meta=np.ndarray>
SCHISM_hgrid_face_nodes (nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes) float64 183MB dask.array<chunksize=(1145604, 1), meta=np.ndarray>
... ...
windSpeedX (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
windSpeedY (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
windStressX (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
windStressY (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
dryFlagElement (time, nSCHISM_hgrid_face) float32 550MB dask.array<chunksize=(1, 954670), meta=np.ndarray>
dryFlagSide (time, nSCHISM_hgrid_edge) float32 835MB dask.array<chunksize=(1, 966883), meta=np.ndarray>
Attributes:
NCO: netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, C...
history: Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedY,o,c,m/s -...- time: 24
- one: 1
- nSCHISM_hgrid_node: 2973769
- nSCHISM_hgrid_face: 5728020
- nSCHISM_hgrid_edge: 8701944
- nMaxSCHISM_hgrid_face_nodes: 4
- two: 2
- time(time)datetime64[ns]2024-07-17T01:00:00 ... 2024-07-18
- i23d :
- 0
- standard_name :
- time
- axis :
- T
- base_date :
- 2024 07 15 0 0
array(['2024-07-17T01:00:00.000000000', '2024-07-17T02:00:00.000000000', '2024-07-17T03:00:00.000000000', '2024-07-17T04:00:00.000000000', '2024-07-17T05:00:00.000000000', '2024-07-17T06:00:00.000000000', '2024-07-17T07:00:00.000000000', '2024-07-17T08:00:00.000000000', '2024-07-17T09:00:00.000000000', '2024-07-17T10:00:00.000000000', '2024-07-17T11:00:00.000000000', '2024-07-17T12:00:00.000000000', '2024-07-17T13:00:00.000000000', '2024-07-17T14:00:00.000000000', '2024-07-17T15:00:00.000000000', '2024-07-17T16:00:00.000000000', '2024-07-17T17:00:00.000000000', '2024-07-17T18:00:00.000000000', '2024-07-17T19:00:00.000000000', '2024-07-17T20:00:00.000000000', '2024-07-17T21:00:00.000000000', '2024-07-17T22:00:00.000000000', '2024-07-17T23:00:00.000000000', '2024-07-18T00:00:00.000000000'], dtype='datetime64[ns]') - SCHISM_hgrid_node_x(nSCHISM_hgrid_node)float64dask.array<chunksize=(495629,), meta=np.ndarray>
- axis :
- X
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 22.69 MiB 3.78 MiB Shape (2973769,) (495629,) Dask graph 6 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_node_y(nSCHISM_hgrid_node)float64dask.array<chunksize=(495629,), meta=np.ndarray>
- axis :
- Y
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 22.69 MiB 3.78 MiB Shape (2973769,) (495629,) Dask graph 6 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_x(nSCHISM_hgrid_face)float64dask.array<chunksize=(520730,), meta=np.ndarray>
- axis :
- X
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 43.70 MiB 3.97 MiB Shape (5728020,) (520730,) Dask graph 11 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_y(nSCHISM_hgrid_face)float64dask.array<chunksize=(520730,), meta=np.ndarray>
- axis :
- Y
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 43.70 MiB 3.97 MiB Shape (5728020,) (520730,) Dask graph 11 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_x(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- X
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_y(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- Y
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray
- minimum_depth(one)float64dask.array<chunksize=(1,), meta=np.ndarray>
- units :
- m
Array Chunk Bytes 8 B 8 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid(one)|S1dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Topology data of 2d unstructured mesh
- topology_dimension :
- 2
- cf_role :
- mesh_topology
- node_coordinates :
- SCHISM_hgrid_node_x SCHISM_hgrid_node_y
- edge_coordinates :
- SCHISM_hgrid_edge_x SCHISM_hgrid_edge_y
- face_coordinates :
- SCHISM_hgrid_face_x SCHISM_hgrid_face_y
- edge_node_connectivity :
- SCHISM_hgrid_edge_nodes
- face_node_connectivity :
- SCHISM_hgrid_face_nodes
Array Chunk Bytes 1 B 1 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type |S1 numpy.ndarray - crs(one)int32dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Coordinate reference system (CRS) definition
- grid_mapping_name :
- latitude_longitude
- longitude_of_prime_meridian :
- 0.0
- semi_major_axis :
- 6378137.0
- inverse_flattening :
- 298.25723
Array Chunk Bytes 4 B 4 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type int32 numpy.ndarray - depth(nSCHISM_hgrid_node)float32dask.array<chunksize=(991257,), meta=np.ndarray>
- units :
- m
- axis :
- Z
- positive :
- down
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 11.34 MiB 3.78 MiB Shape (2973769,) (991257,) Dask graph 3 chunks in 2 graph layers Data type float32 numpy.ndarray - bottom_index_node(nSCHISM_hgrid_node)int32dask.array<chunksize=(991257,), meta=np.ndarray>
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 11.34 MiB 3.78 MiB Shape (2973769,) (991257,) Dask graph 3 chunks in 2 graph layers Data type int32 numpy.ndarray - SCHISM_hgrid_face_nodes(nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes)float64dask.array<chunksize=(1145604, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- face_node_connectivity
Array Chunk Bytes 174.81 MiB 8.74 MiB Shape (5728020, 4) (1145604, 1) Dask graph 20 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_nodes(nSCHISM_hgrid_edge, two)float64dask.array<chunksize=(1740389, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- edge_node_connectivity
Array Chunk Bytes 132.78 MiB 13.28 MiB Shape (8701944, 2) (1740389, 1) Dask graph 10 chunks in 2 graph layers Data type float64 numpy.ndarray - dryFlagNode(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - elevation(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - evaporationRate(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - precipitationRate(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windSpeedX(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m/s
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windSpeedY(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m/s
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windStressX(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windStressY(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - dryFlagElement(time, nSCHISM_hgrid_face)float32dask.array<chunksize=(1, 954670), meta=np.ndarray>
- i23d :
- 4
- location :
- face
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 524.42 MiB 3.64 MiB Shape (24, 5728020) (1, 954670) Dask graph 144 chunks in 2 graph layers Data type float32 numpy.ndarray - dryFlagSide(time, nSCHISM_hgrid_edge)float32dask.array<chunksize=(1, 966883), meta=np.ndarray>
- i23d :
- 7
- location :
- edge
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 796.69 MiB 3.69 MiB Shape (24, 8701944) (1, 966883) Dask graph 216 chunks in 2 graph layers Data type float32 numpy.ndarray
- timePandasIndex
PandasIndex(DatetimeIndex(['2024-07-17 01:00:00', '2024-07-17 02:00:00', '2024-07-17 03:00:00', '2024-07-17 04:00:00', '2024-07-17 05:00:00', '2024-07-17 06:00:00', '2024-07-17 07:00:00', '2024-07-17 08:00:00', '2024-07-17 09:00:00', '2024-07-17 10:00:00', '2024-07-17 11:00:00', '2024-07-17 12:00:00', '2024-07-17 13:00:00', '2024-07-17 14:00:00', '2024-07-17 15:00:00', '2024-07-17 16:00:00', '2024-07-17 17:00:00', '2024-07-17 18:00:00', '2024-07-17 19:00:00', '2024-07-17 20:00:00', '2024-07-17 21:00:00', '2024-07-17 22:00:00', '2024-07-17 23:00:00', '2024-07-18 00:00:00'], dtype='datetime64[ns]', name='time', freq=None))
- NCO :
- netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)
- history :
- Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedY,o,c,m/s -a data_horizontal_center,windSpeedY,o,c,node -a data_vertical_center,windSpeedY,o,c,full -a mesh,windSpeedY,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedX,o,c,m/s -a data_horizontal_center,windSpeedX,o,c,node -a data_vertical_center,windSpeedX,o,c,full -a mesh,windSpeedX,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,elevation,o,c,m -a data_horizontal_center,elevation,o,c,node -a data_vertical_center,elevation,o,c,full -a mesh,elevation,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,time,o,c,seconds since 2024-07-15 0:00:00 +0 -a base_date,time,o,c,2024 07 15 0 0 ./outputs/out2d_3.nc
Fix any inconsistencies with regards to the dataset’s UGRID specifications. (Make the dataset CF compliant)
ds = xarray_subset_grid.grids.ugrid.assign_ugrid_topology(ds)
f"Dataset size: {ds.nbytes * 1.0e-9} Gb"
'Dataset size: 4.293908965 Gb'
Example BBOX¶
Drawn with https://geojson.io

Compute the subset selection ahead of time, because STOFS doesn’t include the grid in all of its output files.
Specify the selector name for easier accessibility. (optional)
%%time
bbox = (-70, 40, -60, 50)
name = 'northeastUSA'
bbox_selector = ds.xsg.grid.compute_bbox_subset_selector(ds, bbox, name)
bbox_selector
CPU times: user 6.54 s, sys: 829 ms, total: 7.37 s
Wall time: 11.8 s
<class 'xarray_subset_grid.grids.ugrid.UGridSelector'> - northeastUSA
Then we can slice this dataset to make sure it works. This is FAST because the hard part is already done
%%time
ds_subset_control = bbox_selector.select(ds)
ds_subset_control
CPU times: user 301 ms, sys: 2.83 ms, total: 304 ms
Wall time: 301 ms
<xarray.Dataset> Size: 1GB
Dimensions: (time: 24, one: 1, nSCHISM_hgrid_node: 142475,
nSCHISM_hgrid_face: 274187,
nSCHISM_hgrid_edge: 8701944,
nMaxSCHISM_hgrid_face_nodes: 4, two: 2)
Coordinates:
* time (time) datetime64[ns] 192B 2024-07-17T01:00:00 ....
SCHISM_hgrid_node_x (nSCHISM_hgrid_node) float64 1MB dask.array<chunksize=(7165,), meta=np.ndarray>
SCHISM_hgrid_node_y (nSCHISM_hgrid_node) float64 1MB dask.array<chunksize=(7165,), meta=np.ndarray>
SCHISM_hgrid_face_x (nSCHISM_hgrid_face) float64 2MB dask.array<chunksize=(166039,), meta=np.ndarray>
SCHISM_hgrid_face_y (nSCHISM_hgrid_face) float64 2MB dask.array<chunksize=(166039,), meta=np.ndarray>
SCHISM_hgrid_edge_x (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
SCHISM_hgrid_edge_y (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
Dimensions without coordinates: one, nSCHISM_hgrid_node, nSCHISM_hgrid_face,
nSCHISM_hgrid_edge,
nMaxSCHISM_hgrid_face_nodes, two
Data variables: (12/17)
minimum_depth (one) float64 8B dask.array<chunksize=(1,), meta=np.ndarray>
SCHISM_hgrid (one) |S1 1B dask.array<chunksize=(1,), meta=np.ndarray>
crs (one) int32 4B dask.array<chunksize=(1,), meta=np.ndarray>
depth (nSCHISM_hgrid_node) float32 570kB dask.array<chunksize=(142475,), meta=np.ndarray>
bottom_index_node (nSCHISM_hgrid_node) int32 570kB dask.array<chunksize=(142475,), meta=np.ndarray>
SCHISM_hgrid_face_nodes (nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes) float64 9MB dask.array<chunksize=(265743, 1), meta=np.ndarray>
... ...
windSpeedX (time, nSCHISM_hgrid_node) float32 14MB dask.array<chunksize=(1, 142475), meta=np.ndarray>
windSpeedY (time, nSCHISM_hgrid_node) float32 14MB dask.array<chunksize=(1, 142475), meta=np.ndarray>
windStressX (time, nSCHISM_hgrid_node) float32 14MB dask.array<chunksize=(1, 142475), meta=np.ndarray>
windStressY (time, nSCHISM_hgrid_node) float32 14MB dask.array<chunksize=(1, 142475), meta=np.ndarray>
dryFlagElement (time, nSCHISM_hgrid_face) float32 26MB dask.array<chunksize=(1, 253878), meta=np.ndarray>
dryFlagSide (time, nSCHISM_hgrid_edge) float32 835MB dask.array<chunksize=(1, 966883), meta=np.ndarray>
Attributes:
NCO: netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, C...
history: Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedY,o,c,m/s -...- time: 24
- one: 1
- nSCHISM_hgrid_node: 142475
- nSCHISM_hgrid_face: 274187
- nSCHISM_hgrid_edge: 8701944
- nMaxSCHISM_hgrid_face_nodes: 4
- two: 2
- time(time)datetime64[ns]2024-07-17T01:00:00 ... 2024-07-18
- i23d :
- 0
- standard_name :
- time
- axis :
- T
- base_date :
- 2024 07 15 0 0
array(['2024-07-17T01:00:00.000000000', '2024-07-17T02:00:00.000000000', '2024-07-17T03:00:00.000000000', '2024-07-17T04:00:00.000000000', '2024-07-17T05:00:00.000000000', '2024-07-17T06:00:00.000000000', '2024-07-17T07:00:00.000000000', '2024-07-17T08:00:00.000000000', '2024-07-17T09:00:00.000000000', '2024-07-17T10:00:00.000000000', '2024-07-17T11:00:00.000000000', '2024-07-17T12:00:00.000000000', '2024-07-17T13:00:00.000000000', '2024-07-17T14:00:00.000000000', '2024-07-17T15:00:00.000000000', '2024-07-17T16:00:00.000000000', '2024-07-17T17:00:00.000000000', '2024-07-17T18:00:00.000000000', '2024-07-17T19:00:00.000000000', '2024-07-17T20:00:00.000000000', '2024-07-17T21:00:00.000000000', '2024-07-17T22:00:00.000000000', '2024-07-17T23:00:00.000000000', '2024-07-18T00:00:00.000000000'], dtype='datetime64[ns]') - SCHISM_hgrid_node_x(nSCHISM_hgrid_node)float64dask.array<chunksize=(7165,), meta=np.ndarray>
- axis :
- X
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 1.09 MiB 1.03 MiB Shape (142475,) (135310,) Dask graph 2 chunks in 3 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_node_y(nSCHISM_hgrid_node)float64dask.array<chunksize=(7165,), meta=np.ndarray>
- axis :
- Y
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 1.09 MiB 1.03 MiB Shape (142475,) (135310,) Dask graph 2 chunks in 3 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_x(nSCHISM_hgrid_face)float64dask.array<chunksize=(166039,), meta=np.ndarray>
- axis :
- X
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 2.09 MiB 1.27 MiB Shape (274187,) (166039,) Dask graph 5 chunks in 3 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_y(nSCHISM_hgrid_face)float64dask.array<chunksize=(166039,), meta=np.ndarray>
- axis :
- Y
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 2.09 MiB 1.27 MiB Shape (274187,) (166039,) Dask graph 5 chunks in 3 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_x(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- X
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_y(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- Y
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray
- minimum_depth(one)float64dask.array<chunksize=(1,), meta=np.ndarray>
- units :
- m
Array Chunk Bytes 8 B 8 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid(one)|S1dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Topology data of 2d unstructured mesh
- topology_dimension :
- 2
- cf_role :
- mesh_topology
- node_coordinates :
- SCHISM_hgrid_node_x SCHISM_hgrid_node_y
- edge_coordinates :
- SCHISM_hgrid_edge_x SCHISM_hgrid_edge_y
- face_coordinates :
- SCHISM_hgrid_face_x SCHISM_hgrid_face_y
- edge_node_connectivity :
- SCHISM_hgrid_edge_nodes
- face_node_connectivity :
- SCHISM_hgrid_face_nodes
- face_dimension :
- nSCHISM_hgrid_face
Array Chunk Bytes 1 B 1 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type |S1 numpy.ndarray - crs(one)int32dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Coordinate reference system (CRS) definition
- grid_mapping_name :
- latitude_longitude
- longitude_of_prime_meridian :
- 0.0
- semi_major_axis :
- 6378137.0
- inverse_flattening :
- 298.25723
Array Chunk Bytes 4 B 4 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type int32 numpy.ndarray - depth(nSCHISM_hgrid_node)float32dask.array<chunksize=(142475,), meta=np.ndarray>
- units :
- m
- axis :
- Z
- positive :
- down
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 556.54 kiB 556.54 kiB Shape (142475,) (142475,) Dask graph 1 chunks in 3 graph layers Data type float32 numpy.ndarray - bottom_index_node(nSCHISM_hgrid_node)int32dask.array<chunksize=(142475,), meta=np.ndarray>
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 556.54 kiB 556.54 kiB Shape (142475,) (142475,) Dask graph 1 chunks in 3 graph layers Data type int32 numpy.ndarray - SCHISM_hgrid_face_nodes(nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes)float64dask.array<chunksize=(265743, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- face_node_connectivity
Array Chunk Bytes 8.37 MiB 2.03 MiB Shape (274187, 4) (265743, 1) Dask graph 12 chunks in 4 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_nodes(nSCHISM_hgrid_edge, two)float64dask.array<chunksize=(1740389, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- edge_node_connectivity
Array Chunk Bytes 132.78 MiB 13.28 MiB Shape (8701944, 2) (1740389, 1) Dask graph 10 chunks in 2 graph layers Data type float64 numpy.ndarray - dryFlagNode(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - elevation(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - evaporationRate(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - precipitationRate(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - windSpeedX(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m/s
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - windSpeedY(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m/s
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - windStressX(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - windStressY(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 142475), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 13.04 MiB 556.54 kiB Shape (24, 142475) (1, 142475) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray - dryFlagElement(time, nSCHISM_hgrid_face)float32dask.array<chunksize=(1, 253878), meta=np.ndarray>
- i23d :
- 4
- location :
- face
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 25.10 MiB 0.97 MiB Shape (24, 274187) (1, 253878) Dask graph 72 chunks in 3 graph layers Data type float32 numpy.ndarray - dryFlagSide(time, nSCHISM_hgrid_edge)float32dask.array<chunksize=(1, 966883), meta=np.ndarray>
- i23d :
- 7
- location :
- edge
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 796.69 MiB 3.69 MiB Shape (24, 8701944) (1, 966883) Dask graph 216 chunks in 2 graph layers Data type float32 numpy.ndarray
- timePandasIndex
PandasIndex(DatetimeIndex(['2024-07-17 01:00:00', '2024-07-17 02:00:00', '2024-07-17 03:00:00', '2024-07-17 04:00:00', '2024-07-17 05:00:00', '2024-07-17 06:00:00', '2024-07-17 07:00:00', '2024-07-17 08:00:00', '2024-07-17 09:00:00', '2024-07-17 10:00:00', '2024-07-17 11:00:00', '2024-07-17 12:00:00', '2024-07-17 13:00:00', '2024-07-17 14:00:00', '2024-07-17 15:00:00', '2024-07-17 16:00:00', '2024-07-17 17:00:00', '2024-07-17 18:00:00', '2024-07-17 19:00:00', '2024-07-17 20:00:00', '2024-07-17 21:00:00', '2024-07-17 22:00:00', '2024-07-17 23:00:00', '2024-07-18 00:00:00'], dtype='datetime64[ns]', name='time', freq=None))
- NCO :
- netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)
- history :
- Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedY,o,c,m/s -a data_horizontal_center,windSpeedY,o,c,node -a data_vertical_center,windSpeedY,o,c,full -a mesh,windSpeedY,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedX,o,c,m/s -a data_horizontal_center,windSpeedX,o,c,node -a data_vertical_center,windSpeedX,o,c,full -a mesh,windSpeedX,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,elevation,o,c,m -a data_horizontal_center,elevation,o,c,node -a data_vertical_center,elevation,o,c,full -a mesh,elevation,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,time,o,c,seconds since 2024-07-15 0:00:00 +0 -a base_date,time,o,c,2024 07 15 0 0 ./outputs/out2d_3.nc
f"Dataset size: {ds_subset_control.nbytes * 1.0e-9} Gb"
'Dataset size: 1.2661721650000002 Gb'
We can save the selector to disk. (as a pickle file)
Use the save_to_bytes function to return the selector as a bytes object.
To get a unique filename, you can use the get_hashname function.
selector_bytes = bbox_selector.save_to_bytes()
filepath = bbox_selector.get_hashname()
with open(filepath, 'wb') as f:
f.write(selector_bytes)
'northeastUSA_bb3d126e.pkl'
Open a selector using a bytes object. This retains the subclass of the selector (i.e, UGridSelector, SGridSelector, etc)
from xarray_subset_grid import Selector
selector_bytes = open(filepath, 'rb').read()
loaded_bbox_selector = Selector(selector_bytes)
loaded_bbox_selector
<class 'xarray_subset_grid.grids.ugrid.UGridSelector'> - northeastUSA
Test if both the selectors are same.
bbox_selector == loaded_bbox_selector
True
Now we can load in a STOFS 3D - temperature file from a different day and subset it!
ds_temp = xr.open_dataset(
fs.open(
"s3://noaa-nos-stofs3d-pds/STOFS-3D-Atl-shadow-VIMS/20240728/temperature_20240728.nc"
),
chunks={},
drop_variables=['nvel']
)
ds_temp = xarray_subset_grid.grids.ugrid.assign_ugrid_topology(ds_temp)
ds
<xarray.Dataset> Size: 4GB
Dimensions: (time: 24, one: 1, nSCHISM_hgrid_node: 2973769,
nSCHISM_hgrid_face: 5728020,
nSCHISM_hgrid_edge: 8701944,
nMaxSCHISM_hgrid_face_nodes: 4, two: 2)
Coordinates:
* time (time) datetime64[ns] 192B 2024-07-17T01:00:00 ....
SCHISM_hgrid_node_x (nSCHISM_hgrid_node) float64 24MB dask.array<chunksize=(495629,), meta=np.ndarray>
SCHISM_hgrid_node_y (nSCHISM_hgrid_node) float64 24MB dask.array<chunksize=(495629,), meta=np.ndarray>
SCHISM_hgrid_face_x (nSCHISM_hgrid_face) float64 46MB dask.array<chunksize=(520730,), meta=np.ndarray>
SCHISM_hgrid_face_y (nSCHISM_hgrid_face) float64 46MB dask.array<chunksize=(520730,), meta=np.ndarray>
SCHISM_hgrid_edge_x (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
SCHISM_hgrid_edge_y (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
Dimensions without coordinates: one, nSCHISM_hgrid_node, nSCHISM_hgrid_face,
nSCHISM_hgrid_edge,
nMaxSCHISM_hgrid_face_nodes, two
Data variables: (12/17)
minimum_depth (one) float64 8B dask.array<chunksize=(1,), meta=np.ndarray>
SCHISM_hgrid (one) |S1 1B dask.array<chunksize=(1,), meta=np.ndarray>
crs (one) int32 4B dask.array<chunksize=(1,), meta=np.ndarray>
depth (nSCHISM_hgrid_node) float32 12MB dask.array<chunksize=(991257,), meta=np.ndarray>
bottom_index_node (nSCHISM_hgrid_node) int32 12MB dask.array<chunksize=(991257,), meta=np.ndarray>
SCHISM_hgrid_face_nodes (nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes) float64 183MB dask.array<chunksize=(1145604, 1), meta=np.ndarray>
... ...
windSpeedX (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
windSpeedY (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
windStressX (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
windStressY (time, nSCHISM_hgrid_node) float32 285MB dask.array<chunksize=(1, 991257), meta=np.ndarray>
dryFlagElement (time, nSCHISM_hgrid_face) float32 550MB dask.array<chunksize=(1, 954670), meta=np.ndarray>
dryFlagSide (time, nSCHISM_hgrid_edge) float32 835MB dask.array<chunksize=(1, 966883), meta=np.ndarray>
Attributes:
NCO: netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, C...
history: Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedY,o,c,m/s -...- time: 24
- one: 1
- nSCHISM_hgrid_node: 2973769
- nSCHISM_hgrid_face: 5728020
- nSCHISM_hgrid_edge: 8701944
- nMaxSCHISM_hgrid_face_nodes: 4
- two: 2
- time(time)datetime64[ns]2024-07-17T01:00:00 ... 2024-07-18
- i23d :
- 0
- standard_name :
- time
- axis :
- T
- base_date :
- 2024 07 15 0 0
array(['2024-07-17T01:00:00.000000000', '2024-07-17T02:00:00.000000000', '2024-07-17T03:00:00.000000000', '2024-07-17T04:00:00.000000000', '2024-07-17T05:00:00.000000000', '2024-07-17T06:00:00.000000000', '2024-07-17T07:00:00.000000000', '2024-07-17T08:00:00.000000000', '2024-07-17T09:00:00.000000000', '2024-07-17T10:00:00.000000000', '2024-07-17T11:00:00.000000000', '2024-07-17T12:00:00.000000000', '2024-07-17T13:00:00.000000000', '2024-07-17T14:00:00.000000000', '2024-07-17T15:00:00.000000000', '2024-07-17T16:00:00.000000000', '2024-07-17T17:00:00.000000000', '2024-07-17T18:00:00.000000000', '2024-07-17T19:00:00.000000000', '2024-07-17T20:00:00.000000000', '2024-07-17T21:00:00.000000000', '2024-07-17T22:00:00.000000000', '2024-07-17T23:00:00.000000000', '2024-07-18T00:00:00.000000000'], dtype='datetime64[ns]') - SCHISM_hgrid_node_x(nSCHISM_hgrid_node)float64dask.array<chunksize=(495629,), meta=np.ndarray>
- axis :
- X
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 22.69 MiB 3.78 MiB Shape (2973769,) (495629,) Dask graph 6 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_node_y(nSCHISM_hgrid_node)float64dask.array<chunksize=(495629,), meta=np.ndarray>
- axis :
- Y
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 22.69 MiB 3.78 MiB Shape (2973769,) (495629,) Dask graph 6 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_x(nSCHISM_hgrid_face)float64dask.array<chunksize=(520730,), meta=np.ndarray>
- axis :
- X
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 43.70 MiB 3.97 MiB Shape (5728020,) (520730,) Dask graph 11 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_y(nSCHISM_hgrid_face)float64dask.array<chunksize=(520730,), meta=np.ndarray>
- axis :
- Y
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 43.70 MiB 3.97 MiB Shape (5728020,) (520730,) Dask graph 11 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_x(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- X
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_y(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- Y
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray
- minimum_depth(one)float64dask.array<chunksize=(1,), meta=np.ndarray>
- units :
- m
Array Chunk Bytes 8 B 8 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid(one)|S1dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Topology data of 2d unstructured mesh
- topology_dimension :
- 2
- cf_role :
- mesh_topology
- node_coordinates :
- SCHISM_hgrid_node_x SCHISM_hgrid_node_y
- edge_coordinates :
- SCHISM_hgrid_edge_x SCHISM_hgrid_edge_y
- face_coordinates :
- SCHISM_hgrid_face_x SCHISM_hgrid_face_y
- edge_node_connectivity :
- SCHISM_hgrid_edge_nodes
- face_node_connectivity :
- SCHISM_hgrid_face_nodes
- face_dimension :
- nSCHISM_hgrid_face
Array Chunk Bytes 1 B 1 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type |S1 numpy.ndarray - crs(one)int32dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Coordinate reference system (CRS) definition
- grid_mapping_name :
- latitude_longitude
- longitude_of_prime_meridian :
- 0.0
- semi_major_axis :
- 6378137.0
- inverse_flattening :
- 298.25723
Array Chunk Bytes 4 B 4 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type int32 numpy.ndarray - depth(nSCHISM_hgrid_node)float32dask.array<chunksize=(991257,), meta=np.ndarray>
- units :
- m
- axis :
- Z
- positive :
- down
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 11.34 MiB 3.78 MiB Shape (2973769,) (991257,) Dask graph 3 chunks in 2 graph layers Data type float32 numpy.ndarray - bottom_index_node(nSCHISM_hgrid_node)int32dask.array<chunksize=(991257,), meta=np.ndarray>
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 11.34 MiB 3.78 MiB Shape (2973769,) (991257,) Dask graph 3 chunks in 2 graph layers Data type int32 numpy.ndarray - SCHISM_hgrid_face_nodes(nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes)float64dask.array<chunksize=(1145604, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- face_node_connectivity
Array Chunk Bytes 174.81 MiB 8.74 MiB Shape (5728020, 4) (1145604, 1) Dask graph 20 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_nodes(nSCHISM_hgrid_edge, two)float64dask.array<chunksize=(1740389, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- edge_node_connectivity
Array Chunk Bytes 132.78 MiB 13.28 MiB Shape (8701944, 2) (1740389, 1) Dask graph 10 chunks in 2 graph layers Data type float64 numpy.ndarray - dryFlagNode(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - elevation(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - evaporationRate(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - precipitationRate(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windSpeedX(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m/s
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windSpeedY(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- m/s
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windStressX(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - windStressY(time, nSCHISM_hgrid_node)float32dask.array<chunksize=(1, 991257), meta=np.ndarray>
- i23d :
- 1
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 272.26 MiB 3.78 MiB Shape (24, 2973769) (1, 991257) Dask graph 72 chunks in 2 graph layers Data type float32 numpy.ndarray - dryFlagElement(time, nSCHISM_hgrid_face)float32dask.array<chunksize=(1, 954670), meta=np.ndarray>
- i23d :
- 4
- location :
- face
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 524.42 MiB 3.64 MiB Shape (24, 5728020) (1, 954670) Dask graph 144 chunks in 2 graph layers Data type float32 numpy.ndarray - dryFlagSide(time, nSCHISM_hgrid_edge)float32dask.array<chunksize=(1, 966883), meta=np.ndarray>
- i23d :
- 7
- location :
- edge
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 796.69 MiB 3.69 MiB Shape (24, 8701944) (1, 966883) Dask graph 216 chunks in 2 graph layers Data type float32 numpy.ndarray
- timePandasIndex
PandasIndex(DatetimeIndex(['2024-07-17 01:00:00', '2024-07-17 02:00:00', '2024-07-17 03:00:00', '2024-07-17 04:00:00', '2024-07-17 05:00:00', '2024-07-17 06:00:00', '2024-07-17 07:00:00', '2024-07-17 08:00:00', '2024-07-17 09:00:00', '2024-07-17 10:00:00', '2024-07-17 11:00:00', '2024-07-17 12:00:00', '2024-07-17 13:00:00', '2024-07-17 14:00:00', '2024-07-17 15:00:00', '2024-07-17 16:00:00', '2024-07-17 17:00:00', '2024-07-17 18:00:00', '2024-07-17 19:00:00', '2024-07-17 20:00:00', '2024-07-17 21:00:00', '2024-07-17 22:00:00', '2024-07-17 23:00:00', '2024-07-18 00:00:00'], dtype='datetime64[ns]', name='time', freq=None))
- NCO :
- netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)
- history :
- Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedY,o,c,m/s -a data_horizontal_center,windSpeedY,o,c,node -a data_vertical_center,windSpeedY,o,c,full -a mesh,windSpeedY,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,windSpeedX,o,c,m/s -a data_horizontal_center,windSpeedX,o,c,node -a data_vertical_center,windSpeedX,o,c,full -a mesh,windSpeedX,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,elevation,o,c,m -a data_horizontal_center,elevation,o,c,node -a data_vertical_center,elevation,o,c,full -a mesh,elevation,o,c,SCHISM_hgrid ./outputs/out2d_3.nc Wed Jul 17 02:17:50 2024: ncatted -a units,time,o,c,seconds since 2024-07-15 0:00:00 +0 -a base_date,time,o,c,2024 07 15 0 0 ./outputs/out2d_3.nc
And then slice it with the same selector!
%%time
ds_temp_subset = loaded_bbox_selector.select(ds_temp)
ds_temp_subset
CPU times: user 171 ms, sys: 129 µs, total: 172 ms
Wall time: 172 ms
<xarray.Dataset> Size: 965MB
Dimensions: (time: 24, one: 1, nSCHISM_hgrid_node: 142475,
nSCHISM_hgrid_face: 274187,
nSCHISM_hgrid_edge: 8701944,
nMaxSCHISM_hgrid_face_nodes: 4, two: 2,
nSCHISM_vgrid_layers: 49)
Coordinates:
* time (time) datetime64[ns] 192B 2024-07-28T01:00:00 ....
SCHISM_hgrid_node_x (nSCHISM_hgrid_node) float64 1MB dask.array<chunksize=(7165,), meta=np.ndarray>
SCHISM_hgrid_node_y (nSCHISM_hgrid_node) float64 1MB dask.array<chunksize=(7165,), meta=np.ndarray>
Dimensions without coordinates: one, nSCHISM_hgrid_node, nSCHISM_hgrid_face,
nSCHISM_hgrid_edge,
nMaxSCHISM_hgrid_face_nodes, two,
nSCHISM_vgrid_layers
Data variables:
minimum_depth (one) float64 8B dask.array<chunksize=(1,), meta=np.ndarray>
SCHISM_hgrid (one) |S1 1B dask.array<chunksize=(1,), meta=np.ndarray>
crs (one) int32 4B dask.array<chunksize=(1,), meta=np.ndarray>
depth (nSCHISM_hgrid_node) float32 570kB dask.array<chunksize=(142475,), meta=np.ndarray>
bottom_index_node (nSCHISM_hgrid_node) int32 570kB dask.array<chunksize=(142475,), meta=np.ndarray>
SCHISM_hgrid_face_x (nSCHISM_hgrid_face) float64 2MB dask.array<chunksize=(166039,), meta=np.ndarray>
SCHISM_hgrid_face_y (nSCHISM_hgrid_face) float64 2MB dask.array<chunksize=(166039,), meta=np.ndarray>
SCHISM_hgrid_edge_x (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
SCHISM_hgrid_edge_y (nSCHISM_hgrid_edge) float64 70MB dask.array<chunksize=(511880,), meta=np.ndarray>
SCHISM_hgrid_face_nodes (nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes) float64 9MB dask.array<chunksize=(265743, 1), meta=np.ndarray>
SCHISM_hgrid_edge_nodes (nSCHISM_hgrid_edge, two) float64 139MB dask.array<chunksize=(1740389, 1), meta=np.ndarray>
temperature (time, nSCHISM_hgrid_node, nSCHISM_vgrid_layers) float32 670MB dask.array<chunksize=(1, 142475, 49), meta=np.ndarray>
Attributes:
NCO: netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, C...
history: Mon Jul 29 02:42:02 2024: ncatted -a units,temperature,o,c,Degr...- time: 24
- one: 1
- nSCHISM_hgrid_node: 142475
- nSCHISM_hgrid_face: 274187
- nSCHISM_hgrid_edge: 8701944
- nMaxSCHISM_hgrid_face_nodes: 4
- two: 2
- nSCHISM_vgrid_layers: 49
- time(time)datetime64[ns]2024-07-28T01:00:00 ... 2024-07-29
- i23d :
- 0
- standard_name :
- time
- axis :
- T
- base_date :
- 2024 07 27 0 0
array(['2024-07-28T01:00:00.000000000', '2024-07-28T02:00:00.000000000', '2024-07-28T03:00:00.000000000', '2024-07-28T04:00:00.000000000', '2024-07-28T05:00:00.000000000', '2024-07-28T06:00:00.000000000', '2024-07-28T07:00:00.000000000', '2024-07-28T08:00:00.000000000', '2024-07-28T09:00:00.000000000', '2024-07-28T10:00:00.000000000', '2024-07-28T11:00:00.000000000', '2024-07-28T12:00:00.000000000', '2024-07-28T13:00:00.000000000', '2024-07-28T14:00:00.000000000', '2024-07-28T15:00:00.000000000', '2024-07-28T16:00:00.000000000', '2024-07-28T17:00:00.000000000', '2024-07-28T18:00:00.000000000', '2024-07-28T19:00:00.000000000', '2024-07-28T20:00:00.000000000', '2024-07-28T21:00:00.000000000', '2024-07-28T22:00:00.000000000', '2024-07-28T23:00:00.000000000', '2024-07-29T00:00:00.000000000'], dtype='datetime64[ns]') - SCHISM_hgrid_node_x(nSCHISM_hgrid_node)float64dask.array<chunksize=(7165,), meta=np.ndarray>
- axis :
- X
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 1.09 MiB 1.03 MiB Shape (142475,) (135310,) Dask graph 2 chunks in 3 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_node_y(nSCHISM_hgrid_node)float64dask.array<chunksize=(7165,), meta=np.ndarray>
- axis :
- Y
- location :
- node
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 1.09 MiB 1.03 MiB Shape (142475,) (135310,) Dask graph 2 chunks in 3 graph layers Data type float64 numpy.ndarray
- minimum_depth(one)float64dask.array<chunksize=(1,), meta=np.ndarray>
- units :
- m
Array Chunk Bytes 8 B 8 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid(one)|S1dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Topology data of 2d unstructured mesh
- topology_dimension :
- 2
- cf_role :
- mesh_topology
- node_coordinates :
- SCHISM_hgrid_node_x SCHISM_hgrid_node_y
- edge_coordinates :
- SCHISM_hgrid_edge_x SCHISM_hgrid_edge_y
- face_coordinates :
- SCHISM_hgrid_face_x SCHISM_hgrid_face_y
- edge_node_connectivity :
- SCHISM_hgrid_edge_nodes
- face_node_connectivity :
- SCHISM_hgrid_face_nodes
- face_dimension :
- nSCHISM_hgrid_face
Array Chunk Bytes 1 B 1 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type |S1 numpy.ndarray - crs(one)int32dask.array<chunksize=(1,), meta=np.ndarray>
- long_name :
- Coordinate reference system (CRS) definition
- grid_mapping_name :
- latitude_longitude
- longitude_of_prime_meridian :
- 0.0
- semi_major_axis :
- 6378137.0
- inverse_flattening :
- 298.25723
Array Chunk Bytes 4 B 4 B Shape (1,) (1,) Dask graph 1 chunks in 2 graph layers Data type int32 numpy.ndarray - depth(nSCHISM_hgrid_node)float32dask.array<chunksize=(142475,), meta=np.ndarray>
- units :
- m
- axis :
- Z
- positive :
- down
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 556.54 kiB 556.54 kiB Shape (142475,) (142475,) Dask graph 1 chunks in 3 graph layers Data type float32 numpy.ndarray - bottom_index_node(nSCHISM_hgrid_node)int32dask.array<chunksize=(142475,), meta=np.ndarray>
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
Array Chunk Bytes 556.54 kiB 556.54 kiB Shape (142475,) (142475,) Dask graph 1 chunks in 3 graph layers Data type int32 numpy.ndarray - SCHISM_hgrid_face_x(nSCHISM_hgrid_face)float64dask.array<chunksize=(166039,), meta=np.ndarray>
- axis :
- X
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 2.09 MiB 1.27 MiB Shape (274187,) (166039,) Dask graph 5 chunks in 3 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_y(nSCHISM_hgrid_face)float64dask.array<chunksize=(166039,), meta=np.ndarray>
- axis :
- Y
- location :
- face
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 2.09 MiB 1.27 MiB Shape (274187,) (166039,) Dask graph 5 chunks in 3 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_x(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- X
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_E
- standard_name :
- longitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_y(nSCHISM_hgrid_edge)float64dask.array<chunksize=(511880,), meta=np.ndarray>
- axis :
- Y
- location :
- edge
- mesh :
- SCHISM_hgrid
- units :
- degree_N
- standard_name :
- latitude
Array Chunk Bytes 66.39 MiB 3.91 MiB Shape (8701944,) (511880,) Dask graph 17 chunks in 2 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_face_nodes(nSCHISM_hgrid_face, nMaxSCHISM_hgrid_face_nodes)float64dask.array<chunksize=(265743, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- face_node_connectivity
Array Chunk Bytes 8.37 MiB 2.03 MiB Shape (274187, 4) (265743, 1) Dask graph 12 chunks in 4 graph layers Data type float64 numpy.ndarray - SCHISM_hgrid_edge_nodes(nSCHISM_hgrid_edge, two)float64dask.array<chunksize=(1740389, 1), meta=np.ndarray>
- start_index :
- 1
- cf_role :
- edge_node_connectivity
Array Chunk Bytes 132.78 MiB 13.28 MiB Shape (8701944, 2) (1740389, 1) Dask graph 10 chunks in 2 graph layers Data type float64 numpy.ndarray - temperature(time, nSCHISM_hgrid_node, nSCHISM_vgrid_layers)float32dask.array<chunksize=(1, 142475, 49), meta=np.ndarray>
- i23d :
- 2
- location :
- node
- grid_mapping :
- crs
- mesh :
- SCHISM_hgrid
- units :
- Degree C
- data_horizontal_center :
- node
- data_vertical_center :
- full
Array Chunk Bytes 639.15 MiB 26.63 MiB Shape (24, 142475, 49) (1, 142475, 49) Dask graph 24 chunks in 3 graph layers Data type float32 numpy.ndarray
- timePandasIndex
PandasIndex(DatetimeIndex(['2024-07-28 01:00:00', '2024-07-28 02:00:00', '2024-07-28 03:00:00', '2024-07-28 04:00:00', '2024-07-28 05:00:00', '2024-07-28 06:00:00', '2024-07-28 07:00:00', '2024-07-28 08:00:00', '2024-07-28 09:00:00', '2024-07-28 10:00:00', '2024-07-28 11:00:00', '2024-07-28 12:00:00', '2024-07-28 13:00:00', '2024-07-28 14:00:00', '2024-07-28 15:00:00', '2024-07-28 16:00:00', '2024-07-28 17:00:00', '2024-07-28 18:00:00', '2024-07-28 19:00:00', '2024-07-28 20:00:00', '2024-07-28 21:00:00', '2024-07-28 22:00:00', '2024-07-28 23:00:00', '2024-07-29 00:00:00'], dtype='datetime64[ns]', name='time', freq=None))
- NCO :
- netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)
- history :
- Mon Jul 29 02:42:02 2024: ncatted -a units,temperature,o,c,Degree C -a data_horizontal_center,temperature,o,c,node -a data_vertical_center,temperature,o,c,full -a mesh,temperature,o,c,SCHISM_hgrid ./outputs/temperature_2.nc Mon Jul 29 02:42:02 2024: ncatted -a units,time,o,c,seconds since 2024-07-27 0:00:00 +0 -a base_date,time,o,c,2024 07 27 0 0 ./outputs/temperature_2.nc
ds_temp_subset.isel(time=0).temperature.plot()
<matplotlib.collections.QuadMesh at 0x7a7c2755d540>