Download: https://osdyn.ifremer.fr/pyweb/notebooks/utils/mxarray.ipynb
Dataset from single or multiple NetCDF files
Note : A shorter way to read the file is available for each class of models
[1]:
import os
from osdyn.config import get_config_value
from osdyn.utils.data.mxarray import get_dataset, tzyx2index, auto_merge
from osdyn.utils.data.io import list_files
mars outputs
Concat over time
[2]:
# Get the list of files according to the period
path = get_config_value("osdyn.grcm.mars", "path_v9_6")
pattern_file = get_config_value("osdyn.grcm.mars", "pattern_file_v9_6")
pattern_date = ("2013-01-30","2013-02-01 10:00:00") # plot super long
#pattern_date = ("2013-01-30", "2013-01-30 10:00:00")
infiles = list_files(os.path.join(path, pattern_file), pattern_date)
Found 21 files
[3]:
# Get XE and TEMP and concatene along time
out = get_dataset(infiles, varnames=['XE','TEMP'], gather_unique_dim='time')
[4]:
fig = out.XE[:,100,100].plot()

Super long, voir comment on peut améliorer cela
Concat over time and select a subdomain
[5]:
# Get the selection
tzyx = tzyx2index(infiles[0], 'TEMP', lons=(6.,6.), lats=(43.,43.))
[6]:
tzyx
[6]:
{'nj': (324, 325), 'ni': (413, 414)}
[7]:
# Read the files
out = get_dataset(infiles, varnames=['XE','TEMP'], subdomain=tzyx, decode_times=True)
[8]:
out
[8]:
<xarray.Dataset> Dimensions: (time: 21, nj: 1, ni: 1, level: 60, ni_u: 1, nj_u: 1, ni_v: 1, nj_v: 1, ni_f: 1, nj_f: 1, level_w: 61) Coordinates: (12/19) * time (time) datetime64[ns] 2013-01-30 ... 2013-01-30T20:00:00 * ni (ni) float32 413.0 * nj (nj) float32 324.0 latitude (nj, ni) float64 43.01 longitude (nj, ni) float64 6.007 * level (level) float32 -0.9917 -0.975 -0.9583 ... -0.025 -0.008333 ... ... longitude_v (nj_v, ni_v) float64 6.007 latitude_u (nj_u, ni_u) float64 43.01 latitude_v (nj_v, ni_v) float64 43.01 longitude_f (nj_f, ni_f) float64 6.015 latitude_f (nj_f, ni_f) float64 43.01 * level_w (level_w) float32 -1.0 -0.9833 -0.9667 ... -0.01667 0.0 Data variables: (12/20) XE (time, nj, ni) float32 dask.array<chunksize=(1, 1, 1), meta=np.ndarray> TEMP (time, level, nj, ni) float32 dask.array<chunksize=(1, 60, 1, 1), meta=np.ndarray> dx_f (nj_f, ni_f) float64 1.182e+03 dx_u (nj_u, ni_u) float64 1.182e+03 dx_v (nj_v, ni_v) float64 1.182e+03 dx (nj, ni) float64 1.182e+03 ... ... hc (nj, ni) float32 5.0 b float64 0.2 theta float64 6.0 H0 (nj, ni) float32 716.5 HX (nj_u, ni_u) float32 693.8 HY (nj_v, ni_v) float32 647.2
- time: 21
- nj: 1
- ni: 1
- level: 60
- ni_u: 1
- nj_u: 1
- ni_v: 1
- nj_v: 1
- ni_f: 1
- nj_f: 1
- level_w: 61
- time(time)datetime64[ns]2013-01-30 ... 2013-01-30T20:00:00
- long_name :
- time in seconds (UT)
- standard_name :
- time
- axis :
- T
- time_origin :
- 01-JAN-1900 00:00:00
- conventions :
- relative number of seconds with no decimal part
array(['2013-01-30T00:00:00.000000000', '2013-01-30T01:00:00.000000000', '2013-01-30T02:00:00.000000000', '2013-01-30T03:00:00.000000000', '2013-01-30T04:00:00.000000000', '2013-01-30T05:00:00.000000000', '2013-01-30T06:00:00.000000000', '2013-01-30T07:00:00.000000000', '2013-01-30T08:00:00.000000000', '2013-01-30T09:00:00.000000000', '2013-01-30T10:00:00.000000000', '2013-01-30T11:00:00.000000000', '2013-01-30T12:00:00.000000000', '2013-01-30T13:00:00.000000000', '2013-01-30T14:00:00.000000000', '2013-01-30T15:00:00.000000000', '2013-01-30T16:00:00.000000000', '2013-01-30T17:00:00.000000000', '2013-01-30T18:00:00.000000000', '2013-01-30T19:00:00.000000000', '2013-01-30T20:00:00.000000000'], dtype='datetime64[ns]')
- ni(ni)float32413.0
- long_name :
- x-dimension of the grid
- standard_name :
- x_grid_index
- c_grid_axis_shift :
- 0.0
- axis :
- X
- c_grid_dynamic_range :
- 4:1086
array([413.], dtype=float32)
- nj(nj)float32324.0
- long_name :
- y-dimension of the grid
- standard_name :
- y_grid_index
- axis :
- Y
- c_grid_axis_shift :
- 0.0
- c_grid_dynamic_range :
- 3:456
array([324.], dtype=float32)
- latitude(nj, ni)float6443.01
- long_name :
- latitude
- standard_name :
- latitude
- units :
- degrees_north
- valid_min :
- -90.0
- valid_max :
- 90.0
array([[43.00649]])
- longitude(nj, ni)float646.007
- long_name :
- longitude
- standard_name :
- longitude
- units :
- degrees_east
- valid_min :
- -180.0
- valid_max :
- 180.0
array([[6.0072502]])
- level(level)float32-0.9917 -0.975 ... -0.025 -0.008333
- long_name :
- sigma level
- axis :
- Z
- c_grid_axis_shift :
- 0.0
- positive :
- up
- valid_min :
- -1.0
- valid_max :
- 0.0
- standard_name :
- ocean_s_coordinate
- formula_terms :
- s: level eta: XE depth: H0 a: theta b: b depth_c: hc
- formula_definition :
- z(n,k,j,i) = eta(n,j,i)*(1+s(k)) + depth_c*s(k) + (depth(j,i)-depth_c)*C(k)
array([-0.991667, -0.975 , -0.958333, -0.941667, -0.925 , -0.908333, -0.891667, -0.875 , -0.858333, -0.841667, -0.825 , -0.808333, -0.791667, -0.775 , -0.758333, -0.741667, -0.725 , -0.708333, -0.691667, -0.675 , -0.658333, -0.641667, -0.625 , -0.608333, -0.591667, -0.575 , -0.558333, -0.541667, -0.525 , -0.508333, -0.491667, -0.475 , -0.458333, -0.441667, -0.425 , -0.408333, -0.391667, -0.375 , -0.358333, -0.341667, -0.325 , -0.308333, -0.291667, -0.275 , -0.258333, -0.241667, -0.225 , -0.208333, -0.191667, -0.175 , -0.158333, -0.141667, -0.125 , -0.108333, -0.091667, -0.075 , -0.058333, -0.041667, -0.025 , -0.008333], dtype=float32)
- ni_u(ni_u)float32413.5
- long_name :
- x-dimension of the grid at u location
- standard_name :
- x_grid_index_at_u_location
- c_grid_axis_shift :
- 0.5
- axis :
- X
- c_grid_dynamic_range :
- 4:1085
array([413.5], dtype=float32)
- nj_u(nj_u)float32324.0
- long_name :
- y-dimension of the grid at u location
- standard_name :
- y_grid_index_at_u_location
- axis :
- Y
- c_grid_axis_shift :
- 0.0
- c_grid_dynamic_range :
- 3:456
array([324.], dtype=float32)
- ni_v(ni_v)float32413.0
- long_name :
- x-dimension of the grid at v location
- standard_name :
- x_grid_index_at_v_location
- c_grid_axis_shift :
- 0.0
- axis :
- X
- c_grid_dynamic_range :
- 4:1086
array([413.], dtype=float32)
- nj_v(nj_v)float32324.5
- long_name :
- y-dimension of the grid at v location
- standard_name :
- y_grid_index_at_v_location
- axis :
- Y
- c_grid_axis_shift :
- 0.5
- c_grid_dynamic_range :
- 2:455
array([324.5], dtype=float32)
- ni_f(ni_f)float32413.5
- long_name :
- x-dimension of the grid at f location
- standard_name :
- x_grid_index_at_f_location
- c_grid_axis_shift :
- 0.5
- axis :
- X
- c_grid_dynamic_range :
- 4:1085
array([413.5], dtype=float32)
- nj_f(nj_f)float32324.5
- long_name :
- y-dimension of the grid at f location
- standard_name :
- y_grid_index_at_f_location
- axis :
- Y
- c_grid_axis_shift :
- 0.5
- c_grid_dynamic_range :
- 2:455
array([324.5], dtype=float32)
- longitude_u(nj_u, ni_u)float64...
- long_name :
- longitude at u location
- standard_name :
- longitude_at_u_location
- units :
- degrees_east
- valid_min :
- -0.1
- valid_max :
- 16.099940000000004
array([[6.014523]])
- longitude_v(nj_v, ni_v)float64...
- long_name :
- longitude at v location
- standard_name :
- longitude_at_v_location
- units :
- degrees_east
- valid_min :
- -0.1
- valid_max :
- 16.099940000000004
array([[6.00725]])
- latitude_u(nj_u, ni_u)float64...
- long_name :
- latitude at u location
- standard_name :
- latitude_at_u_location
- units :
- degrees_north
- valid_min :
- 39.4
- valid_max :
- 44.599995
array([[43.00649]])
- latitude_v(nj_v, ni_v)float64...
- long_name :
- latitude at v location
- standard_name :
- latitude_at_v_location
- units :
- degrees_north
- valid_min :
- 39.4
- valid_max :
- 44.599995
array([[43.011901]])
- longitude_f(nj_f, ni_f)float64...
- long_name :
- longitude at f location
- standard_name :
- longitude_at_f_location
- units :
- degrees_east
- valid_min :
- -0.1
- valid_max :
- 16.099940000000004
array([[6.014523]])
- latitude_f(nj_f, ni_f)float64...
- long_name :
- latitude at f location
- standard_name :
- latitude_at_f_location
- units :
- degrees_north
- valid_min :
- 39.4
- valid_max :
- 44.599995
array([[43.011901]])
- level_w(level_w)float32-1.0 -0.9833 ... -0.01667 0.0
- long_name :
- sigma level at the interface
- axis :
- Z
- c_grid_axis_shift :
- -0.5
- positive :
- up
- valid_min :
- -1.1
- valid_max :
- 0.1
- standard_name :
- ocean_s_coordinate_at_w_location
- formula_terms :
- s: level_w eta: XE depth: H0 a: theta b: b depth_c: hc
- formula_definition :
- z(n,k,j,i) = eta(n,j,i)*(1+s_w(k)) + depth_c*s_w(k) + (depth(j,i)-depth_c)*C_w(k)
array([-1. , -0.983333, -0.966667, -0.95 , -0.933333, -0.916667, -0.9 , -0.883333, -0.866667, -0.85 , -0.833333, -0.816667, -0.8 , -0.783333, -0.766667, -0.75 , -0.733333, -0.716667, -0.7 , -0.683333, -0.666667, -0.65 , -0.633333, -0.616667, -0.6 , -0.583333, -0.566667, -0.55 , -0.533333, -0.516667, -0.5 , -0.483333, -0.466667, -0.45 , -0.433333, -0.416667, -0.4 , -0.383333, -0.366667, -0.35 , -0.333333, -0.316667, -0.3 , -0.283333, -0.266667, -0.25 , -0.233333, -0.216667, -0.2 , -0.183333, -0.166667, -0.15 , -0.133333, -0.116667, -0.1 , -0.083333, -0.066667, -0.05 , -0.033333, -0.016667, 0. ], dtype=float32)
- XE(time, nj, ni)float32dask.array<chunksize=(1, 1, 1), meta=np.ndarray>
- long_name :
- sea surface height
- standard_name :
- sea_surface_height_above_geoid
- units :
- m
- valid_min :
- -50.0
- valid_max :
- 50.0
Array Chunk Bytes 84 B 4 B Shape (21, 1, 1) (1, 1, 1) Count 105 Tasks 21 Chunks Type float32 numpy.ndarray - TEMP(time, level, nj, ni)float32dask.array<chunksize=(1, 60, 1, 1), meta=np.ndarray>
- long_name :
- temperature
- standard_name :
- sea_water_potential_temperature
- units :
- degrees_Celsius
- valid_min :
- -5.0
- valid_max :
- 50.0
Array Chunk Bytes 4.92 kiB 240 B Shape (21, 60, 1, 1) (1, 60, 1, 1) Count 105 Tasks 21 Chunks Type float32 numpy.ndarray - dx_f(nj_f, ni_f)float64...
- long_name :
- mesh size along x at f location
- standard_name :
- cell_x_size_at_f_location
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1181.901299]])
- dx_u(nj_u, ni_u)float64...
- long_name :
- mesh size along x at u location
- standard_name :
- cell_x_size_at_u_location
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1182.005428]])
- dx_v(nj_v, ni_v)float64...
- long_name :
- mesh size along x at v location
- standard_name :
- cell_x_size_at_v_location
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1181.901299]])
- dx(nj, ni)float64...
- long_name :
- mesh size along x
- standard_name :
- cell_x_size
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1182.005428]])
- dy_v(nj_v, ni_v)float64...
- long_name :
- mesh size along y at v location
- standard_name :
- cell_y_size_at_v_location
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1202.651541]])
- dy_u(nj_u, ni_u)float64...
- long_name :
- mesh size along y at u location
- standard_name :
- cell_y_size_at_u_location
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1202.651541]])
- dy_f(nj_f, ni_f)float64...
- long_name :
- mesh size along y at f location
- standard_name :
- cell_y_size_at_f_location
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1202.651541]])
- dy(nj, ni)float64...
- long_name :
- mesh size along y
- standard_name :
- cell_y_size
- units :
- m
- valid_min :
- 1.0
- valid_max :
- 20000.0
array([[1202.651541]])
- SIG(level)float32...
- long_name :
- sigma variable
- standard_name :
- ocean_s_variable
- units :
- valid_min :
- -1.0
- valid_max :
- 0.0
array([-0.991667, -0.975 , -0.958333, -0.941667, -0.925 , -0.908333, -0.891667, -0.875 , -0.858333, -0.841667, -0.825 , -0.808333, -0.791667, -0.775 , -0.758333, -0.741667, -0.725 , -0.708333, -0.691667, -0.675 , -0.658333, -0.641667, -0.625 , -0.608333, -0.591667, -0.575 , -0.558333, -0.541667, -0.525 , -0.508333, -0.491667, -0.475 , -0.458333, -0.441667, -0.425 , -0.408333, -0.391667, -0.375 , -0.358333, -0.341667, -0.325 , -0.308333, -0.291667, -0.275 , -0.258333, -0.241667, -0.225 , -0.208333, -0.191667, -0.175 , -0.158333, -0.141667, -0.125 , -0.108333, -0.091667, -0.075 , -0.058333, -0.041667, -0.025 , -0.008333], dtype=float32)
- SIG_W(level_w)float32...
- long_name :
- sigma variable at the interface
- standard_name :
- ocean_s_variable_at_w_location
- units :
- valid_min :
- -1.0
- valid_max :
- 0.0
array([-1. , -0.983333, -0.966667, -0.95 , -0.933333, -0.916667, -0.9 , -0.883333, -0.866667, -0.85 , -0.833333, -0.816667, -0.8 , -0.783333, -0.766667, -0.75 , -0.733333, -0.716667, -0.7 , -0.683333, -0.666667, -0.65 , -0.633333, -0.616667, -0.6 , -0.583333, -0.566667, -0.55 , -0.533333, -0.516667, -0.5 , -0.483333, -0.466667, -0.45 , -0.433333, -0.416667, -0.4 , -0.383333, -0.366667, -0.35 , -0.333333, -0.316667, -0.3 , -0.283333, -0.266667, -0.25 , -0.233333, -0.216667, -0.2 , -0.183333, -0.166667, -0.15 , -0.133333, -0.116667, -0.1 , -0.083333, -0.066667, -0.05 , -0.033333, -0.016667, 0. ], dtype=float32)
- Csu_sig(level)float32...
- long_name :
- C(s) law at mid layer
- standard_name :
- ocean_s_coordinate_function_at_midlayer
- units :
- valid_min :
- -2.0
- valid_max :
- 2.0
- formula_definition :
- C(k) = (1-b)*sinh(a*s(k))/sinh(a) + b*[tanh(a*(s(k)+0.5))-tanh(0.5*a)]/(2*tanh(0.5*a))
array([-9.609309e-01, -8.883916e-01, -8.227171e-01, -7.632456e-01, -7.093769e-01, -6.605655e-01, -6.163151e-01, -5.761738e-01, -5.397288e-01, -5.066023e-01, -4.764471e-01, -4.489430e-01, -4.237935e-01, -4.007219e-01, -3.794691e-01, -3.597907e-01, -3.414550e-01, -3.242417e-01, -3.079410e-01, -2.923546e-01, -2.772963e-01, -2.625961e-01, -2.481038e-01, -2.336954e-01, -2.192791e-01, -2.048023e-01, -1.902565e-01, -1.756793e-01, -1.611533e-01, -1.467988e-01, -1.327629e-01, -1.192047e-01, -1.062792e-01, -9.412283e-02, -8.284225e-02, -7.250796e-02, -6.315280e-02, -5.477475e-02, -4.734251e-02, -4.080261e-02, -3.508667e-02, -3.011799e-02, -2.581692e-02, -2.210496e-02, -1.890759e-02, -1.615597e-02, -1.378786e-02, -1.174785e-02, -9.987249e-03, -8.463630e-03, -7.140307e-03, -5.985690e-03, -4.972658e-03, -4.077957e-03, -3.281638e-03, -2.566561e-03, -1.917939e-03, -1.322958e-03, -7.704314e-04, -2.505093e-04], dtype=float32)
- Csw_sig(level_w)float32...
- long_name :
- C(s) law at interface
- standard_name :
- ocean_s_coordinate_function_at_interface
- units :
- valid_min :
- -2.0
- valid_max :
- 2.0
- formula_definition :
- C_w(k) = (1-b)*sinh(a*s_w(k))/sinh(a) + b*[tanh(a*(s_w(k)+0.5))-tanh(0.5*a)]/(2*tanh(0.5*a))
array([-1.000000e+00, -9.237592e-01, -8.547391e-01, -7.922449e-01, -7.356462e-01, -6.843712e-01, -6.378994e-01, -5.957575e-01, -5.575137e-01, -5.227731e-01, -4.911739e-01, -4.623827e-01, -4.360917e-01, -4.120145e-01, -3.898838e-01, -3.694479e-01, -3.504690e-01, -3.327214e-01, -3.159900e-01, -3.000705e-01, -2.847705e-01, -2.699114e-01, -2.553324e-01, -2.408957e-01, -2.264925e-01, -2.120499e-01, -1.975368e-01, -1.829676e-01, -1.684031e-01, -1.539458e-01, -1.397312e-01, -1.259141e-01, -1.126538e-01, -1.000974e-01, -8.836777e-02, -7.755390e-02, -6.770736e-02, -5.884299e-02, -5.094331e-02, -4.396502e-02, -3.784632e-02, -3.251389e-02, -2.788897e-02, -2.389207e-02, -2.044640e-02, -1.748011e-02, -1.492760e-02, -1.273004e-02, -1.083542e-02, -9.198236e-03, -7.779018e-03, -6.543703e-03, -5.463013e-03, -4.511834e-03, -3.668631e-03, -2.914919e-03, -2.234786e-03, -1.614477e-03, -1.042032e-03, -5.069653e-04, 0.000000e+00], dtype=float32)
- hc(nj, ni)float32...
- long_name :
- depth over which the resolution is increased
- standard_name :
- ocean_s_coordinate_thick_of_surface_resolution
- units :
- m
- valid_min :
- -20.0
- valid_max :
- 500.0
array([[5.]], dtype=float32)
- b()float32...
- long_name :
- bottom control parameter
- standard_name :
- ocean_s_coordinate_bottom_control
- units :
- valid_min :
- 0.0
- valid_max :
- 1.0
array(0.2)
- theta()float32...
- long_name :
- surface control parameter
- standard_name :
- ocean_s_coordinate_surface_control
- units :
- valid_min :
- 0.0
- valid_max :
- 20.0
array(6.)
- H0(nj, ni)float32...
- long_name :
- bathymetry relative to the mean level
- standard_name :
- model_sea_floor_depth_below_geoid
- units :
- m
- valid_min :
- -50.0
- valid_max :
- 10000.0
array([[716.4899]], dtype=float32)
- HX(nj_u, ni_u)float32...
- long_name :
- bathymetry at u-location relative to the mean level
- standard_name :
- model_sea_floor_depth_below_geoid_at_u_location
- units :
- m
- valid_min :
- -50.0
- valid_max :
- 10000.0
array([[693.7566]], dtype=float32)
- HY(nj_v, ni_v)float32...
- long_name :
- bathymetry at v-location relative to the mean level
- standard_name :
- model_sea_floor_depth_below_geoid_at_v_location
- units :
- m
- valid_min :
- -50.0
- valid_max :
- 10000.0
array([[647.2143]], dtype=float32)
NEMO outputs
Concat variables (from different files) over time, and add the grid file
[9]:
# Get the list of files
path = get_config_value("osdyn.grcm.nemo", "path_medrys1v1")
pattern_file = get_config_value("osdyn.grcm.nemo",
"pattern_medrys1v1")
pattern_date = eval(
get_config_value("osdyn.grcm.nemo", "period_medrys1v1")
)
infiles = list_files(os.path.join(path,pattern_file), pattern_date)
Found 45 files
[10]:
# Read and gather the files into a unique one
out = get_dataset(infiles[:], decode_times=False, gather_grid=['grid2D','gridS','gridT','gridU','gridV'])
[11]:
out
[11]:
<xarray.Dataset> Dimensions: (y: 264, x: 567, deptht: 75, time_counter: 9) Coordinates: nav_lon (y, x) float32 dask.array<chunksize=(264, 567), meta=np.ndarray> nav_lat (y, x) float32 dask.array<chunksize=(264, 567), meta=np.ndarray> * deptht (deptht) float32 0.5165 1.622 2.848 ... 4.683e+03 4.817e+03 * time_counter (time_counter) float64 6.392e+08 6.393e+08 ... 6.399e+08 * x (x) int32 1 2 3 4 5 6 7 8 ... 560 561 562 563 564 565 566 567 * y (y) int32 1 2 3 4 5 6 7 8 ... 257 258 259 260 261 262 263 264 Data variables: (12/17) vosaline (time_counter, deptht, y, x) float32 dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray> votemper (time_counter, deptht, y, x) float32 dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray> vodensity (time_counter, deptht, y, x) float32 dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray> vozocrtx (time_counter, deptht, y, x) float32 dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray> sozotaux (time_counter, y, x) float32 dask.array<chunksize=(1, 264, 567), meta=np.ndarray> vomecrty (time_counter, deptht, y, x) float32 dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray> ... ... sohefldo (time_counter, y, x) float32 dask.array<chunksize=(1, 264, 567), meta=np.ndarray> soceshwf (time_counter, y, x) float32 dask.array<chunksize=(1, 264, 567), meta=np.ndarray> sowaflup (time_counter, y, x) float32 dask.array<chunksize=(1, 264, 567), meta=np.ndarray> sosstobs (time_counter, y, x) float32 dask.array<chunksize=(1, 264, 567), meta=np.ndarray> sowaflcd (time_counter, y, x) float32 dask.array<chunksize=(1, 264, 567), meta=np.ndarray> sobarhei (time_counter, y, x) float32 dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- y: 264
- x: 567
- deptht: 75
- time_counter: 9
- nav_lon(y, x)float32dask.array<chunksize=(264, 567), meta=np.ndarray>
- units :
- degrees_east
- valid_min :
- -11.075542779616399
- valid_max :
- 36.855376760619095
- long_name :
- Longitude
- nav_model :
- Default grid
- standard_name :
- longitude
Array Chunk Bytes 584.72 kiB 584.72 kiB Shape (264, 567) (264, 567) Count 2 Tasks 1 Chunks Type float32 numpy.ndarray - nav_lat(y, x)float32dask.array<chunksize=(264, 567), meta=np.ndarray>
- units :
- degrees_north
- valid_min :
- 30.028919738016008
- valid_max :
- 47.29852536094931
- long_name :
- Latitude
- nav_model :
- Default grid
- standard_name :
- latitude
Array Chunk Bytes 584.72 kiB 584.72 kiB Shape (264, 567) (264, 567) Count 2 Tasks 1 Chunks Type float32 numpy.ndarray - deptht(deptht)float320.5165 1.622 ... 4.817e+03
- units :
- m
- positive :
- down
- valid_min :
- 0.5165291428565979
- valid_max :
- 4817.05126953125
- long_name :
- Vertical T levels
- standard_name :
- depth
- axis :
- Z
array([5.165291e-01, 1.622117e+00, 2.847589e+00, 4.209782e+00, 5.727855e+00, 7.423597e+00, 9.321773e+00, 1.145050e+01, 1.384170e+01, 1.653153e+01, 1.956095e+01, 2.297627e+01, 2.682978e+01, 3.118042e+01, 3.609452e+01, 4.164651e+01, 4.791979e+01, 5.500746e+01, 6.301316e+01, 7.205186e+01, 8.225053e+01, 9.374878e+01, 1.066993e+02, 1.212679e+02, 1.376339e+02, 1.559890e+02, 1.765370e+02, 1.994921e+02, 2.250766e+02, 2.535189e+02, 2.850493e+02, 3.198967e+02, 3.582837e+02, 4.004213e+02, 4.465041e+02, 4.967043e+02, 5.511673e+02, 6.100064e+02, 6.732994e+02, 7.410859e+02, 8.133659e+02, 8.900999e+02, 9.712098e+02, 1.056583e+03, 1.146073e+03, 1.239508e+03, 1.336694e+03, 1.437420e+03, 1.541462e+03, 1.648593e+03, 1.758582e+03, 1.871199e+03, 1.986224e+03, 2.103442e+03, 2.222649e+03, 2.343654e+03, 2.466276e+03, 2.590351e+03, 2.715725e+03, 2.842260e+03, 2.969827e+03, 3.098312e+03, 3.227612e+03, 3.357633e+03, 3.488292e+03, 3.619514e+03, 3.751234e+03, 3.883391e+03, 4.015935e+03, 4.148818e+03, 4.282000e+03, 4.415444e+03, 4.549119e+03, 4.682997e+03, 4.817051e+03], dtype=float32)
- time_counter(time_counter)float646.392e+08 6.393e+08 ... 6.399e+08
- calendar :
- gregorian
- standard_name :
- time
- long_name :
- Time axis
- axis :
- T
- units :
- seconds since 1992-09-30 00:00:00
- time_origin :
- 1992-SEP-30 00:00:00
array([6.392304e+08, 6.393168e+08, 6.394032e+08, 6.394896e+08, 6.395760e+08, 6.396624e+08, 6.397488e+08, 6.398352e+08, 6.399216e+08])
- x(x)int321 2 3 4 5 6 ... 563 564 565 566 567
- standard_name :
- projection_x_coordinate
- axis :
- X
- units :
- 1
array([ 1, 2, 3, ..., 565, 566, 567], dtype=int32)
- y(y)int321 2 3 4 5 6 ... 260 261 262 263 264
- standard_name :
- projection_y_coordinate
- axis :
- Y
- units :
- 1
array([ 1, 2, 3, ..., 262, 263, 264], dtype=int32)
- vosaline(time_counter, deptht, y, x)float32dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray>
- units :
- PSU
- valid_min :
- 0.0
- valid_max :
- 50.0
- long_name :
- Salinity
- standard_name :
- sea_water_salinity
- short_name :
- vosaline
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter deptht nav_lat nav_lon
Array Chunk Bytes 385.43 MiB 42.83 MiB Shape (9, 75, 264, 567) (1, 75, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - votemper(time_counter, deptht, y, x)float32dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray>
- units :
- degree_Celsius
- valid_min :
- -20.0
- valid_max :
- 42.0
- long_name :
- Temperature
- standard_name :
- sea_water_potential_temperature
- short_name :
- votemper
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter deptht nav_lat nav_lon
Array Chunk Bytes 385.43 MiB 42.83 MiB Shape (9, 75, 264, 567) (1, 75, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - vodensity(time_counter, deptht, y, x)float32dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray>
- units :
- kg m-3
- valid_min :
- -100.0
- valid_max :
- 100.0
- long_name :
- Density
- standard_name :
- ocean_vertical_density
- short_name :
- vodensity
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter deptht nav_lat nav_lon
Array Chunk Bytes 385.43 MiB 42.83 MiB Shape (9, 75, 264, 567) (1, 75, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - vozocrtx(time_counter, deptht, y, x)float32dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray>
- units :
- m s-1
- valid_min :
- -10.0
- valid_max :
- 10.0
- long_name :
- Zonal velocity
- standard_name :
- sea_water_x_velocity
- short_name :
- vozocrtx
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter deptht nav_lat nav_lon
Array Chunk Bytes 385.43 MiB 42.83 MiB Shape (9, 75, 264, 567) (1, 75, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sozotaux(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- Pa
- valid_min :
- -10.0
- valid_max :
- 10.0
- long_name :
- Zonal wind stress over ocean
- standard_name :
- sea_water_downward_x_stress
- short_name :
- sozotaux
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - vomecrty(time_counter, deptht, y, x)float32dask.array<chunksize=(1, 75, 264, 567), meta=np.ndarray>
- units :
- m s-1
- valid_min :
- -10.0
- valid_max :
- 10.0
- long_name :
- Meridional velocity
- standard_name :
- sea_water_y_velocity
- short_name :
- vomecrty
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter deptht nav_lat nav_lon
Array Chunk Bytes 385.43 MiB 42.83 MiB Shape (9, 75, 264, 567) (1, 75, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sometauy(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- Pa
- valid_min :
- -10.0
- valid_max :
- 10.0
- long_name :
- Meridional wind stress over ocean
- standard_name :
- sea_water_downward_y_stress
- short_name :
- sometauy
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sossheig(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- m
- valid_min :
- -10.0
- valid_max :
- 10.0
- long_name :
- Sea Surface Height
- standard_name :
- sea_surface_height_above_geoid
- short_name :
- sossheig
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - somxlavt(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- m
- valid_min :
- 0.0
- valid_max :
- 10000.0
- long_name :
- Mixed Layer Depth avt
- standard_name :
- ocean_mixed_layer_thickness_defined_by_turbocline
- short_name :
- somxlavt
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - somxlt02(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- m
- valid_min :
- 0.0
- valid_max :
- 10000.0
- long_name :
- Mixed Layer Depth temp 0.2
- standard_name :
- ocean_mixed_layer_thickness_defined_by_temperature
- short_name :
- somxlt02
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - somxl010(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- m
- valid_min :
- 0.0
- valid_max :
- 10000.0
- long_name :
- Mixed Layer Depth 0.01
- standard_name :
- ocean_mixed_layer_thickness_defined_by_sigma_theta
- short_name :
- somxl010
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sohefldo(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- W m-2
- valid_min :
- -2000.0
- valid_max :
- 2000.0
- long_name :
- Net Downward Heat Flux
- standard_name :
- net_downward_heat_flux_where_sea_water
- short_name :
- sohefldo
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - soceshwf(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- W m-2
- valid_min :
- -2000.0
- valid_max :
- 2000.0
- long_name :
- Net solar flux at the ocean surface (under ice if ice)
- standard_name :
- net_downward_shortwave_flux_where_sea_water
- short_name :
- soceshwf
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sowaflup(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- kg m-2 s-1
- valid_min :
- -0.03
- valid_max :
- 0.03
- long_name :
- Net fresh water flux into ocean
- standard_name :
- water_flux_into_ocean
- short_name :
- sowaflup
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sosstobs(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- degree_Celsius
- valid_min :
- -20.0
- valid_max :
- 42.0
- long_name :
- Observed sea surface temperature
- standard_name :
- observed_sea_surface_temperature
- short_name :
- sosstobs
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sowaflcd(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- kg m-2 s-1
- valid_min :
- -0.03
- valid_max :
- 0.03
- long_name :
- Concentration/dilution water flux
- standard_name :
- Concentration/dilution_water_flux
- short_name :
- sowaflcd
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray - sobarhei(time_counter, y, x)float32dask.array<chunksize=(1, 264, 567), meta=np.ndarray>
- units :
- m
- valid_min :
- -5.0
- valid_max :
- 5.0
- long_name :
- Barotropic height
- standard_name :
- barotropic_height
- short_name :
- sobarhei
- online_operation :
- N/A
- interval_operation :
- 86400
- interval_write :
- 86400
- associate :
- time_counter nav_lat nav_lon
Array Chunk Bytes 5.14 MiB 584.72 kiB Shape (9, 264, 567) (1, 264, 567) Count 27 Tasks 9 Chunks Type float32 numpy.ndarray
AROME (previmer format)
[12]:
path = get_config_value("osdyn.grcm.arome", "path_previ")
pattern_file = get_config_value("osdyn.grcm.arome",
"pattern_previ")
pattern_date = eval(
get_config_value("osdyn.grcm.arome", "period_previ")
)
infiles = list_files(os.path.join(path, pattern_file), pattern_date)
Found 48 files
[13]:
# Select a subdomain
tzyx = tzyx2index(infiles[0], 'eau', lons=(2.5,3.5), lats=(42.,43.))
[14]:
# Read and gather the files into a unique one
out = get_dataset(infiles, varnames=['eau'], subdomain=tzyx, decode_times=True)
[15]:
out
[15]:
<xarray.Dataset> Dimensions: (time: 48, height: 1, latitude: 43, longitude: 43) Coordinates: * time (time) datetime64[ns] 2013-12-30 ... 2013-12-31T23:00:00 * latitude (latitude) float32 41.97 42.0 42.03 42.05 ... 42.97 43.0 43.03 * longitude (longitude) float32 2.475 2.5 2.525 2.55 ... 3.45 3.475 3.5 3.525 * height (height) float32 0.0 Data variables: eau (time, height, latitude, longitude) float32 dask.array<chunksize=(1, 1, 43, 43), meta=np.ndarray>
- time: 48
- height: 1
- latitude: 43
- longitude: 43
- time(time)datetime64[ns]2013-12-30 ... 2013-12-31T23:00:00
- long_name :
- julian day (UT)
- standard_name :
- time
- conventions :
- relative julian days with decimal part (as parts of the day)
- axis :
- T
array(['2013-12-30T00:00:00.000000000', '2013-12-30T01:00:00.000000000', '2013-12-30T02:00:00.000000000', '2013-12-30T03:00:00.000000000', '2013-12-30T04:00:00.000000000', '2013-12-30T05:00:00.000000000', '2013-12-30T06:00:00.000000000', '2013-12-30T07:00:00.000000000', '2013-12-30T08:00:00.000000000', '2013-12-30T09:00:00.000000000', '2013-12-30T10:00:00.000000000', '2013-12-30T11:00:00.000000000', '2013-12-30T12:00:00.000000000', '2013-12-30T13:00:00.000000000', '2013-12-30T14:00:00.000000000', '2013-12-30T15:00:00.000000000', '2013-12-30T16:00:00.000000000', '2013-12-30T17:00:00.000000000', '2013-12-30T18:00:00.000000000', '2013-12-30T19:00:00.000000000', '2013-12-30T20:00:00.000000000', '2013-12-30T21:00:00.000000000', '2013-12-30T22:00:00.000000000', '2013-12-30T23:00:00.000000000', '2013-12-31T00:00:00.000000000', '2013-12-31T01:00:00.000000000', '2013-12-31T02:00:00.000000000', '2013-12-31T03:00:00.000000000', '2013-12-31T04:00:00.000000000', '2013-12-31T05:00:00.000000000', '2013-12-31T06:00:00.000000000', '2013-12-31T07:00:00.000000000', '2013-12-31T08:00:00.000000000', '2013-12-31T09:00:00.000000000', '2013-12-31T10:00:00.000000000', '2013-12-31T11:00:00.000000000', '2013-12-31T12:00:00.000000000', '2013-12-31T13:00:00.000000000', '2013-12-31T14:00:00.000000000', '2013-12-31T15:00:00.000000000', '2013-12-31T16:00:00.000000000', '2013-12-31T17:00:00.000000000', '2013-12-31T18:00:00.000000000', '2013-12-31T19:00:00.000000000', '2013-12-31T20:00:00.000000000', '2013-12-31T21:00:00.000000000', '2013-12-31T22:00:00.000000000', '2013-12-31T23:00:00.000000000'], dtype='datetime64[ns]')
- latitude(latitude)float3241.97 42.0 42.03 ... 43.0 43.03
- long_name :
- latitude
- standard_name :
- latitude
- units :
- degree_north
- valid_min :
- -90.0
- valid_max :
- 90.0
- axis :
- Y
array([41.975, 42. , 42.025, 42.05 , 42.075, 42.1 , 42.125, 42.15 , 42.175, 42.2 , 42.225, 42.25 , 42.275, 42.3 , 42.325, 42.35 , 42.375, 42.4 , 42.425, 42.45 , 42.475, 42.5 , 42.525, 42.55 , 42.575, 42.6 , 42.625, 42.65 , 42.675, 42.7 , 42.725, 42.75 , 42.775, 42.8 , 42.825, 42.85 , 42.875, 42.9 , 42.925, 42.95 , 42.975, 43. , 43.025], dtype=float32)
- longitude(longitude)float322.475 2.5 2.525 ... 3.475 3.5 3.525
- long_name :
- longitude
- standard_name :
- longitude
- units :
- degree_east
- valid_min :
- -180.0
- valid_max :
- 180.0
- axis :
- X
array([2.475, 2.5 , 2.525, 2.55 , 2.575, 2.6 , 2.625, 2.65 , 2.675, 2.7 , 2.725, 2.75 , 2.775, 2.8 , 2.825, 2.85 , 2.875, 2.9 , 2.925, 2.95 , 2.975, 3. , 3.025, 3.05 , 3.075, 3.1 , 3.125, 3.15 , 3.175, 3.2 , 3.225, 3.25 , 3.275, 3.3 , 3.325, 3.35 , 3.375, 3.4 , 3.425, 3.45 , 3.475, 3.5 , 3.525], dtype=float32)
- height(height)float320.0
- long_name :
- height
- standard_name :
- height
- units :
- m
- axis :
- Z
- positive :
- up
array([0.], dtype=float32)
- eau(time, height, latitude, longitude)float32dask.array<chunksize=(1, 1, 43, 43), meta=np.ndarray>
- long_name :
- Quantite totale de precipitations
- standard_name :
- precipitation_amount
- units :
- kg m-2
- valid_min :
- -21600.0
- valid_max :
- 21600.0
Array Chunk Bytes 346.69 kiB 7.22 kiB Shape (48, 1, 43, 43) (1, 1, 43, 43) Count 240 Tasks 48 Chunks Type float32 numpy.ndarray
MesoNH
More complicated as the time is not an axis
[16]:
# Get the list of files
path = get_config_value("osdyn.grcm.mesonh", "path_v5_3")
pattern_file = get_config_value("osdyn.grcm.mesonh",
"pattern_obc_v5_3")
pattern_date = eval(get_config_value("osdyn.grcm.mesonh",
"period_v5_3")) # plus court
pattern_date = ("2011-09-02 15:00:00","2011-09-04 00:00:00")
infiles = list_files(os.path.join(path, pattern_file), pattern_date)
Found 34 files
[17]:
# Create the process to apply to each profile
from osdyn.grcm.mesonh import get_datetime
def userprocess(dsu):
"""
`xarray.open_mfdataset calls this function through `preprocess=userprocess`
to apply the directives on each dataset prior to the concatenation.
Parameters
----------
dsu : xarray.Dataset
One of the files.
Returns
-------
xarray.Dataset
The modified dataset in which the time axis has been added and a few
variables have been collected.
"""
timerecord = get_datetime(dsu.DTCUR__TDATE, dsu.DTCUR__TIME)
mnhgvars = ['time']
mnhvars = ['UT']
return dsu.assign(time=timerecord)[mnhvars + mnhgvars]
[18]:
# Gather MesoNH variables along time
mnh = get_dataset(infiles, userprocess=userprocess, decode_times=False)
[19]:
mnh
[19]:
<xarray.Dataset> Dimensions: (time: 34, Z: 102, Y: 130, X: 130) Coordinates: * time (time) datetime64[ns] 2011-09-02T15:00:00 ... 2011-09-04 Dimensions without coordinates: Z, Y, X Data variables: UT (time, Z, Y, X) float64 dask.array<chunksize=(1, 102, 130, 130), meta=np.ndarray>
- time: 34
- Z: 102
- Y: 130
- X: 130
- time(time)datetime64[ns]2011-09-02T15:00:00 ... 2011-09-04
array(['2011-09-02T15:00:00.000000000', '2011-09-02T16:00:00.000000000', '2011-09-02T17:00:00.000000000', '2011-09-02T18:00:00.000000000', '2011-09-02T19:00:00.000000000', '2011-09-02T20:00:00.000000000', '2011-09-02T21:00:00.000000000', '2011-09-02T22:00:00.000000000', '2011-09-02T23:00:00.000000000', '2011-09-03T00:00:00.000000000', '2011-09-03T01:00:00.000000000', '2011-09-03T02:00:00.000000000', '2011-09-03T03:00:00.000000000', '2011-09-03T04:00:00.000000000', '2011-09-03T05:00:00.000000000', '2011-09-03T06:00:00.000000000', '2011-09-03T07:00:00.000000000', '2011-09-03T08:00:00.000000000', '2011-09-03T09:00:00.000000000', '2011-09-03T10:00:00.000000000', '2011-09-03T11:00:00.000000000', '2011-09-03T12:00:00.000000000', '2011-09-03T13:00:00.000000000', '2011-09-03T14:00:00.000000000', '2011-09-03T15:00:00.000000000', '2011-09-03T16:00:00.000000000', '2011-09-03T17:00:00.000000000', '2011-09-03T18:00:00.000000000', '2011-09-03T19:00:00.000000000', '2011-09-03T20:00:00.000000000', '2011-09-03T21:00:00.000000000', '2011-09-03T22:00:00.000000000', '2011-09-03T23:00:00.000000000', '2011-09-04T00:00:00.000000000'], dtype='datetime64[ns]')
- UT(time, Z, Y, X)float64dask.array<chunksize=(1, 102, 130, 130), meta=np.ndarray>
- GRID :
- 2
- COMMENT :
- X_Y_Z_U component of wind (m/s)
Array Chunk Bytes 447.15 MiB 13.15 MiB Shape (34, 102, 130, 130) (1, 102, 130, 130) Count 136 Tasks 34 Chunks Type float64 numpy.ndarray
[20]:
# grid of MesoNH file
import xarray as xr
gridvars = ['LON0','LAT0', 'BETA', 'JPHEXT', 'XHAT', 'YHAT', 'ZHAT',
'LAT', 'LON', 'ZS','ZSMT']
mnh_grid = xr.open_dataset(infiles[0])[gridvars]
[21]:
# Add the grid into MesoNH file
mnh = mnh.merge(mnh_grid)
[22]:
mnh
[22]:
<xarray.Dataset> Dimensions: (time: 34, Z: 102, Y: 130, X: 130) Coordinates: * time (time) datetime64[ns] 2011-09-02T15:00:00 ... 2011-09-04 Dimensions without coordinates: Z, Y, X Data variables: UT (time, Z, Y, X) float64 dask.array<chunksize=(1, 102, 130, 130), meta=np.ndarray> LON0 float64 -5.15 LAT0 float64 48.38 BETA float64 0.0 JPHEXT int32 1 XHAT (X) float64 1.7e+05 1.712e+05 1.725e+05 ... 3.3e+05 3.312e+05 YHAT (Y) float64 1.7e+05 1.712e+05 1.725e+05 ... 3.3e+05 3.312e+05 ZHAT (Z) float64 -10.0 0.0 10.0 20.5 ... 2.235e+04 2.315e+04 2.395e+04 LAT (Y, X) float64 47.64 47.64 47.64 47.64 ... 49.09 49.09 49.09 49.09 LON (Y, X) float64 -6.242 -6.225 -6.208 -6.191 ... -4.092 -4.075 -4.058 ZS (Y, X) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 ZSMT (Y, X) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0
- time: 34
- Z: 102
- Y: 130
- X: 130
- time(time)datetime64[ns]2011-09-02T15:00:00 ... 2011-09-04
array(['2011-09-02T15:00:00.000000000', '2011-09-02T16:00:00.000000000', '2011-09-02T17:00:00.000000000', '2011-09-02T18:00:00.000000000', '2011-09-02T19:00:00.000000000', '2011-09-02T20:00:00.000000000', '2011-09-02T21:00:00.000000000', '2011-09-02T22:00:00.000000000', '2011-09-02T23:00:00.000000000', '2011-09-03T00:00:00.000000000', '2011-09-03T01:00:00.000000000', '2011-09-03T02:00:00.000000000', '2011-09-03T03:00:00.000000000', '2011-09-03T04:00:00.000000000', '2011-09-03T05:00:00.000000000', '2011-09-03T06:00:00.000000000', '2011-09-03T07:00:00.000000000', '2011-09-03T08:00:00.000000000', '2011-09-03T09:00:00.000000000', '2011-09-03T10:00:00.000000000', '2011-09-03T11:00:00.000000000', '2011-09-03T12:00:00.000000000', '2011-09-03T13:00:00.000000000', '2011-09-03T14:00:00.000000000', '2011-09-03T15:00:00.000000000', '2011-09-03T16:00:00.000000000', '2011-09-03T17:00:00.000000000', '2011-09-03T18:00:00.000000000', '2011-09-03T19:00:00.000000000', '2011-09-03T20:00:00.000000000', '2011-09-03T21:00:00.000000000', '2011-09-03T22:00:00.000000000', '2011-09-03T23:00:00.000000000', '2011-09-04T00:00:00.000000000'], dtype='datetime64[ns]')
- UT(time, Z, Y, X)float64dask.array<chunksize=(1, 102, 130, 130), meta=np.ndarray>
- GRID :
- 2
- COMMENT :
- X_Y_Z_U component of wind (m/s)
Array Chunk Bytes 447.15 MiB 13.15 MiB Shape (34, 102, 130, 130) (1, 102, 130, 130) Count 136 Tasks 34 Chunks Type float64 numpy.ndarray - LON0()float64...
- GRID :
- 0
- COMMENT :
- reference longitude for conformal projection (DEGREES)
array(-5.15)
- LAT0()float64...
- GRID :
- 0
- COMMENT :
- reference latitude for conformal projection (DEGREES)
array(48.375)
- BETA()float64...
- GRID :
- 0
- COMMENT :
- rotation angle (DEGREES)
array(0.)
- JPHEXT()int32...
- GRID :
- 0
- COMMENT :
array(1, dtype=int32)
- XHAT(X)float64...
- GRID :
- 2
- COMMENT :
- Position x in the conformal or cartesian plane (METERS)
array([170000., 171250., 172500., 173750., 175000., 176250., 177500., 178750., 180000., 181250., 182500., 183750., 185000., 186250., 187500., 188750., 190000., 191250., 192500., 193750., 195000., 196250., 197500., 198750., 200000., 201250., 202500., 203750., 205000., 206250., 207500., 208750., 210000., 211250., 212500., 213750., 215000., 216250., 217500., 218750., 220000., 221250., 222500., 223750., 225000., 226250., 227500., 228750., 230000., 231250., 232500., 233750., 235000., 236250., 237500., 238750., 240000., 241250., 242500., 243750., 245000., 246250., 247500., 248750., 250000., 251250., 252500., 253750., 255000., 256250., 257500., 258750., 260000., 261250., 262500., 263750., 265000., 266250., 267500., 268750., 270000., 271250., 272500., 273750., 275000., 276250., 277500., 278750., 280000., 281250., 282500., 283750., 285000., 286250., 287500., 288750., 290000., 291250., 292500., 293750., 295000., 296250., 297500., 298750., 300000., 301250., 302500., 303750., 305000., 306250., 307500., 308750., 310000., 311250., 312500., 313750., 315000., 316250., 317500., 318750., 320000., 321250., 322500., 323750., 325000., 326250., 327500., 328750., 330000., 331250.])
- YHAT(Y)float64...
- GRID :
- 3
- COMMENT :
- Position y in the conformal or cartesian plane (METERS)
array([170000., 171250., 172500., 173750., 175000., 176250., 177500., 178750., 180000., 181250., 182500., 183750., 185000., 186250., 187500., 188750., 190000., 191250., 192500., 193750., 195000., 196250., 197500., 198750., 200000., 201250., 202500., 203750., 205000., 206250., 207500., 208750., 210000., 211250., 212500., 213750., 215000., 216250., 217500., 218750., 220000., 221250., 222500., 223750., 225000., 226250., 227500., 228750., 230000., 231250., 232500., 233750., 235000., 236250., 237500., 238750., 240000., 241250., 242500., 243750., 245000., 246250., 247500., 248750., 250000., 251250., 252500., 253750., 255000., 256250., 257500., 258750., 260000., 261250., 262500., 263750., 265000., 266250., 267500., 268750., 270000., 271250., 272500., 273750., 275000., 276250., 277500., 278750., 280000., 281250., 282500., 283750., 285000., 286250., 287500., 288750., 290000., 291250., 292500., 293750., 295000., 296250., 297500., 298750., 300000., 301250., 302500., 303750., 305000., 306250., 307500., 308750., 310000., 311250., 312500., 313750., 315000., 316250., 317500., 318750., 320000., 321250., 322500., 323750., 325000., 326250., 327500., 328750., 330000., 331250.])
- ZHAT(Z)float64...
- GRID :
- 4
- COMMENT :
- height level without orography (METERS)
array([-1.000000e+01, 0.000000e+00, 1.000000e+01, 2.050000e+01, 3.152500e+01, 4.310125e+01, 5.525631e+01, 6.801913e+01, 8.142008e+01, 9.549109e+01, 1.102656e+02, 1.257789e+02, 1.420679e+02, 1.591713e+02, 1.771298e+02, 1.959863e+02, 2.157856e+02, 2.365749e+02, 2.584037e+02, 2.813238e+02, 3.053900e+02, 3.306595e+02, 3.571925e+02, 3.850521e+02, 4.143048e+02, 4.450200e+02, 4.772710e+02, 5.111345e+02, 5.466913e+02, 5.840258e+02, 6.232271e+02, 6.643885e+02, 7.076079e+02, 7.529883e+02, 8.006377e+02, 8.506696e+02, 9.032031e+02, 9.583632e+02, 1.016281e+03, 1.077095e+03, 1.140950e+03, 1.207998e+03, 1.278398e+03, 1.352318e+03, 1.429933e+03, 1.511430e+03, 1.597002e+03, 1.686852e+03, 1.781194e+03, 1.880254e+03, 1.984267e+03, 2.093480e+03, 2.208154e+03, 2.328562e+03, 2.454990e+03, 2.587739e+03, 2.727126e+03, 2.873482e+03, 3.027157e+03, 3.188514e+03, 3.357940e+03, 3.535837e+03, 3.722629e+03, 3.918760e+03, 4.124699e+03, 4.340933e+03, 4.567980e+03, 4.806379e+03, 5.056698e+03, 5.319533e+03, 5.595510e+03, 5.885285e+03, 6.189549e+03, 6.509027e+03, 6.844478e+03, 7.196702e+03, 7.566537e+03, 7.954864e+03, 8.362607e+03, 8.790738e+03, 9.240274e+03, 9.712288e+03, 1.020790e+04, 1.072830e+04, 1.127471e+04, 1.184845e+04, 1.245087e+04, 1.308341e+04, 1.374758e+04, 1.444496e+04, 1.517721e+04, 1.594607e+04, 1.674607e+04, 1.754607e+04, 1.834607e+04, 1.914607e+04, 1.994607e+04, 2.074607e+04, 2.154607e+04, 2.234607e+04, 2.314607e+04, 2.394607e+04])
- LAT(Y, X)float64...
- GRID :
- 1
- COMMENT :
- X_Y_latitude (degree)
array([[47.644781, 47.644781, 47.644781, ..., 47.644781, 47.644781, 47.644781], [47.656181, 47.656181, 47.656181, ..., 47.656181, 47.656181, 47.656181], [47.667578, 47.667578, 47.667578, ..., 47.667578, 47.667578, 47.667578], ..., [49.072727, 49.072727, 49.072727, ..., 49.072727, 49.072727, 49.072727], [49.083812, 49.083812, 49.083812, ..., 49.083812, 49.083812, 49.083812], [49.094895, 49.094895, 49.094895, ..., 49.094895, 49.094895, 49.094895]])
- LON(Y, X)float64...
- GRID :
- 1
- COMMENT :
- X_Y_longitude (degree)
array([[-6.241531, -6.224608, -6.207685, ..., -4.092315, -4.075392, -4.058469], [-6.241531, -6.224608, -6.207685, ..., -4.092315, -4.075392, -4.058469], [-6.241531, -6.224608, -6.207685, ..., -4.092315, -4.075392, -4.058469], ..., [-6.241531, -6.224608, -6.207685, ..., -4.092315, -4.075392, -4.058469], [-6.241531, -6.224608, -6.207685, ..., -4.092315, -4.075392, -4.058469], [-6.241531, -6.224608, -6.207685, ..., -4.092315, -4.075392, -4.058469]])
- ZS(Y, X)float64...
- GRID :
- 4
- COMMENT :
- orography (METERS)
array([[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], ..., [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]])
- ZSMT(Y, X)float64...
- GRID :
- 4
- COMMENT :
- smooth orography (METERS)
array([[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], ..., [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]])
Basic files
From database organisation point of view
Automatically merge a split xarray Dataset. This is designed to behave like xarray.open_mfdataset
, except it supports concatenation along multiple dimensions.
[23]:
# Arpege (Previmer format)
path = get_config_value("osdyn.grcm.arpegehr", "path_previ")
pattern_file = get_config_value("osdyn.grcm.arpegehr",
"pattern_previ")
pattern_date = eval(
get_config_value("osdyn.grcm.arpegehr", "period_previ")
)
infiles = list_files(os.path.join(path, pattern_file), pattern_date)
Found 24 files
[24]:
auto_merge(infiles)
[24]:
<xarray.Dataset> Dimensions: (time: 24, latitude: 366, longitude: 691, height: 1) Coordinates: * time (time) datetime64[ns] 2019-08-12 ... 2019-08-12T23:00:00 * latitude (latitude) float32 30.0 30.1 30.2 30.3 ... 66.2 66.3 66.4 66.5 * longitude (longitude) float32 -32.0 -31.9 -31.8 -31.7 ... 36.8 36.9 37.0 * height (height) float32 0.0 Data variables: hu2m (time, height, latitude, longitude) float32 dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray> nebul (time, height, latitude, longitude) float32 dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray> pmer (time, height, latitude, longitude) float32 dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray> t2m (time, height, latitude, longitude) float32 dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray> u10m (time, height, latitude, longitude) float32 dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray> v10m (time, height, latitude, longitude) float32 dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray>
- time: 24
- latitude: 366
- longitude: 691
- height: 1
- time(time)datetime64[ns]2019-08-12 ... 2019-08-12T23:00:00
array(['2019-08-12T00:00:00.000000000', '2019-08-12T01:00:00.000000000', '2019-08-12T02:00:00.000000000', '2019-08-12T03:00:00.000000000', '2019-08-12T04:00:00.000000000', '2019-08-12T05:00:00.000000000', '2019-08-12T06:00:00.000000000', '2019-08-12T07:00:00.000000000', '2019-08-12T08:00:00.000000000', '2019-08-12T09:00:00.000000000', '2019-08-12T10:00:00.000000000', '2019-08-12T11:00:00.000000000', '2019-08-12T12:00:00.000000000', '2019-08-12T13:00:00.000000000', '2019-08-12T14:00:00.000000000', '2019-08-12T15:00:00.000000000', '2019-08-12T16:00:00.000000000', '2019-08-12T17:00:00.000000000', '2019-08-12T18:00:00.000000000', '2019-08-12T19:00:00.000000000', '2019-08-12T20:00:00.000000000', '2019-08-12T21:00:00.000000000', '2019-08-12T22:00:00.000000000', '2019-08-12T23:00:00.000000000'], dtype='datetime64[ns]')
- latitude(latitude)float3230.0 30.1 30.2 ... 66.3 66.4 66.5
- long_name :
- latitude
- standard_name :
- latitude
- units :
- degree_north
- valid_min :
- -90.0
- valid_max :
- 90.0
- axis :
- Y
array([30. , 30.1, 30.2, ..., 66.3, 66.4, 66.5], dtype=float32)
- longitude(longitude)float32-32.0 -31.9 -31.8 ... 36.9 37.0
- long_name :
- longitude
- standard_name :
- longitude
- units :
- degree_east
- valid_min :
- -180.0
- valid_max :
- 180.0
- axis :
- X
array([-32. , -31.9, -31.8, ..., 36.8, 36.9, 37. ], dtype=float32)
- height(height)float320.0
- long_name :
- height
- standard_name :
- height
- units :
- m
- axis :
- Z
- positive :
- up
array([0.], dtype=float32)
- hu2m(time, height, latitude, longitude)float32dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray>
Array Chunk Bytes 23.15 MiB 0.96 MiB Shape (24, 1, 366, 691) (1, 1, 366, 691) Count 72 Tasks 24 Chunks Type float32 numpy.ndarray - nebul(time, height, latitude, longitude)float32dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray>
Array Chunk Bytes 23.15 MiB 0.96 MiB Shape (24, 1, 366, 691) (1, 1, 366, 691) Count 72 Tasks 24 Chunks Type float32 numpy.ndarray - pmer(time, height, latitude, longitude)float32dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray>
Array Chunk Bytes 23.15 MiB 0.96 MiB Shape (24, 1, 366, 691) (1, 1, 366, 691) Count 72 Tasks 24 Chunks Type float32 numpy.ndarray - t2m(time, height, latitude, longitude)float32dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray>
Array Chunk Bytes 23.15 MiB 0.96 MiB Shape (24, 1, 366, 691) (1, 1, 366, 691) Count 72 Tasks 24 Chunks Type float32 numpy.ndarray - u10m(time, height, latitude, longitude)float32dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray>
Array Chunk Bytes 23.15 MiB 0.96 MiB Shape (24, 1, 366, 691) (1, 1, 366, 691) Count 72 Tasks 24 Chunks Type float32 numpy.ndarray - v10m(time, height, latitude, longitude)float32dask.array<chunksize=(1, 1, 366, 691), meta=np.ndarray>
Array Chunk Bytes 23.15 MiB 0.96 MiB Shape (24, 1, 366, 691) (1, 1, 366, 691) Count 72 Tasks 24 Chunks Type float32 numpy.ndarray
Note
simplest way Very usefull when files splitted by periods and when all the variables are dependent on time and available in each file
Warning
DataArrays are extended over concatenation dimension. See dx variables for instance below
[25]:
# Get the list of files according to the period
path = get_config_value("osdyn.grcm.mars", "path_v9_6")
pattern_file = get_config_value("osdyn.grcm.mars", "pattern_file_v9_6")
pattern_date = ("2013-01-30","2013-01-30 03:00:00") # plot super long
#pattern_date = ("2013-01-30", "2013-01-30 10:00:00")
infiles = list_files(os.path.join(path, pattern_file), pattern_date)
Found 4 files
[26]:
infiles
[26]:
['/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/MARS/V96/champs_HOURLY_DIF-V10.03_20130130T000000Z.nc',
'/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/MARS/V96/champs_HOURLY_DIF-V10.03_20130130T010000Z.nc',
'/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/MARS/V96/champs_HOURLY_DIF-V10.03_20130130T020000Z.nc',
'/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/MARS/V96/champs_HOURLY_DIF-V10.03_20130130T030000Z.nc']
[27]:
auto = auto_merge(infiles, decode_times=False)
auto.attrs = {}
[28]:
auto
[28]:
<xarray.Dataset> Dimensions: (ni: 1101, nj: 463, ni_u: 1101, nj_u: 463, ni_v: 1101, nj_v: 463, ni_f: 1101, nj_f: 463, time: 4, level: 60, level_w: 61) Coordinates: (12/19) * ni (ni) float32 0.0 1.0 2.0 3.0 ... 1.098e+03 1.099e+03 1.1e+03 * nj (nj) float32 0.0 1.0 2.0 3.0 4.0 ... 459.0 460.0 461.0 462.0 * ni_u (ni_u) float32 0.5 1.5 2.5 3.5 ... 1.098e+03 1.1e+03 1.1e+03 * nj_u (nj_u) float32 0.0 1.0 2.0 3.0 4.0 ... 459.0 460.0 461.0 462.0 * ni_v (ni_v) float32 0.0 1.0 2.0 3.0 ... 1.098e+03 1.099e+03 1.1e+03 * nj_v (nj_v) float32 0.5 1.5 2.5 3.5 4.5 ... 459.5 460.5 461.5 462.5 ... ... longitude_v (nj_v, ni_v) float64 dask.array<chunksize=(463, 1101), meta=np.ndarray> latitude_u (nj_u, ni_u) float64 dask.array<chunksize=(463, 1101), meta=np.ndarray> latitude_v (nj_v, ni_v) float64 dask.array<chunksize=(463, 1101), meta=np.ndarray> longitude_f (nj_f, ni_f) float64 dask.array<chunksize=(463, 1101), meta=np.ndarray> latitude_f (nj_f, ni_f) float64 dask.array<chunksize=(463, 1101), meta=np.ndarray> * level_w (level_w) float32 -1.0 -0.9833 -0.9667 ... -0.01667 0.0 Data variables: (12/35) dx_f (time, nj_f, ni_f) float64 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray> dx_u (time, nj_u, ni_u) float64 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray> dx_v (time, nj_v, ni_v) float64 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray> dx (time, nj, ni) float64 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray> dy_v (time, nj_v, ni_v) float64 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray> dy_u (time, nj_u, ni_u) float64 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray> ... ... N2 (time, level_w, nj, ni) float32 dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray> ECT (time, level_w, nj, ni) float32 dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray> EPS (time, level_w, nj, ni) float32 dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray> BZ (time, level, nj, ni) float32 dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray> TAUX (time, nj_u, ni_u) float32 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray> TAUY (time, nj_v, ni_v) float32 dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
- ni: 1101
- nj: 463
- ni_u: 1101
- nj_u: 463
- ni_v: 1101
- nj_v: 463
- ni_f: 1101
- nj_f: 463
- time: 4
- level: 60
- level_w: 61
- ni(ni)float320.0 1.0 2.0 ... 1.099e+03 1.1e+03
- long_name :
- x-dimension of the grid
- standard_name :
- x_grid_index
- c_grid_axis_shift :
- 0.0
- axis :
- X
- c_grid_dynamic_range :
- 4:1086
array([0.000e+00, 1.000e+00, 2.000e+00, ..., 1.098e+03, 1.099e+03, 1.100e+03], dtype=float32)
- nj(nj)float320.0 1.0 2.0 ... 460.0 461.0 462.0
- long_name :
- y-dimension of the grid
- standard_name :
- y_grid_index
- axis :
- Y
- c_grid_axis_shift :
- 0.0
- c_grid_dynamic_range :
- 3:456
array([ 0., 1., 2., ..., 460., 461., 462.], dtype=float32)
- ni_u(ni_u)float320.5 1.5 2.5 ... 1.1e+03 1.1e+03
- long_name :
- x-dimension of the grid at u location
- standard_name :
- x_grid_index_at_u_location
- c_grid_axis_shift :
- 0.5
- axis :
- X
- c_grid_dynamic_range :
- 4:1085
array([5.0000e-01, 1.5000e+00, 2.5000e+00, ..., 1.0985e+03, 1.0995e+03, 1.1005e+03], dtype=float32)
- nj_u(nj_u)float320.0 1.0 2.0 ... 460.0 461.0 462.0
- long_name :
- y-dimension of the grid at u location
- standard_name :
- y_grid_index_at_u_location
- axis :
- Y
- c_grid_axis_shift :
- 0.0
- c_grid_dynamic_range :
- 3:456
array([ 0., 1., 2., ..., 460., 461., 462.], dtype=float32)
- ni_v(ni_v)float320.0 1.0 2.0 ... 1.099e+03 1.1e+03
- long_name :
- x-dimension of the grid at v location
- standard_name :
- x_grid_index_at_v_location
- c_grid_axis_shift :
- 0.0
- axis :
- X
- c_grid_dynamic_range :
- 4:1086
array([0.000e+00, 1.000e+00, 2.000e+00, ..., 1.098e+03, 1.099e+03, 1.100e+03], dtype=float32)
- nj_v(nj_v)float320.5 1.5 2.5 ... 460.5 461.5 462.5
- long_name :
- y-dimension of the grid at v location
- standard_name :
- y_grid_index_at_v_location
- axis :
- Y
- c_grid_axis_shift :
- 0.5
- c_grid_dynamic_range :
- 2:455
array([ 0.5, 1.5, 2.5, ..., 460.5, 461.5, 462.5], dtype=float32)
- ni_f(ni_f)float320.5 1.5 2.5 ... 1.1e+03 1.1e+03
- long_name :
- x-dimension of the grid at f location
- standard_name :
- x_grid_index_at_f_location
- c_grid_axis_shift :
- 0.5
- axis :
- X
- c_grid_dynamic_range :
- 4:1085
array([5.0000e-01, 1.5000e+00, 2.5000e+00, ..., 1.0985e+03, 1.0995e+03, 1.1005e+03], dtype=float32)
- nj_f(nj_f)float320.5 1.5 2.5 ... 460.5 461.5 462.5
- long_name :
- y-dimension of the grid at f location
- standard_name :
- y_grid_index_at_f_location
- axis :
- Y
- c_grid_axis_shift :
- 0.5
- c_grid_dynamic_range :
- 2:455
array([ 0.5, 1.5, 2.5, ..., 460.5, 461.5, 462.5], dtype=float32)
- latitude(nj, ni)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- latitude
- standard_name :
- latitude
- units :
- degrees_north
- valid_min :
- -90.0
- valid_max :
- 90.0
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - longitude(nj, ni)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- longitude
- standard_name :
- longitude
- units :
- degrees_east
- valid_min :
- -180.0
- valid_max :
- 180.0
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - time(time)float643.568e+09 3.568e+09 ... 3.569e+09
array([3.568493e+09, 3.568496e+09, 3.568500e+09, 3.568504e+09])
- level(level)float32-0.9917 -0.975 ... -0.025 -0.008333
- long_name :
- sigma level
- axis :
- Z
- c_grid_axis_shift :
- 0.0
- positive :
- up
- valid_min :
- -1.0
- valid_max :
- 0.0
- standard_name :
- ocean_s_coordinate
- formula_terms :
- s: level eta: XE depth: H0 a: theta b: b depth_c: hc
- formula_definition :
- z(n,k,j,i) = eta(n,j,i)*(1+s(k)) + depth_c*s(k) + (depth(j,i)-depth_c)*C(k)
array([-0.991667, -0.975 , -0.958333, -0.941667, -0.925 , -0.908333, -0.891667, -0.875 , -0.858333, -0.841667, -0.825 , -0.808333, -0.791667, -0.775 , -0.758333, -0.741667, -0.725 , -0.708333, -0.691667, -0.675 , -0.658333, -0.641667, -0.625 , -0.608333, -0.591667, -0.575 , -0.558333, -0.541667, -0.525 , -0.508333, -0.491667, -0.475 , -0.458333, -0.441667, -0.425 , -0.408333, -0.391667, -0.375 , -0.358333, -0.341667, -0.325 , -0.308333, -0.291667, -0.275 , -0.258333, -0.241667, -0.225 , -0.208333, -0.191667, -0.175 , -0.158333, -0.141667, -0.125 , -0.108333, -0.091667, -0.075 , -0.058333, -0.041667, -0.025 , -0.008333], dtype=float32)
- longitude_u(nj_u, ni_u)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- longitude at u location
- standard_name :
- longitude_at_u_location
- units :
- degrees_east
- valid_min :
- -0.1
- valid_max :
- 16.099940000000004
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - longitude_v(nj_v, ni_v)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- longitude at v location
- standard_name :
- longitude_at_v_location
- units :
- degrees_east
- valid_min :
- -0.1
- valid_max :
- 16.099940000000004
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - latitude_u(nj_u, ni_u)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- latitude at u location
- standard_name :
- latitude_at_u_location
- units :
- degrees_north
- valid_min :
- 39.4
- valid_max :
- 44.599995
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - latitude_v(nj_v, ni_v)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- latitude at v location
- standard_name :
- latitude_at_v_location
- units :
- degrees_north
- valid_min :
- 39.4
- valid_max :
- 44.599995
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - longitude_f(nj_f, ni_f)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- longitude at f location
- standard_name :
- longitude_at_f_location
- units :
- degrees_east
- valid_min :
- -0.1
- valid_max :
- 16.099940000000004
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - latitude_f(nj_f, ni_f)float64dask.array<chunksize=(463, 1101), meta=np.ndarray>
- long_name :
- latitude at f location
- standard_name :
- latitude_at_f_location
- units :
- degrees_north
- valid_min :
- 39.4
- valid_max :
- 44.599995
Array Chunk Bytes 3.89 MiB 3.89 MiB Shape (463, 1101) (463, 1101) Count 15 Tasks 1 Chunks Type float64 numpy.ndarray - level_w(level_w)float32-1.0 -0.9833 ... -0.01667 0.0
- long_name :
- sigma level at the interface
- axis :
- Z
- c_grid_axis_shift :
- -0.5
- positive :
- up
- valid_min :
- -1.1
- valid_max :
- 0.1
- standard_name :
- ocean_s_coordinate_at_w_location
- formula_terms :
- s: level_w eta: XE depth: H0 a: theta b: b depth_c: hc
- formula_definition :
- z(n,k,j,i) = eta(n,j,i)*(1+s_w(k)) + depth_c*s_w(k) + (depth(j,i)-depth_c)*C_w(k)
array([-1. , -0.983333, -0.966667, -0.95 , -0.933333, -0.916667, -0.9 , -0.883333, -0.866667, -0.85 , -0.833333, -0.816667, -0.8 , -0.783333, -0.766667, -0.75 , -0.733333, -0.716667, -0.7 , -0.683333, -0.666667, -0.65 , -0.633333, -0.616667, -0.6 , -0.583333, -0.566667, -0.55 , -0.533333, -0.516667, -0.5 , -0.483333, -0.466667, -0.45 , -0.433333, -0.416667, -0.4 , -0.383333, -0.366667, -0.35 , -0.333333, -0.316667, -0.3 , -0.283333, -0.266667, -0.25 , -0.233333, -0.216667, -0.2 , -0.183333, -0.166667, -0.15 , -0.133333, -0.116667, -0.1 , -0.083333, -0.066667, -0.05 , -0.033333, -0.016667, 0. ], dtype=float32)
- dx_f(time, nj_f, ni_f)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - dx_u(time, nj_u, ni_u)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - dx_v(time, nj_v, ni_v)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - dx(time, nj, ni)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - dy_v(time, nj_v, ni_v)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - dy_u(time, nj_u, ni_u)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - dy_f(time, nj_f, ni_f)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - dy(time, nj, ni)float64dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 15.56 MiB 3.89 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float64 numpy.ndarray - SIG(time, level)float32dask.array<chunksize=(1, 60), meta=np.ndarray>
Array Chunk Bytes 0.94 kiB 240 B Shape (4, 60) (1, 60) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - SIG_W(time, level_w)float32dask.array<chunksize=(1, 61), meta=np.ndarray>
Array Chunk Bytes 0.95 kiB 244 B Shape (4, 61) (1, 61) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - Csu_sig(time, level)float32dask.array<chunksize=(1, 60), meta=np.ndarray>
Array Chunk Bytes 0.94 kiB 240 B Shape (4, 60) (1, 60) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - Csw_sig(time, level_w)float32dask.array<chunksize=(1, 61), meta=np.ndarray>
Array Chunk Bytes 0.95 kiB 244 B Shape (4, 61) (1, 61) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - hc(time, nj, ni)float32dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 7.78 MiB 1.94 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - b(time)float640.2 0.2 0.2 0.2
array([0.2, 0.2, 0.2, 0.2])
- theta(time)float646.0 6.0 6.0 6.0
array([6., 6., 6., 6.])
- H0(time, nj, ni)float32dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 7.78 MiB 1.94 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - HX(time, nj_u, ni_u)float32dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 7.78 MiB 1.94 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - HY(time, nj_v, ni_v)float32dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 7.78 MiB 1.94 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 16 Tasks 4 Chunks Type float32 numpy.ndarray - XE(time, nj, ni)float32dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 7.78 MiB 1.94 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - UZ(time, level, nj_u, ni_u)float32dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 466.70 MiB 116.68 MiB Shape (4, 60, 463, 1101) (1, 60, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - VZ(time, level, nj_v, ni_v)float32dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 466.70 MiB 116.68 MiB Shape (4, 60, 463, 1101) (1, 60, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - w_sig(time, level_w, nj, ni)float32dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 474.48 MiB 118.62 MiB Shape (4, 61, 463, 1101) (1, 61, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - w(time, level_w, nj, ni)float32dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 474.48 MiB 118.62 MiB Shape (4, 61, 463, 1101) (1, 61, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - SAL(time, level, nj, ni)float32dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 466.70 MiB 116.68 MiB Shape (4, 60, 463, 1101) (1, 60, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - TEMP(time, level, nj, ni)float32dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 466.70 MiB 116.68 MiB Shape (4, 60, 463, 1101) (1, 60, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - VISH_XE(time, level, nj, ni)float32dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 466.70 MiB 116.68 MiB Shape (4, 60, 463, 1101) (1, 60, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - VISH_PHI(time, level, nj_f, ni_f)float32dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 466.70 MiB 116.68 MiB Shape (4, 60, 463, 1101) (1, 60, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - NZ(time, level_w, nj, ni)float32dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 474.48 MiB 118.62 MiB Shape (4, 61, 463, 1101) (1, 61, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - KZ(time, level_w, nj, ni)float32dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 474.48 MiB 118.62 MiB Shape (4, 61, 463, 1101) (1, 61, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - N2(time, level_w, nj, ni)float32dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 474.48 MiB 118.62 MiB Shape (4, 61, 463, 1101) (1, 61, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - ECT(time, level_w, nj, ni)float32dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 474.48 MiB 118.62 MiB Shape (4, 61, 463, 1101) (1, 61, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - EPS(time, level_w, nj, ni)float32dask.array<chunksize=(1, 61, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 474.48 MiB 118.62 MiB Shape (4, 61, 463, 1101) (1, 61, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - BZ(time, level, nj, ni)float32dask.array<chunksize=(1, 60, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 466.70 MiB 116.68 MiB Shape (4, 60, 463, 1101) (1, 60, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - TAUX(time, nj_u, ni_u)float32dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 7.78 MiB 1.94 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray - TAUY(time, nj_v, ni_v)float32dask.array<chunksize=(1, 463, 1101), meta=np.ndarray>
Array Chunk Bytes 7.78 MiB 1.94 MiB Shape (4, 463, 1101) (1, 463, 1101) Count 12 Tasks 4 Chunks Type float32 numpy.ndarray
Note
auto_merge = database when gather_unique_dim=None
[29]:
ds = get_dataset(infiles, gather_unique_dim=None)
[30]:
auto.time
[30]:
<xarray.DataArray 'time' (time: 4)> array([3.568493e+09, 3.568496e+09, 3.568500e+09, 3.568504e+09]) Coordinates: * time (time) float64 3.568e+09 3.568e+09 3.568e+09 3.569e+09
- time: 4
- 3.568e+09 3.568e+09 3.568e+09 3.569e+09
array([3.568493e+09, 3.568496e+09, 3.568500e+09, 3.568504e+09])
- time(time)float643.568e+09 3.568e+09 ... 3.569e+09
array([3.568493e+09, 3.568496e+09, 3.568500e+09, 3.568504e+09])
[31]:
ds.time
[31]:
<xarray.DataArray 'time' (time: 4)> array([3.568493e+09, 3.568496e+09, 3.568500e+09, 3.568504e+09]) Coordinates: * time (time) float64 3.568e+09 3.568e+09 3.568e+09 3.569e+09
- time: 4
- 3.568e+09 3.568e+09 3.568e+09 3.569e+09
array([3.568493e+09, 3.568496e+09, 3.568500e+09, 3.568504e+09])
- time(time)float643.568e+09 3.568e+09 ... 3.569e+09
array([3.568493e+09, 3.568496e+09, 3.568500e+09, 3.568504e+09])
[32]:
xr.testing.assert_identical(ds, auto)