Units with pint_xarray.PintIndex#
See also
Learn more at the pint-xarray documentation page.
Highlights#
pint-xarray provides an index that wraps other indexes and attaches units to the indexed coordinates. This allows operations like integrate or sel to take the units into account.
Example#
First we open the dataset, fill in missing units attributes, and calculate the length of the vectors for later:
%xmode minimal
import numpy as np
import xarray as xr
xr.set_options(
display_expand_indexes=True,
display_expand_attrs=False,
display_expand_data=False,
)
ds = (
xr.tutorial.open_dataset("eraint_uvz")
.load()
.assign_coords(
month=lambda ds: ds["month"].assign_attrs({"units": "months"})
)
.assign(windspeed=lambda ds: np.hypot(ds["u"], ds["v"]))
)
ds
Exception reporting mode: Minimal
/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/xarray/conventions.py:204: SerializationWarning: variable 'z' has non-conforming '_FillValue' np.float64(nan) defined, dropping '_FillValue' entirely.
var = coder.decode(var, name=name)
/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/xarray/conventions.py:204: SerializationWarning: variable 'u' has non-conforming '_FillValue' np.float64(nan) defined, dropping '_FillValue' entirely.
var = coder.decode(var, name=name)
/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/xarray/conventions.py:204: SerializationWarning: variable 'v' has non-conforming '_FillValue' np.float64(nan) defined, dropping '_FillValue' entirely.
var = coder.decode(var, name=name)
<xarray.Dataset> Size: 22MB
Dimensions: (month: 2, level: 3, latitude: 241, longitude: 480)
Coordinates:
* month (month) int32 8B 1 7
* level (level) int32 12B 200 500 850
* latitude (latitude) float32 964B 90.0 89.25 88.5 ... -88.5 -89.25 -90.0
* longitude (longitude) float32 2kB -180.0 -179.2 -178.5 ... 178.5 179.2
Data variables:
z (month, level, latitude, longitude) float64 6MB 1.068e+05 ... ...
u (month, level, latitude, longitude) float64 6MB 1.282 ... 3.539
v (month, level, latitude, longitude) float64 6MB -0.04676 ... 3...
windspeed (month, level, latitude, longitude) float64 6MB 1.283 ... 4.896
Attributes: (2)- month: 2
- level: 3
- latitude: 241
- longitude: 480
- month(month)int321 7
- units :
- months
array([1, 7], dtype=int32)
- level(level)int32200 500 850
- units :
- millibars
- long_name :
- pressure_level
array([200, 500, 850], dtype=int32)
- latitude(latitude)float3290.0 89.25 88.5 ... -89.25 -90.0
- units :
- degrees_north
- long_name :
- latitude
array([ 90. , 89.25, 88.5 , ..., -88.5 , -89.25, -90. ], shape=(241,), dtype=float32) - longitude(longitude)float32-180.0 -179.2 ... 178.5 179.2
- units :
- degrees_east
- long_name :
- longitude
array([-180. , -179.25, -178.5 , ..., 177.75, 178.5 , 179.25], shape=(480,), dtype=float32)
- z(month, level, latitude, longitude)float641.068e+05 1.068e+05 ... 1.178e+04
- number_of_significant_digits :
- 5
- units :
- m**2 s**-2
- long_name :
- Geopotential
- standard_name :
- geopotential
array([[[[106837.51210859, 106839.23713606, 106837.51210859, ..., 106839.23713606, 106837.51210859, 106839.23713606], [106856.48741073, 106858.2124382 , 106856.48741073, ..., 106856.48741073, 106856.48741073, 106856.48741073], [106884.08785021, 106884.08785021, 106884.08785021, ..., 106884.08785021, 106884.08785021, 106884.08785021], ..., [109795.93421535, 109795.93421535, 109795.93421535, ..., 109795.93421535, 109795.93421535, 109795.93421535], [109802.83432522, 109804.55935268, 109804.55935268, ..., 109804.55935268, 109802.83432522, 109802.83432522], [109808.00940762, 109808.00940762, 109808.00940762, ..., 109808.00940762, 109808.00940762, 109808.00940762]], [[ 49723.57768724, 49723.57768724, 49723.57768724, ..., 49723.57768724, 49723.57768724, 49723.57768724], [ 49744.27801685, 49744.27801685, 49744.27801685, ..., 49746.00304431, 49746.00304431, 49746.00304431], [ 49771.87845633, 49771.87845633, 49771.87845633, ..., 49771.87845633, 49771.87845633, 49771.87845633], ... 47893.32354422, 47891.59851676, 47891.59851676], [ 47941.62431331, 47941.62431331, 47941.62431331, ..., 47943.34934078, 47941.62431331, 47941.62431331], [ 47974.3998352 , 47974.3998352 , 47974.3998352 , ..., 47974.3998352 , 47974.3998352 , 47974.3998352 ]], [[ 13485.92567753, 13485.92567753, 13485.92567753, ..., 13485.92567753, 13485.92567753, 13485.92567753], [ 13484.20065006, 13484.20065006, 13484.20065006, ..., 13484.20065006, 13484.20065006, 13484.20065006], [ 13484.20065006, 13484.20065006, 13484.20065006, ..., 13482.4756226 , 13482.4756226 , 13484.20065006], ..., [ 11360.69183758, 11358.96681011, 11357.24178264, ..., 11364.14189251, 11362.41686504, 11362.41686504], [ 11612.54584783, 11612.54584783, 11612.54584783, ..., 11612.54584783, 11612.54584783, 11612.54584783], [ 11776.42345724, 11776.42345724, 11776.42345724, ..., 11776.42345724, 11776.42345724, 11776.42345724]]]], shape=(2, 3, 241, 480)) - u(month, level, latitude, longitude)float641.282 1.282 1.282 ... 3.578 3.539
- number_of_significant_digits :
- 2
- units :
- m s**-1
- long_name :
- U component of wind
- standard_name :
- eastward_wind
array([[[[ 1.28176025e+00, 1.28176025e+00, 1.28176025e+00, ..., 1.28176025e+00, 1.28176025e+00, 1.28176025e+00], [ 2.01621345e+00, 2.03194050e+00, 2.02407698e+00, ..., 2.00834993e+00, 2.00834993e+00, 2.02407698e+00], [ 2.81986568e+00, 2.83559273e+00, 2.83559273e+00, ..., 2.79627510e+00, 2.79627510e+00, 2.81986568e+00], ..., [-5.07977973e-01, -4.92250923e-01, -4.84387399e-01, ..., -5.47295596e-01, -5.31568547e-01, -5.23705022e-01], [-5.70886170e-01, -5.63022645e-01, -5.47295596e-01, ..., -5.94476744e-01, -5.86613219e-01, -5.78749695e-01], [-5.39432071e-01, -5.39432071e-01, -5.31568547e-01, ..., -5.55159121e-01, -5.47295596e-01, -5.47295596e-01]], [[ 1.92185116e+00, 1.90612411e+00, 1.89039706e+00, ..., 1.96116878e+00, 1.95330526e+00, 1.93757821e+00], [ 2.30401846e+00, 2.30401846e+00, 2.28200059e+00, ..., 2.33547256e+00, 2.31974551e+00, 2.31974551e+00], [ 2.74280313e+00, 2.74280313e+00, 2.73493961e+00, ..., 2.76639371e+00, 2.75066666e+00, 2.75853018e+00], ... -4.46804901e+00, -4.46804901e+00, -4.49950311e+00], [-3.55430744e+00, -3.58576154e+00, -3.59362506e+00, ..., -3.49297195e+00, -3.50712629e+00, -3.53858039e+00], [-2.39050578e+00, -2.42195988e+00, -2.43768693e+00, ..., -2.31973406e+00, -2.33546111e+00, -2.36691521e+00]], [[-1.63555591e-01, -1.55692066e-01, -1.55692066e-01, ..., -1.87146165e-01, -1.79282641e-01, -1.71419116e-01], [ 7.86924709e-03, 1.57327718e-02, 2.35962965e-02, ..., -1.57213270e-02, -7.85780230e-03, 5.72239517e-06], [ 2.73656382e-01, 2.81519906e-01, 2.89383431e-01, ..., 2.42202283e-01, 2.50065808e-01, 2.65792857e-01], ..., [-1.68750668e+00, -1.68750668e+00, -1.69537020e+00, ..., -1.66391610e+00, -1.67177963e+00, -1.67964315e+00], [ 1.45318509e+00, 1.42959451e+00, 1.39027689e+00, ..., 1.55541091e+00, 1.52395681e+00, 1.49250271e+00], [ 3.48511987e+00, 3.45366577e+00, 3.39862109e+00, ..., 3.62509060e+00, 3.57790946e+00, 3.53859183e+00]]]], shape=(2, 3, 241, 480)) - v(month, level, latitude, longitude)float64-0.04676 -0.06253 ... 3.328 3.383
- number_of_significant_digits :
- 2
- units :
- m s**-1
- long_name :
- V component of wind
- standard_name :
- northward_wind
array([[[[-0.04675769, -0.06252575, -0.07829381, ..., 0.00771379, -0.00757645, -0.02334451], [ 0.14054775, 0.10948945, 0.08607627, ..., 0.22655535, 0.19549705, 0.17208387], [ 0.33597613, 0.29679489, 0.25761365, ..., 0.45304203, 0.41386079, 0.37515737], ..., [-0.68751431, -0.70328237, -0.71857261, ..., -0.65645601, -0.66410113, -0.67986919], [-0.51549911, -0.53126717, -0.53891229, ..., -0.49208593, -0.50020887, -0.50785399], [-0.37502003, -0.38266515, -0.39078809, ..., -0.35160685, -0.35925197, -0.36737491]], [[-1.07789324, -1.10942936, -1.13284254, ..., -1.0076537 , -1.03106688, -1.062603 ], [-0.92976904, -0.96082734, -0.99236346, ..., -0.82799338, -0.8595295 , -0.89823292], [-0.76539897, -0.81270315, -0.85140656, ..., -0.64833307, -0.68751431, -0.72669555], ... [ 1.57830812, 1.50759076, 1.43735122, ..., 1.78138162, 1.7187872 , 1.64854766], [ 1.83585309, 1.78902674, 1.73455526, ..., 1.98445511, 1.93762875, 1.89080239], [ 1.92186069, 1.89080239, 1.85926627, ..., 2.01551341, 1.98445511, 1.95291899]], [[ 0.51563644, 0.51563644, 0.51563644, ..., 0.50799132, 0.50799132, 0.50799132], [ 0.54669474, 0.54669474, 0.54669474, ..., 0.53904962, 0.53904962, 0.54669474], [ 0.58587598, 0.58587598, 0.58587598, ..., 0.58587598, 0.57823086, 0.58587598], ..., [ 4.73430919, 4.75007725, 4.75007725, ..., 4.73430919, 4.71854113, 4.73430919], [ 3.19525098, 3.2267871 , 3.24207734, ..., 3.12501144, 3.14842462, 3.17948292], [ 3.42173766, 3.46856402, 3.50774526, ..., 3.2889037 , 3.32808494, 3.38303424]]]], shape=(2, 3, 241, 480)) - windspeed(month, level, latitude, longitude)float641.283 1.283 1.284 ... 4.886 4.896
- number_of_significant_digits :
- 2
- units :
- m s**-1
- long_name :
- U component of wind
- standard_name :
- eastward_wind
array([[[[1.28261281, 1.28328438, 1.28414923, ..., 1.28178346, 1.28178264, 1.28197281], [2.02110622, 2.03488824, 2.0259064 , ..., 2.02108801, 2.01784254, 2.03137896], [2.83981027, 2.85108283, 2.84727078, ..., 2.83273746, 2.82673578, 2.84471185], ..., [0.85482018, 0.85843873, 0.86658972, ..., 0.8546736 , 0.85064412, 0.85818941], [0.76918811, 0.77410549, 0.76808784, ..., 0.77171961, 0.77092411, 0.76997849], [0.65698324, 0.66137703, 0.65975787, ..., 0.65713699, 0.65467125, 0.65916371]], [[2.20348944, 2.20548013, 2.20384511, ..., 2.20489205, 2.20873275, 2.20982679], [2.48454654, 2.49633536, 2.48843564, ..., 2.47790337, 2.47386543, 2.48757746], [2.84759629, 2.86067395, 2.86440008, ..., 2.84135002, 2.83528535, 2.85264354], ... [4.76828949, 4.77518618, 4.75347785, ..., 4.81007093, 4.78724256, 4.79199724], [4.00043222, 4.00728118, 3.99034122, ..., 4.01732686, 4.00678674, 4.0120674 ], [3.06725715, 3.07262483, 3.06580962, ..., 3.07302139, 3.06470891, 3.06857951]], [[0.54095413, 0.53862878, 0.53862878, ..., 0.5413676 , 0.53869978, 0.53613403], [0.54675138, 0.54692108, 0.54720374, ..., 0.53927883, 0.53910689, 0.54669474], [0.64663628, 0.65000317, 0.65344735, ..., 0.63396578, 0.62998717, 0.64334789], ..., [5.02606828, 5.04092379, 5.04356164, ..., 5.01819692, 5.00594422, 5.02343355], [3.51018173, 3.52929107, 3.52759625, ..., 3.49070188, 3.49785963, 3.51236046], [4.88409143, 4.89476696, 4.88414805, ..., 4.89470831, 4.88646963, 4.89556461]]]], shape=(2, 3, 241, 480))
- Conventions :
- CF-1.0
- Info :
- Monthly ERA-Interim data. Downloaded and edited by fabien.maussion@uibk.ac.at
Quantifying#
Now we can quantify to convert arrays with a "units" attribute to quantity arrays:
import cf_xarray.units
import pint_xarray
quantified = ds.pint.quantify()
quantified
<xarray.Dataset> Size: 22MB
Dimensions: (month: 2, level: 3, latitude: 241, longitude: 480)
Coordinates:
* month (month) int32 8B [month] 1 7
* level (level) int32 12B [mbar] 200 500 850
* latitude (latitude) float32 964B [degrees_north] 90.0 89.25 ... -90.0
* longitude (longitude) float32 2kB [degrees_east] -180.0 -179.2 ... 179.2
Data variables:
z (month, level, latitude, longitude) float64 6MB [m²/s²] 1.068e...
u (month, level, latitude, longitude) float64 6MB [m/s] 1.282 .....
v (month, level, latitude, longitude) float64 6MB [m/s] -0.04676...
windspeed (month, level, latitude, longitude) float64 6MB [m/s] 1.283 .....
Indexes:
longitude PintIndex(PandasIndex, units={'longitude': 'degrees_east'})
latitude PintIndex(PandasIndex, units={'latitude': 'degrees_north'})
level PintIndex(PandasIndex, units={'level': 'mbar'})
month PintIndex(PandasIndex, units={'month': 'month'})
Attributes: (2)- month: 2
- level: 3
- latitude: 241
- longitude: 480
- month(month)int32[month] 1 7
Magnitude [1 7]
Units month - level(level)int32[mbar] 200 500 850
- long_name :
- pressure_level
Magnitude [200 500 850]
Units millibar - latitude(latitude)float32[degrees_north] 90.0 ... -90.0
- long_name :
- latitude
Magnitude [90.0 89.25 88.5 87.75 87.0 86.25 85.5 84.75 84.0 83.25 82.5 81.75 81.0 80.25 79.5 78.75 78.0 77.25 76.5 75.75 75.0 74.25 73.5 72.75 72.0 71.25 70.5 69.75 69.0 68.25 67.5 66.75 66.0 65.25 64.5 63.75 63.0 62.25 61.5 60.75 60.0 59.25 58.5 57.75 57.0 56.25 55.5 54.75 54.0 53.25 52.5 51.75 51.0 50.25 49.5 48.75 48.0 47.25 46.5 45.75 45.0 44.25 43.5 42.75 42.0 41.25 40.5 39.75 39.0 38.25 37.5 36.75 36.0 35.25 34.5 33.75 33.0 32.25 31.5 30.75 30.0 29.25 28.5 27.75 27.0 26.25 25.5 24.75 24.0 23.25 22.5 21.75 21.0 20.25 19.5 18.75 18.0 17.25 16.5 15.75 15.0 14.25 13.5 12.75 12.0 11.25 10.5 9.75 9.0 8.25 7.5 6.75 6.0 5.25 4.5 3.75 3.0 2.25 1.5 0.75 0.0 -0.75 -1.5 -2.25 -3.0 -3.75 -4.5 -5.25 -6.0 -6.75 -7.5 -8.25 -9.0 -9.75 -10.5 -11.25 -12.0 -12.75 -13.5 -14.25 -15.0 -15.75 -16.5 -17.25 -18.0 -18.75 -19.5 -20.25 -21.0 -21.75 -22.5 -23.25 -24.0 -24.75 -25.5 -26.25 -27.0 -27.75 -28.5 -29.25 -30.0 -30.75 -31.5 -32.25 -33.0 -33.75 -34.5 -35.25 -36.0 -36.75 -37.5 -38.25 -39.0 -39.75 -40.5 -41.25 -42.0 -42.75 -43.5 -44.25 -45.0 -45.75 -46.5 -47.25 -48.0 -48.75 -49.5 -50.25 -51.0 -51.75 -52.5 -53.25 -54.0 -54.75 -55.5 -56.25 -57.0 -57.75 -58.5 -59.25 -60.0 -60.75 -61.5 -62.25 -63.0 -63.75 -64.5 -65.25 -66.0 -66.75 -67.5 -68.25 -69.0 -69.75 -70.5 -71.25 -72.0 -72.75 -73.5 -74.25 -75.0 -75.75 -76.5 -77.25 -78.0 -78.75 -79.5 -80.25 -81.0 -81.75 -82.5 -83.25 -84.0 -84.75 -85.5 -86.25 -87.0 -87.75 -88.5 -89.25 -90.0]
Units degrees_north - longitude(longitude)float32[degrees_east] -180.0 ... 179.2
- long_name :
- longitude
Magnitude [-180.0 -179.25 -178.5 -177.75 -177.0 -176.25 -175.5 -174.75 -174.0 -173.25 -172.5 -171.75 -171.0 -170.25 -169.5 -168.75 -168.0 -167.25 -166.5 -165.75 -165.0 -164.25 -163.5 -162.75 -162.0 -161.25 -160.5 -159.75 -159.0 -158.25 -157.5 -156.75 -156.0 -155.25 -154.5 -153.75 -153.0 -152.25 -151.5 -150.75 -150.0 -149.25 -148.5 -147.75 -147.0 -146.25 -145.5 -144.75 -144.0 -143.25 -142.5 -141.75 -141.0 -140.25 -139.5 -138.75 -138.0 -137.25 -136.5 -135.75 -135.0 -134.25 -133.5 -132.75 -132.0 -131.25 -130.5 -129.75 -129.0 -128.25 -127.5 -126.75 -126.0 -125.25 -124.5 -123.75 -123.0 -122.25 -121.5 -120.75 -120.0 -119.25 -118.5 -117.75 -117.0 -116.25 -115.5 -114.75 -114.0 -113.25 -112.5 -111.75 -111.0 -110.25 -109.5 -108.75 -108.0 -107.25 -106.5 -105.75 -105.0 -104.25 -103.5 -102.75 -102.0 -101.25 -100.5 -99.75 -99.0 -98.25 -97.5 -96.75 -96.0 -95.25 -94.5 -93.75 -93.0 -92.25 -91.5 -90.75 -90.0 -89.25 -88.5 -87.75 -87.0 -86.25 -85.5 -84.75 -84.0 -83.25 -82.5 -81.75 -81.0 -80.25 -79.5 -78.75 -78.0 -77.25 -76.5 -75.75 -75.0 -74.25 -73.5 -72.75 -72.0 -71.25 -70.5 -69.75 -69.0 -68.25 -67.5 -66.75 -66.0 -65.25 -64.5 -63.75 -63.0 -62.25 -61.5 -60.75 -60.0 -59.25 -58.5 -57.75 -57.0 -56.25 -55.5 -54.75 -54.0 -53.25 -52.5 -51.75 -51.0 -50.25 -49.5 -48.75 -48.0 -47.25 -46.5 -45.75 -45.0 -44.25 -43.5 -42.75 -42.0 -41.25 -40.5 -39.75 -39.0 -38.25 -37.5 -36.75 -36.0 -35.25 -34.5 -33.75 -33.0 -32.25 -31.5 -30.75 -30.0 -29.25 -28.5 -27.75 -27.0 -26.25 -25.5 -24.75 -24.0 -23.25 -22.5 -21.75 -21.0 -20.25 -19.5 -18.75 -18.0 -17.25 -16.5 -15.75 -15.0 -14.25 -13.5 -12.75 -12.0 -11.25 -10.5 -9.75 -9.0 -8.25 -7.5 -6.75 -6.0 -5.25 -4.5 -3.75 -3.0 -2.25 -1.5 -0.75 0.0 0.75 1.5 2.25 3.0 3.75 4.5 5.25 6.0 6.75 7.5 8.25 9.0 9.75 10.5 11.25 12.0 12.75 13.5 14.25 15.0 15.75 16.5 17.25 18.0 18.75 19.5 20.25 21.0 21.75 22.5 23.25 24.0 24.75 25.5 26.25 27.0 27.75 28.5 29.25 30.0 30.75 31.5 32.25 33.0 33.75 34.5 35.25 36.0 36.75 37.5 38.25 39.0 39.75 40.5 41.25 42.0 42.75 43.5 44.25 45.0 45.75 46.5 47.25 48.0 48.75 49.5 50.25 51.0 51.75 52.5 53.25 54.0 54.75 55.5 56.25 57.0 57.75 58.5 59.25 60.0 60.75 61.5 62.25 63.0 63.75 64.5 65.25 66.0 66.75 67.5 68.25 69.0 69.75 70.5 71.25 72.0 72.75 73.5 74.25 75.0 75.75 76.5 77.25 78.0 78.75 79.5 80.25 81.0 81.75 82.5 83.25 84.0 84.75 85.5 86.25 87.0 87.75 88.5 89.25 90.0 90.75 91.5 92.25 93.0 93.75 94.5 95.25 96.0 96.75 97.5 98.25 99.0 99.75 100.5 101.25 102.0 102.75 103.5 104.25 105.0 105.75 106.5 107.25 108.0 108.75 109.5 110.25 111.0 111.75 112.5 113.25 114.0 114.75 115.5 116.25 117.0 117.75 118.5 119.25 120.0 120.75 121.5 122.25 123.0 123.75 124.5 125.25 126.0 126.75 127.5 128.25 129.0 129.75 130.5 131.25 132.0 132.75 133.5 134.25 135.0 135.75 136.5 137.25 138.0 138.75 139.5 140.25 141.0 141.75 142.5 143.25 144.0 144.75 145.5 146.25 147.0 147.75 148.5 149.25 150.0 150.75 151.5 152.25 153.0 153.75 154.5 155.25 156.0 156.75 157.5 158.25 159.0 159.75 160.5 161.25 162.0 162.75 163.5 164.25 165.0 165.75 166.5 167.25 168.0 168.75 169.5 170.25 171.0 171.75 172.5 173.25 174.0 174.75 175.5 176.25 177.0 177.75 178.5 179.25]
Units degrees_east
- z(month, level, latitude, longitude)float64[m²/s²] 1.068e+05 ... 1.178e+04
- number_of_significant_digits :
- 5
- long_name :
- Geopotential
- standard_name :
- geopotential
Magnitude [[[[106837.51210858817 106839.23713605566 106837.51210858817 ... 106839.23713605566 106837.51210858817 106839.23713605566] [106856.48741073062 106858.21243819813 106856.48741073062 ... 106856.48741073062 106856.48741073062 106856.48741073062] [106884.08785021058 106884.08785021058 106884.08785021058 ... 106884.08785021058 106884.08785021058 106884.08785021058] ... [109795.93421534517 109795.93421534517 109795.93421534517 ... 109795.93421534517 109795.93421534517 109795.93421534517] [109802.83432521517 109804.55935268266 109804.55935268266 ... 109804.55935268266 109802.83432521517 109802.83432521517] [109808.00940761765 109808.00940761765 109808.00940761765 ... 109808.00940761765 109808.00940761765 109808.00940761765]] [[49723.57768723677 49723.57768723677 49723.57768723677 ... 49723.57768723677 49723.57768723677 49723.57768723677] [49744.27801684673 49744.27801684673 49744.27801684673 ... 49746.00304431423 49746.00304431423 49746.00304431423] [49771.87845632668 49771.87845632668 49771.87845632668 ... 49771.87845632668 49771.87845632668 49771.87845632668] ... [50325.612273393155 50323.88724592565 50323.88724592565 ... 50327.33730086065 50325.612273393155 50325.612273393155] [50353.2127128731 50353.2127128731 50351.487685405606 ... 50353.2127128731 50353.2127128731 50353.2127128731] [50368.73796008057 50368.73796008057 50368.73796008057 ... 50368.73796008057 50368.73796008057 50368.73796008057]] [[12714.838399560525 12714.838399560525 12714.838399560525 ... 12714.838399560525 12714.838399560525 12714.838399560525] [12752.78900384545 12752.78900384545 12752.78900384545 ... 12752.78900384545 12752.78900384545 12752.78900384545] [12790.739608130381 12790.739608130381 12790.739608130381 ... 12790.739608130381 12790.739608130381 12790.739608130381] ... [12255.981093206377 12254.256065738882 12254.256065738882 ... 12257.706120673873 12257.706120673873 12255.981093206377] [12333.607329243729 12333.607329243729 12333.607329243729 ... 12335.332356711231 12335.332356711231 12335.332356711231] [12371.55793352866 12371.55793352866 12371.55793352866 ... 12371.55793352866 12371.55793352866 12371.55793352866]]] [[[114827.83933803331 114827.83933803331 114827.83933803331 ... 114827.83933803331 114827.83933803331 114827.83933803331] [114827.83933803331 114827.83933803331 114827.83933803331 ... 114829.56436550082 114827.83933803331 114827.83933803331] [114834.73944790331 114834.73944790331 114834.73944790331 ... 114834.73944790331 114834.73944790331 114834.73944790331] ... [103508.20909631936 103508.20909631936 103508.20909631936 ... 103506.48406885186 103508.20909631936 103508.20909631936] [103525.45937099433 103525.45937099433 103525.45937099433 ... 103525.45937099433 103525.45937099433 103525.45937099433] [103537.53456326679 103539.25959073429 103537.53456326679 ... 103539.25959073429 103537.53456326679 103539.25959073429]] [[53382.360945797474 53382.360945797474 53382.360945797474 ... 53382.360945797474 53382.360945797474 53382.360945797474] [53378.91089086248 53378.91089086248 53378.91089086248 ... 53377.18586339498 53377.18586339498 53378.91089086248] [53378.91089086248 53378.91089086248 53378.91089086248 ... 53378.91089086248 53378.91089086248 53378.91089086248] ... [47891.59851675517 47889.87348928768 47889.87348928768 ... 47893.32354422267 47891.59851675517 47891.59851675517] [47941.62431331258 47941.62431331258 47941.62431331258 ... 47943.34934078008 47941.62431331258 47941.62431331258] [47974.39983519502 47974.39983519502 47974.39983519502 ... 47974.39983519502 47974.39983519502 47974.39983519502]] [[13485.925677531588 13485.925677531588 13485.925677531588 ... 13485.925677531588 13485.925677531588 13485.925677531588] [13484.200650064093 13484.200650064093 13484.200650064093 ... 13484.200650064093 13484.200650064093 13484.200650064093] [13484.200650064093 13484.200650064093 13484.200650064093 ... 13482.475622596598 13482.475622596598 13484.200650064093] ... [11360.691837575541 11358.966810108039 11357.241782640544 ... 11364.141892510532 11362.416865043037 11362.416865043037] [11612.545847830072 11612.545847830072 11612.545847830072 ... 11612.545847830072 11612.545847830072 11612.545847830072] [11776.423457242265 11776.423457242265 11776.423457242265 ... 11776.423457242265 11776.423457242265 11776.423457242265]]]]
Units meter2/second2 - u(month, level, latitude, longitude)float64[m/s] 1.282 1.282 ... 3.578 3.539
- number_of_significant_digits :
- 2
- long_name :
- U component of wind
- standard_name :
- eastward_wind
Magnitude [[[[1.2817602469022766 1.2817602469022766 1.2817602469022766 ... 1.2817602469022766 1.2817602469022766 1.2817602469022766] [2.0162134529695415 2.031940502349997 2.024076977659771 ... 2.0083499282793156 2.0083499282793156 2.024076977659771] [2.819865676310812 2.835592725691267 2.835592725691267 ... 2.796275102240127 2.796275102240127 2.819865676310812] ... [-0.5079779725935403 -0.49225092321308495 -0.48438739852285906 ... -0.5472955960446804 -0.531568546664225 -0.5237050219739956] [-0.5708861701153616 -0.5630226454251357 -0.5472955960446804 ... -0.5944767441860463 -0.5866132194958169 -0.578749694805591] [-0.5394320713544509 -0.5394320713544509 -0.531568546664225 ... -0.5551591207349063 -0.5472955960446804 -0.5472955960446804]] [[1.9218511566868095 1.9061241073063542 1.8903970579258988 ... 1.9611687801379496 1.9533052554477202 1.9375782060672648] [2.3040184566318764 2.3040184566318764 2.282000587499237 ... 2.335472555392787 2.3197455060123318 2.3197455060123318] [2.7428031343465804 2.7428031343465804 2.734939609656351 ... 2.7663937084172616 2.7506666590368063 2.7585301837270357] ... [-2.569794146371237 -2.5933847204419216 -2.609111769822377 ... -2.51632217847769 -2.5304765229201003 -2.561930621681011] [-1.921839711896478 -1.9454302859671593 -1.969020860037844 ... -1.8432044649942014 -1.8667950390648826 -1.8982491378257933] [-1.2345676539705792 -1.2660217527314899 -1.2974758514924005 ... -1.1323418329976178 -1.171659456448758 -1.2031135552096686]] [[3.21146920588415 3.21146920588415 3.1957421565036945 ... 3.2429233046450605 3.227196255264605 3.227196255264605] [3.2036056811939204 3.2036056811939204 3.187878631813465 ... 3.227196255264605 3.2193327305743757 3.2193327305743757] [3.272804698467926 3.272804698467926 3.2649411737776965 ... 3.2885317478483813 3.272804698467926 3.280668223158152] ... [-1.9454302859671593 -1.9847479094182994 -2.0083384834889806 ... -1.8432044649942014 -1.874658563755112 -1.9139761872062486] [0.05505039522676114 0.015732771775621046 -0.031448376365744934 ... 0.18715761002258446 0.13997646188121848 0.10223154336812712] [1.3509592641762822 1.3132143456631873 1.2660331975218213 ... 1.4846391839101507 1.4374580357687847 1.3981404123176482]]] [[[0.023596296465850486 0.007869247085395159 5.722395165719263e-06 ... 0.07077744460721647 0.05505039522676114 0.03932334584630581] [0.4136271211011433 0.397900071720688 0.38217302234023265 ... 0.45294474455227984 0.4372176951718245 0.42935417048159863] [0.8429755691875727 0.836684749435392 0.8209577000549366 ... 0.8822931926387128 0.8744296679484833 0.858702618568028] ... [-1.3430842946957213 -1.3210664255630817 -1.2817488021119452 ... -1.4295830662882238 -1.3981289675273132 -1.374538393456632] [-1.3902654428370873 -1.3666748687664025 -1.3430842946957213 ... -1.4767642144295898 -1.4453101156686792 -1.421719541597998] [-1.2974758514924005 -1.2817488021119452 -1.2502947033510345 ... -1.374538393456632 -1.3430842946957213 -1.327357245315266]] [[-0.3601437084172616 -0.3601437084172616 -0.3601437084172616 ... -0.36643452816944233 -0.36643452816944233 -0.3601437084172616] [0.09436801867789768 0.09436801867789768 0.09436801867789768 ... 0.07864096929744235 0.0865044939876718 0.0865044939876718] [0.5787611395959225 0.5787611395959225 0.5787611395959225 ... 0.5630340902154671 0.5630340902154671 0.5708976149056966] ... [-4.49950310535311 -4.530957204114021 -4.530957204114021 ... -4.468049006592199 -4.468049006592199 -4.49950310535311] [-3.5543074375877417 -3.5857615363486524 -3.593625061038882 ... -3.4929719450039656 -3.5071262894463757 -3.5385803882072864] [-2.3905057834340475 -2.421959882194958 -2.4376869315754135 ... -2.3197340612219968 -2.335461110602452 -2.3669152093633627]] [[-0.16355559116156826 -0.15569206647134237 -0.15569206647134237 ... -0.18714616523225303 -0.17928264054202359 -0.1714191158517977] [0.007869247085395159 0.015732771775621046 0.023596296465850486 ... -0.015721326985289608 -0.007857802295060168 5.722395165719263e-06] [0.27365638161509054 0.2815199063053164 0.28938343099554587 ... 0.24220228285417988 0.25006580754440577 0.2657928569248611] ... [-1.6875066761276933 -1.6875066761276933 -1.6953702008179192 ... -1.6639161020570086 -1.671779626747238 -1.679643151437464] [1.45318508514924 1.4295945110785588 1.3902768876274187 ... 1.5554109061222015 1.5239568073612908 1.4925027086003801] [3.485119865104071 3.4536657663431605 3.3986210935115686 ... 3.625090604590124 3.577909456448758 3.5385918329976214]]]]
Units meter/second - v(month, level, latitude, longitude)float64[m/s] -0.04676 -0.06253 ... 3.383
- number_of_significant_digits :
- 2
- long_name :
- V component of wind
- standard_name :
- northward_wind
Magnitude [[[[-0.046757690899102755 -0.06252575077824574 -0.07829381065738872 ... 0.007713788683391343 -0.00757645119941408 -0.023344511078557062] [0.1405477476652628 0.10948944790331439 0.08607626808276869 ... 0.22655534700604285 0.19549704724409445 0.17208386742354875] [0.3359761261673686 0.29679488646767993 0.25761364676799126 ... 0.45304202527009707 0.4138607855704084 0.3751573658670573] ... [-0.6875143059879143 -0.7032823658670573 -0.7185726057498627 ... -0.656456006225966 -0.6641011261673686 -0.6798691860465116] [-0.5154991073063542 -0.5312671671854972 -0.5389122871268999 ... -0.4920859274858085 -0.5002088674235489 -0.5078539873649515] [-0.37502002838308 -0.38266514832448273 -0.390788088262223 ... -0.3516068485625343 -0.35925196850393704 -0.3673749084416773]] [[-1.0778932429957884 -1.1094293627540743 -1.13284254257462 ... -1.0076537035341513 -1.031066883354697 -1.062603003112983] [-0.9297690441311115 -0.9608273438930599 -0.9923634636513459 ... -0.8279933849111885 -0.8595295046694744 -0.8982329243728255] [-0.7653989653909541 -0.812703145028383 -0.8514065647317342 ... -0.6483330662882256 -0.6875143059879143 -0.726695545687603] ... [1.9376287538912287 1.89844751419154 1.8592662744918513 ... 2.054694652993957 2.0078682933528658 1.9763321735945798] [2.2577681514374657 2.23435497161692 2.2032966718549716 ... 2.3437757507782457 2.3127174510162973 2.288826451199414] [2.515790949459806 2.5076680095220656 2.476609709760117 ... 2.5702624290423 2.5468492492217543 2.5392041292803516]] [[-0.5470352270646401 -0.5857386467679913 -0.6249198864676799 ... -0.4142012680827687 -0.4610276277238601 -0.5002088674235489] [-0.48444080754440577 -0.5312671671854972 -0.5780935268265885 ... -0.3516068485625343 -0.3984332082036257 -0.4452595678447171] [-0.3984332082036257 -0.4452595678447171 -0.5002088674235489 ... -0.25795412928035155 -0.30478048892144294 -0.3516068485625343] ... [4.34393025544772 4.359220495330526 4.34393025544772 ... 4.374988555209669 4.359220495330526 4.359220495330526] [3.7576451199414027 3.7734131798205457 3.7734131798205457 ... 3.7423548800585973 3.7423548800585973 3.7576451199414027] [3.3749113028749314 3.398324482695477 3.4064474226332173 ... 3.3204398232924373 3.3357300631752427 3.3591432429957884]]] [[[-1.0860161829335286 -1.0860161829335286 -1.0860161829335286 ... -1.0860161829335286 -1.0778932429957884 -1.0860161829335286] [-1.0391898232924373 -1.0391898232924373 -1.04683494323384 ... -1.031066883354697 -1.031066883354697 -1.0391898232924373] [-1.0157766434718916 -1.0157766434718916 -1.0157766434718916 ... -1.0076537035341513 -1.0076537035341513 -1.0076537035341513] ... [-2.000085835927486 -2.046912195568577 -2.0779704953305256 ... -1.8830199368247573 -1.9217233565281084 -1.9609045962277971] [-1.9140782365867057 -1.9451365363486541 -1.9685497161691998 ... -1.8280706372459257 -1.8596067570042116 -1.89066505676616] [-1.8596067570042116 -1.874896996887017 -1.89066505676616 ... -1.8123025773667827 -1.8280706372459257 -1.8438386971250686]] [[0.16396092748580848 0.17208386742354875 0.17208386742354875 ... 0.14867068760300306 0.15631580754440577 0.16396092748580848] [0.19549704724409445 0.20314216718549716 0.20314216718549716 ... 0.18737410730635418 0.18737410730635418 0.19549704724409445] [0.21891022706464014 0.21891022706464014 0.21891022706464014 ... 0.21078728712689987 0.21078728712689987 0.21891022706464014] ... [1.578308116645303 1.5075907571873284 1.4373512177256913 ... 1.7813816150888115 1.7187871955685772 1.64854765610694] [1.8358530946713056 1.7890267350302143 1.7345552554477202 ... 1.98445511353232 1.9376287538912287 1.8908023942501373] [1.9218606940120857 1.8908023942501373 1.8592662744918513 ... 2.0155134132942685 1.98445511353232 1.952918993774034]] [[0.5156364447903314 0.5156364447903314 0.5156364447903314 ... 0.5079913248489287 0.5079913248489287 0.5079913248489287] [0.5466947445522798 0.5466947445522798 0.5466947445522798 ... 0.5390496246108771 0.5390496246108771 0.5466947445522798] [0.5858759842519685 0.5858759842519685 0.5858759842519685 ... 0.5858759842519685 0.5782308643105658 0.5858759842519685] ... [4.734309192455594 4.750077252334737 4.750077252334737 ... 4.734309192455594 4.718541132576451 4.734309192455594] [3.1952509842519685 3.2267871040102545 3.24207734389306 ... 3.1250114447903314 3.148424624610877 3.1794829243728255] [3.4217376625160227 3.468564022157114 3.507745261856803 ... 3.2889037035341513 3.32808494323384 3.3830342428126716]]]]
Units meter/second - windspeed(month, level, latitude, longitude)float64[m/s] 1.283 1.283 ... 4.886 4.896
- number_of_significant_digits :
- 2
- long_name :
- U component of wind
- standard_name :
- eastward_wind
Magnitude [[[[1.2826128068116274 1.2832843800379432 1.284149232498404 ... 1.2817834579502254 1.2817826388088436 1.281972814351569] [2.021106221184117 2.03488823877198 2.0259063984842363 ... 2.02108801383724 2.0178425433865477 2.0313789574867016] [2.8398102735553064 2.8510828312461554 2.8472707804131194 ... 2.832737461197007 2.8267357848304444 2.844711845090842] ... [0.8548201808440691 0.8584387325509607 0.866589719291598 ... 0.8546735970884133 0.8506441239316731 0.858189408100758] [0.7691881101932307 0.7741054851832669 0.768087835254698 ... 0.7717196119107058 0.7709241080264626 0.769978494323085] [0.6569832427803616 0.6613770296494669 0.659757872048799 ... 0.6571369912668371 0.6546712505707393 0.6591637071338445]] [[2.2034894399008147 2.2054801344367982 2.2038451086412185 ... 2.204892054145478 2.208732745017027 2.2098267911425933] [2.484546542917805 2.4963353607384016 2.4884356381745056 ... 2.4779033682630973 2.4738654332970014 2.48757745589796] [2.847596286344497 2.860673947817271 2.8644000780155565 ... 2.84135001624462 2.8352853454413984 2.8526435442682487] ... [3.218423083224135 3.213992419462383 3.203800135290662 ... 3.2486377795840315 3.2303013042905997 3.235641724711178] [2.964959511336991 2.9626071519436237 2.9549212123965956 ... 2.9817255859167675 2.9721348768372837 2.973562898774208] [2.802384947435718 2.8091297450224104 2.7958968578407934 ... 2.8086379227132197 2.8034312868603024 2.809811352543732]] [[3.2577265078566424 3.2644485327019277 3.256269766981486 ... 3.2692681520932805 3.2599604512200115 3.2657318599424294] [3.2400265826983947 3.2473580282296046 3.239870722256012 ... 3.246293739936355 3.243894611658477 3.249978355759424] [3.2969682460880883 3.3029542347830065 3.303036448372623 ... 3.298633260824779 3.286965430414644 3.299456222833657] ... [4.759666906596759 4.789783668481284 4.785723929402626 ... 4.74741272252478 4.745223709960373 4.760893631672764] [3.7580483490016547 3.7734459775848315 3.7735442260585 ... 3.7470318946184276 3.744971756659746 3.759035532670431] [3.6352602707009423 3.643232247241874 3.634105680960835 ... 3.6372344063185853 3.632269353856809 3.6384941857202446]]] [[[1.0862724956475773 1.0860446927466672 1.0860161829486048 ... 1.088320079874776 1.0792981002997273 1.0867278753772998] [1.1184824022509192 1.112762308810779 1.1144144728870247 ... 1.1261695518740944 1.119936708444781 1.124393388696549] [1.3200037877484043 1.3159952733048803 1.306052730444875 ... 1.3393309016156925 1.334163869408322 1.323909427937455] ... [2.409194631767233 2.4361990963624853 2.44148343659743 ... 2.3642063839473813 2.3765069469422238 2.3946821564862506] [2.3656993674856226 2.377258156354943 2.3830785567597514 ... 2.35003719114838 2.3552194422494757 2.365565643104881] [2.267505430181293 2.2711492114459064 2.266682863151402 ... 2.2745980803246586 2.2684174389690774 2.271919540324173]] [[0.39571034413386785 0.39914452036822834 0.39914452036822834 ... 0.39544561798951766 0.3983828499358645 0.39571034413386785] [0.21708159394649687 0.22399121196603344 0.22399121196603344 ... 0.2032079184994876 0.20637849589750448 0.21378054860352202] [0.6187779441931194 0.6187779441931194 0.6187779441931194 ... 0.6011976939069851 0.6011976939069851 0.6114292879953538] ... [4.7682894947927315 4.775186182408954 4.7534778540149185 ... 4.810070933352851 4.7872425621603965 4.791997242229796] [4.000432219911462 4.007281179828827 3.990341215175466 ... 4.017326860763181 4.006786742270167 4.0120674044571185] [3.067257150585885 3.0726248331131916 3.065809624852196 ... 3.0730213852107524 3.0647089089766766 3.068579509245116]] [[0.5409541335420431 0.5386287801056767 0.5386287801056767 ... 0.5413675953387934 0.5386997784680168 0.5361340311910651] [0.5467513774749667 0.5469210764167224 0.5472037362153029 ... 0.5392788313250446 0.539106893714072 0.5466947445822288] [0.64663628426023 0.6500031742763777 0.6534473498744691 ... 0.6339657835743101 0.6299871749045212 0.6433478932237927] ... [5.026068275674842 5.040923792830384 5.043561640445105 ... 5.018196919656913 5.00594422064639 5.023433551460625] [3.510181725219277 3.5292910733903526 3.5275962535493854 ... 3.4907018802748597 3.497859626622967 3.5123604600834817] [4.8840914308828856 4.894766960889295 4.8841480484666535 ... 4.894708312311189 4.886469632354758 4.895564609787167]]]]
Units meter/second
- longitudePintIndex(PandasIndex, units={'longitude': 'degrees_east'})
<PintIndex (units={'longitude': 'degrees_east'})> PandasIndex(Index([ -180.0, -179.25, -178.5, -177.75, -177.0, -176.25, -175.5, -174.75, -174.0, -173.25, ... 172.5, 173.25, 174.0, 174.75, 175.5, 176.25, 177.0, 177.75, 178.5, 179.25], dtype='float32', name='longitude', length=480)) - latitudePintIndex(PandasIndex, units={'latitude': 'degrees_north'})
<PintIndex (units={'latitude': 'degrees_north'})> PandasIndex(Index([ 90.0, 89.25, 88.5, 87.75, 87.0, 86.25, 85.5, 84.75, 84.0, 83.25, ... -83.25, -84.0, -84.75, -85.5, -86.25, -87.0, -87.75, -88.5, -89.25, -90.0], dtype='float32', name='latitude', length=241)) - levelPintIndex(PandasIndex, units={'level': 'mbar'})
<PintIndex (units={'level': 'mbar'})> PandasIndex(Index([200, 500, 850], dtype='int32', name='level')) - monthPintIndex(PandasIndex, units={'month': 'month'})
<PintIndex (units={'month': 'month'})> PandasIndex(Index([1, 7], dtype='int32', name='month'))
- Conventions :
- CF-1.0
- Info :
- Monthly ERA-Interim data. Downloaded and edited by fabien.maussion@uibk.ac.at
Note how all variables are associated with a pint.Quantity array, and how all coordinate variables are associated with a pint_xarray.PintIndex wrapping a PandasIndex.
Selection#
With the PintIndex, selecting with quantities will convert the indexers to the index’ units:
ureg = pint_xarray.unit_registry
quantified.sel(
latitude=slice(
ureg.Quantity(4800, "arcmin"), ureg.Quantity(600, "arcmin")
),
longitude=slice(
ureg.Quantity(-10, "degree"), ureg.Quantity(np.pi, "radians")
),
)
<xarray.Dataset> Size: 5MB
Dimensions: (month: 2, level: 3, latitude: 93, longitude: 253)
Coordinates:
* month (month) int32 8B [month] 1 7
* level (level) int32 12B [mbar] 200 500 850
* latitude (latitude) float32 372B [degrees_north] 79.5 78.75 ... 11.25 10.5
* longitude (longitude) float32 1kB [degrees_east] -9.75 -9.0 ... 178.5 179.2
Data variables:
z (month, level, latitude, longitude) float64 1MB [m²/s²] 1.075e...
u (month, level, latitude, longitude) float64 1MB [m/s] 9.438 .....
v (month, level, latitude, longitude) float64 1MB [m/s] 1.211 .....
windspeed (month, level, latitude, longitude) float64 1MB [m/s] 9.515 .....
Indexes:
longitude PintIndex(PandasIndex, units={'longitude': 'degrees_east'})
latitude PintIndex(PandasIndex, units={'latitude': 'degrees_north'})
level PintIndex(PandasIndex, units={'level': 'mbar'})
month PintIndex(PandasIndex, units={'month': 'month'})
Attributes: (2)- month: 2
- level: 3
- latitude: 93
- longitude: 253
- month(month)int32[month] 1 7
Magnitude [1 7]
Units month - level(level)int32[mbar] 200 500 850
- long_name :
- pressure_level
Magnitude [200 500 850]
Units millibar - latitude(latitude)float32[degrees_north] 79.5 78.75 ... 10.5
- long_name :
- latitude
Magnitude [79.5 78.75 78.0 77.25 76.5 75.75 75.0 74.25 73.5 72.75 72.0 71.25 70.5 69.75 69.0 68.25 67.5 66.75 66.0 65.25 64.5 63.75 63.0 62.25 61.5 60.75 60.0 59.25 58.5 57.75 57.0 56.25 55.5 54.75 54.0 53.25 52.5 51.75 51.0 50.25 49.5 48.75 48.0 47.25 46.5 45.75 45.0 44.25 43.5 42.75 42.0 41.25 40.5 39.75 39.0 38.25 37.5 36.75 36.0 35.25 34.5 33.75 33.0 32.25 31.5 30.75 30.0 29.25 28.5 27.75 27.0 26.25 25.5 24.75 24.0 23.25 22.5 21.75 21.0 20.25 19.5 18.75 18.0 17.25 16.5 15.75 15.0 14.25 13.5 12.75 12.0 11.25 10.5]
Units degrees_north - longitude(longitude)float32[degrees_east] -9.75 -9.0 ... 179.2
- long_name :
- longitude
Magnitude [-9.75 -9.0 -8.25 -7.5 -6.75 -6.0 -5.25 -4.5 -3.75 -3.0 -2.25 -1.5 -0.75 0.0 0.75 1.5 2.25 3.0 3.75 4.5 5.25 6.0 6.75 7.5 8.25 9.0 9.75 10.5 11.25 12.0 12.75 13.5 14.25 15.0 15.75 16.5 17.25 18.0 18.75 19.5 20.25 21.0 21.75 22.5 23.25 24.0 24.75 25.5 26.25 27.0 27.75 28.5 29.25 30.0 30.75 31.5 32.25 33.0 33.75 34.5 35.25 36.0 36.75 37.5 38.25 39.0 39.75 40.5 41.25 42.0 42.75 43.5 44.25 45.0 45.75 46.5 47.25 48.0 48.75 49.5 50.25 51.0 51.75 52.5 53.25 54.0 54.75 55.5 56.25 57.0 57.75 58.5 59.25 60.0 60.75 61.5 62.25 63.0 63.75 64.5 65.25 66.0 66.75 67.5 68.25 69.0 69.75 70.5 71.25 72.0 72.75 73.5 74.25 75.0 75.75 76.5 77.25 78.0 78.75 79.5 80.25 81.0 81.75 82.5 83.25 84.0 84.75 85.5 86.25 87.0 87.75 88.5 89.25 90.0 90.75 91.5 92.25 93.0 93.75 94.5 95.25 96.0 96.75 97.5 98.25 99.0 99.75 100.5 101.25 102.0 102.75 103.5 104.25 105.0 105.75 106.5 107.25 108.0 108.75 109.5 110.25 111.0 111.75 112.5 113.25 114.0 114.75 115.5 116.25 117.0 117.75 118.5 119.25 120.0 120.75 121.5 122.25 123.0 123.75 124.5 125.25 126.0 126.75 127.5 128.25 129.0 129.75 130.5 131.25 132.0 132.75 133.5 134.25 135.0 135.75 136.5 137.25 138.0 138.75 139.5 140.25 141.0 141.75 142.5 143.25 144.0 144.75 145.5 146.25 147.0 147.75 148.5 149.25 150.0 150.75 151.5 152.25 153.0 153.75 154.5 155.25 156.0 156.75 157.5 158.25 159.0 159.75 160.5 161.25 162.0 162.75 163.5 164.25 165.0 165.75 166.5 167.25 168.0 168.75 169.5 170.25 171.0 171.75 172.5 173.25 174.0 174.75 175.5 176.25 177.0 177.75 178.5 179.25]
Units degrees_east
- z(month, level, latitude, longitude)float64[m²/s²] 1.075e+05 ... 1.477e+04
- number_of_significant_digits :
- 5
- long_name :
- Geopotential
- standard_name :
- geopotential
Magnitude [[[[107479.22232649698 107480.94735396447 107482.67238143197 ... 107748.32661142648 107755.22672129647 107762.12683116645] [107587.89905694927 107589.62408441678 107593.07413935177 ... 107843.2031221388 107851.82825947629 107858.72836934627] [107705.20092473907 107706.92595220655 107710.37600714155 ... 107939.80466031862 107948.4297976561 107957.05493499359] ... [121231.14129738143 121241.49146218642 121255.29168192638 ... 122173.00629463469 122166.10618476469 122160.9311023622] [121298.4173686138 121310.49256088628 121322.56775315876 ... 122181.63143197217 122174.73132210218 122169.55623969968] [121360.51835744368 121370.86852224867 121382.94371452116 ... 122186.80651437465 122181.63143197217 122176.45634956966]] [[50023.73246658121 50025.45749404871 50027.18252151621 ... 50351.487685405606 50353.2127128731 50354.937740340596] [50092.73356528109 50094.45859274858 50096.18362021608 ... 50404.96353689801 50406.6885643655 50408.413591833] [50166.90974638345 50166.90974638345 50168.63477385094 ... 50456.71436092291 50458.439388390405 50460.1644158579] ... [57432.72543947995 57436.17549441494 57441.35057681744 ... 57515.5267579198 57512.0767029848 57506.90162058231] [57444.80063175243 57448.25068668742 57451.700741622415 ... 57503.451565647316 57500.001510712325 57496.55145577733] [57453.42576908991 57455.150796557406 57458.6008514924 ... 57491.37637337484 57487.926318439844 57484.476263504854]] [[12476.784609045964 12471.609526643471 12468.15947170848 ... 13203.021172862114 13203.021172862114 13204.74620032961] [12471.609526643471 12468.15947170848 12464.70941677349 ... 13225.446529939574 13227.17155740707 13227.17155740707] [12473.334554110974 12469.884499175976 12466.434444240986 ... 13242.696804614541 13244.421832082036 13246.146859549539] ... [14867.672678996525 14865.94765152903 14864.222624061527 ... 14717.595289324301 14717.595289324301 14717.595289324301] [14859.047541659042 14857.322514191546 14855.597486724044 ... 14696.894959714344 14696.894959714344 14696.894959714344] [14848.697376854056 14848.697376854056 14846.97234938656 ... 14677.919657571874 14677.919657571874 14677.919657571874]]] [[[115178.01991393518 115183.19499633767 115186.64505127266 ... 115281.52156198499 115279.79653451749 115278.07150704999] [115217.6955456876 115222.87062809008 115228.04571049259 ... 115340.17249587987 115338.44746841237 115336.72244094488] [115260.82123237502 115265.99631477751 115271.17139718 ... 115402.27348470976 115400.54845724226 115400.54845724226] ... [121929.77742171763 121929.77742171763 121929.77742171763 ... 121859.05129555026 121859.05129555026 121859.05129555026] [121900.4519547702 121900.4519547702 121900.4519547702 ... 121881.47665262772 121881.47665262772 121883.20168009523] [121872.85151529024 121872.85151529024 121871.12648782274 ... 121900.4519547702 121900.4519547702 121900.4519547702]] [[53848.11836202161 53848.11836202161 53848.11836202161 ... 53808.442730269184 53808.442730269184 53810.16775773668] [53886.06896630654 53886.06896630654 53886.06896630654 ... 53861.91858176158 53861.91858176158 53863.64360922908] [53922.29454312397 53922.29454312397 53924.01957059147 ... 53917.11946072148 53917.11946072148 53918.84448818897] ... [57644.903817982056 57643.17879051456 57643.17879051456 ... 57548.302279802236 57550.02730726973 57551.752334737226] [57625.928515839594 57622.4784609046 57622.4784609046 ... 57537.95211499726 57539.67714246475 57539.67714246475] [57606.953213697125 57606.953213697125 57605.22818622963 ... 57527.60195019227 57527.60195019227 57529.32697765977]] [[13748.129852591104 13746.404825123609 13744.679797656107 ... 13682.578808826227 13684.303836293722 13686.028863761218] [13760.205044863578 13760.205044863578 13758.480017396083 ... 13703.279138436184 13705.004165903687 13708.454220838677] [13775.73029207105 13774.005264603555 13774.005264603555 ... 13723.97946804615 13725.704495513644 13729.154550448642] ... [14934.948750228898 14929.773667826412 14924.598585423919 ... 14803.846662699143 14803.846662699143 14805.571690166638] [14933.223722761402 14928.04864035891 14922.873557956424 ... 14784.87136055668 14784.87136055668 14786.596388024176] [14934.948750228898 14929.773667826412 14924.598585423919 ... 14767.621085881707 14767.621085881707 14767.621085881707]]]]
Units meter2/second2 - u(month, level, latitude, longitude)float64[m/s] 9.438 9.406 ... -7.89 -7.953
- number_of_significant_digits :
- 2
- long_name :
- U component of wind
- standard_name :
- eastward_wind
Magnitude [[[[9.437808055606421 9.40635395684551 9.469262154367332 ... 8.250415827382042 8.311751319965818 8.437567715009461] [10.09362601477141 10.062171916010499 10.12508011353232 ... 8.311751319965818 8.37465951748764 8.500475912531282] [10.688108481352621 10.688108481352621 10.717989875175487 ... 8.343205418726729 8.40611361624855 8.531930011292193] ... [26.874387703717268 26.43717573094061 26.125780153207593 ... 2.9220914972837697 3.180015107123239 3.46152929103339] [25.375599897759873 24.93681522004517 24.625419642312153 ... 2.1561841924555942 2.4219713269852896 2.7113490355856698] [23.938147584386254 23.438027414087774 23.125059131416712 ... 1.4610486098394695 1.7346992690593908 2.0398040270402262]] [[5.68690677836782 5.671179728987365 5.68690677836782 ... 4.656785043947995 4.656785043947995 4.688239142708905] [6.047056209180248 6.0313291597997924 6.047056209180248 ... 4.562422747665263 4.562422747665263 4.593876846426173] [6.312843343709943 6.297116294329488 6.312843343709943 ... 4.406724958798755 4.406724958798755 4.438179057559665] ... [4.233727415613746 4.093756676127693 3.9915308551547355 ... -5.875619926142953 -5.734076481718851 -5.625559840993709] [3.0856528108405072 2.929955021973999 2.772684528169446 ... -6.578619033449307 -6.421348539644754 -6.297104849539153] [1.9533052554477202 1.750426318439846 1.5632744308124273 ... -7.14007469633156 -6.984376907465055 -6.8444061679790025]] [[-0.3900251022401271 -0.32868960965635097 -0.2893719862052109 ... 1.976895829518405 1.9847593542086308 2.0083499282793156] [-0.04717542574620026 0.015732771775621046 0.03932334584630581 ... 1.6246099233962035 1.632473448086433 1.6403369727766588] [0.3208375297564565 0.33656457913691185 0.3287010544466824 ... 1.2345790987609107 1.2345790987609107 1.24244262345114] ... [-4.656773599157663 -4.656773599157663 -4.656773599157663 ... -8.750524552890191 -8.68761635536837 -8.68761635536837] [-4.578138352255387 -4.625319500396753 -4.609592451016297 ... -8.874768242995785 -8.811860045473964 -8.843314144234874] [-4.438167612769334 -4.453894662149789 -4.390986464627968 ... -8.969130539278517 -8.906222341756695 -8.937676440517606]]] [[[3.2649411737776965 3.296395272538607 3.343576420679973 ... 4.7967557834340475 4.781028734053592 4.781028734053592] [3.3514399453702026 3.3828940441311133 3.437938716962705 ... 4.999634720441922 4.983907671061466 4.983907671061466] [3.390757568821339 3.4300751922724793 3.485119865104071 ... 5.18678660806934 5.156905214246475 5.156905214246475] ... [-11.531066883354697 -11.562520982115608 -11.686764672221202 ... 8.561811405115058 8.561811405115058 8.593265503875969] [-12.094095251174998 -12.15700344869682 -12.281247138802414 ... 7.140086141121895 7.124359091741439 7.124359091741439] [-12.655550914057251 -12.718459111579072 -12.875729605383626 ... 5.68690677836782 5.657025384544955 5.625571285784044]] [[2.9928632194958205 3.0007267441860463 3.022744613318686 ... 4.125210774888604 4.125210774888604 4.140937824269059] [2.8749103491424037 2.882773873832633 2.914227972593544 ... 4.218000366233291 4.203846021790881 4.233727415613746] [2.7506666590368063 2.7663937084172616 2.8041386269303565 ... 4.312362662516023 4.296635613135567 4.312362662516023] ... [-9.343434314533354 -9.311980215772444 -9.343434314533354 ... -4.625319500396753 -4.656773599157663 -4.733836141121895] [-8.750524552890191 -8.750524552890191 -8.781978651651102 ... -5.172620818836599 -5.202502212659461 -5.281137459561741] [-8.124587987548068 -8.156042086308979 -8.18749618506989 ... -5.67116828419703 -5.7183494323384 -5.796984679240673]] [[1.155943851858634 1.1873979506195447 1.2188520493804553 ... 1.7740168925105309 1.7818804172007567 1.8054709912714415] [1.0851721296465868 1.1244897530977234 1.1480803271684081 ... 1.6560640221571141 1.6560640221571141 1.6639275468473436] [1.1244897530977234 1.1402168024781787 1.155943851858634 ... 1.5082297579808355 1.5160932826710614 1.5318203320515167] ... [0.05505039522676114 0.07864096929744235 0.1557035112616738 ... -8.18749618506989 -8.18749618506989 -8.25040438259171] [0.4136271211011433 0.5315799914545565 0.5866246642861519 ... -8.063252494964289 -8.063252494964289 -8.156042086308979] [1.0710177852041767 1.155943851858634 1.0788813098944026 ... -7.858800853018373 -7.8902549517792835 -7.953163149301105]]]]
Units meter/second - v(month, level, latitude, longitude)float64[m/s] 1.211 1.078 ... -0.258 -0.289
- number_of_significant_digits :
- 2
- long_name :
- V component of wind
- standard_name :
- northward_wind
Magnitude [[[[1.210864539461637 1.0780305804797656 0.9533195614356345 ... 3.4375057223951657 3.3204398232924373 3.2110190441311115] [1.22663259934078 1.086153520417506 0.9533195614356345 ... 3.66399240065922 3.5392813816150888 3.429860602453763] [1.2342777192821828 1.086153520417506 0.9451966214978942 ... 3.8828339589818714 3.765768059879143 3.6563472807178172] ... [3.4064474226332173 3.468564022157114 3.570339681377037 ... -1.5781707791613258 -1.7501859778428859 -1.9217233565281084] [3.0390038454495514 3.1173663248489287 3.2267871040102545 ... -1.1017842428126716 -1.2656765015564915 -1.4295687603003113] [2.7188644479033144 2.796749107306354 2.921937946346823 ... -0.6330428264054203 -0.7811670252700971 -0.9531822239516572]] [[1.0154361609595313 0.9533195614356345 0.8983702618568028 ... 0.8673119620948544 0.7813043627540743 0.702941883354697] [0.9299063816150888 0.8749570820362571 0.820485602453763 ... 0.8983702618568028 0.8123626625160227 0.734478003112983] [0.8515439022157114 0.7970724226332173 0.7421231230543857 ... 0.9141383217359458 0.8281307223951657 0.7421231230543857] ... [2.14834737227614 2.1172890725141915 2.093875892693646 ... -2.2342176341329427 -2.2733988738326314 -2.328348173411463] [2.0155134132942685 1.9610419337117744 1.9218606940120857 ... -2.156332974729903 -2.1873912744918513 -2.2342176341329427] [1.8358530946713056 1.7656135552096686 1.7187871955685772 ... -2.06268025544772 -2.086093435268266 -2.1329197949093572]] [[-1.4376917002380516 -1.452981940120857 -1.46875 ... 0.6174121040102545 0.5624628044314228 0.5156364447903314] [-1.3125028611975829 -1.3125028611975829 -1.3048577412561801 ... 0.6250572239516572 0.5782308643105658 0.5314045046694744] [-1.1562557223951657 -1.1017842428126716 -1.0702481230543857 ... 0.6092891640725142 0.5548176844900201 0.49986838491118846] ... [-1.13284254257462 -1.1873140221571141 -1.2814445614356345 ... -1.5079312396996887 -1.484518059879143 -1.4998082997619484] [-1.4453368201794543 -1.5313444195202344 -1.5781707791613258 ... -1.5155763596410914 -1.4998082997619484 -1.4998082997619484] [-1.7420630379051456 -1.7970123374839773 -1.820425517304523 ... -1.5155763596410914 -1.4998082997619484 -1.4998082997619484]]] [[[2.164115432155283 2.1717605520966856 2.2032966718549716 ... -0.6641011261673686 -0.6483330662882256 -0.6406879463468229] [2.2420000915583227 2.2577681514374657 2.2811813312580114 ... -0.6641011261673686 -0.6483330662882256 -0.6330428264054203] [2.3280076908991028 2.336130630836843 2.3671889305987914 ... -0.6798691860465116 -0.6641011261673686 -0.6483330662882256] ... [-0.24218606940120857 -0.29665754898370267 -0.31242560886284565 ... 2.429783350119026 2.5310811893426113 2.6252117286211316] [-0.5704484068851858 -0.5938615867057315 -0.5780935268265885 ... 2.3595438106573887 2.4374284700604285 2.500022889580663] [-0.8829426844900201 -0.8748197445522798 -0.8595295046694744 ... 2.23435497161692 2.288826451199414 2.3437757507782457]] [[0.24232340688518583 0.2891497665262772 0.3359761261673686 ... 0.5466947445522798 0.5624628044314228 0.5858759842519685] [0.3125629463468229 0.367034425929317 0.4296288454495514 ... 0.5314045046694744 0.5548176844900201 0.5782308643105658] [0.398570545687603 0.46881008514924005 0.5314045046694744 ... 0.5079913248489287 0.5314045046694744 0.5548176844900201] ... [-0.6798691860465116 -0.7577538454495514 -0.8279933849111885 ... 0.5782308643105658 0.5858759842519685 0.5858759842519685] [-0.7185726057498627 -0.79693508514924 -0.8671746246108771 ... 0.5314045046694744 0.5314045046694744 0.5314045046694744] [-0.7653989653909541 -0.8279933849111885 -0.8905878044314228 ... 0.48457814502838303 0.48457814502838303 0.48457814502838303]] [[-0.26559924922175426 -0.26559924922175426 -0.273244369163157 ... 0.9533195614356345 0.9609646813770372 0.9686098013184399] [-0.09358405054019414 -0.11699723036073983 -0.13276529023988282 ... 0.9375515015564915 0.9451966214978942 0.9533195614356345] [0.04689502838308002 0.04689502838308002 0.039249908441677306 ... 0.9141383217359458 0.9217834416773485 0.9375515015564915] ... [-0.7653989653909541 -0.4920859274858085 -0.1719465299395715 ... -0.18771458981871447 -0.2030048297015199 -0.24218606940120857] [-0.38266514832448273 -0.2030048297015199 -0.00757645119941408 ... -0.23454094945980586 -0.24983118934261128 -0.28136730910089724] [-0.07017087071964845 -0.01569939113715435 0.031126968503937036 ... -0.23454094945980586 -0.25795412928035155 -0.28901242904229996]]]]
Units meter/second - windspeed(month, level, latitude, longitude)float64[m/s] 9.515 9.468 ... 7.894 7.958
- number_of_significant_digits :
- 2
- long_name :
- U component of wind
- standard_name :
- eastward_wind
Magnitude [[[[9.515167566963553 9.467927159305395 9.517128975397426 ... 8.937886042919523 8.950448627027576 9.027911843119796] [10.167886390978003 10.120624147613908 10.169860642686482 ... 9.083504297188504 9.0918334087297 9.16635339116865] [10.759140504588565 10.74315560620236 10.759586591391663 ... 9.202471201372699 9.211066996286869 9.28238682423874] ... [27.089418570594578 26.663743116907607 26.36861228912419 ... 3.3210302206840527 3.6298274116781206 3.9591925555228786] [25.556928894995345 25.130911764637162 24.835930575973595 ... 2.4213753921078975 2.7327425995382666 3.0651395454690005] [24.092055405422137 23.6042990709902 23.308927070841783 ... 1.5922959085475317 1.9024729894126007 2.2515232223512487]] [[5.776852023622389 5.750747577897419 5.757428057147959 ... 4.736863623235374 4.7218728755438 4.740644845440563] [6.118138170681817 6.094463169899107 6.102465519838625 ... 4.650029081178107 4.634181095281406 4.652221234763811] [6.370017119256721 6.347361504690932 6.356314798056727 ... 4.500541493394556 4.483862771748777 4.499797781760108] ... [4.747614586472373 4.608878034828874 4.507397788264966 ... 6.286066970145858 6.168304105485131 6.0883601027887355] [3.6855864646236474 3.525666163516715 3.3736223884630063 ... 6.923005148428608 6.783686140684937 6.681710703312447] [2.6806264204797157 2.486238830568576 2.3233717674281946 ... 7.432046589292083 7.289259674768109 7.169047540907034]] [[1.4896566736368488 1.4896957333003993 1.496984538631027 ... 2.0710661087820523 2.0629188303196813 2.0734874915502974] [1.3133504031469199 1.3125971509795324 1.3054501332661959 ... 1.740705011313396 1.7318546391509166 1.7242668389321598] [1.1999433386922034 1.1520435033625678 1.1195871686009073 ... 1.3767421096754053 1.353516979620193 1.3392281638323889] ... [4.792585166700613 4.805752276285443 4.829869617064707 ... 8.87950091921817 8.813539119341975 8.816127430686265] [4.800869639571369 4.87222702795613 4.872264932520101 ... 9.003248473122879 8.938585033273176 8.969594750581512] [4.767820821619658 4.802752440277972 4.753389442976397 ... 9.096278048329518 9.031623405392905 9.062642279788951]]] [[[3.917044354091683 3.9475011954980053 4.004250180137887 ... 4.842509303210965 4.824787199523808 4.823765831841364] [4.032209582594952 4.067122956029619 4.12591939907595 ... 5.043548120482756 5.025900062526913 5.023950526600426] [4.113010661231572 4.15005086101089 4.213032625946833 ... 5.23115450238119 5.199490522589617 5.197500086923056] ... [11.533609910197736 11.566326001078851 11.690940007756042 ... 8.899913576281172 8.928100947222893 8.985318505216977] [12.107541093443023 12.171499678995643 12.294845400008137 ... 7.519858848213345 7.529777554133989 7.550271976326823] [12.686313756264653 12.748510177992063 12.904386999790022 ... 6.110094176445656 6.102512820559749 6.09428724801958]] [[3.0026573038119637 3.0146257778960877 3.041359063757774 ... 4.161278539220623 4.163379437863656 4.182178467424051] [2.8918515022447306 2.9060453330031293 2.9457266711439796 ... 4.251343062742312 4.240299993862449 4.273031565780997] [2.7793930180934145 2.8058362471655838 2.854046983955568 ... 4.342179973145292 4.329372742054888 4.347906898277049] ... [9.368136789145156 9.342760107657211 9.380049991095786 ... 4.661322925221102 4.693483889685255 4.769953383411105] [8.779978732347148 8.78673918360366 8.824689278814564 ... 5.199845851854151 5.229571686123979 5.307805913404262] [8.160561594867838 8.197962890810132 8.235790212112981 ... 5.691833244774608 5.738844501200921 5.817202708346189]] [[1.1860645639411604 1.2167402575417048 1.2491048008707306 ... 2.0139399497325017 2.024487821661966 2.048885171875874] [1.0891999474280276 1.1305598421728338 1.155731396096688 ... 1.903037273296041 1.9068153289645624 1.9176738688768873] [1.1254671690053109 1.1411807483219352 1.156610022420027 ... 1.7636342801513984 1.774323407699637 1.795961120892446] ... [0.7673761282683776 0.49833017376194433 0.23196808525630017 ... 8.189647767014453 8.190012499466416 8.25395823641606] [0.5634891401372508 0.5690239434303002 0.5866735884302424 ... 8.066662894563112 8.067121941604464 8.160893950804287] [1.073314048785915 1.1560504571738437 1.0793302409400503 ... 7.862299937319602 7.89447044056093 7.958412672357597]]]]
Units meter/second
- longitudePintIndex(PandasIndex, units={'longitude': 'degrees_east'})
<PintIndex (units={'longitude': 'degrees_east'})> PandasIndex(Index([ -9.75, -9.0, -8.25, -7.5, -6.75, -6.0, -5.25, -4.5, -3.75, -3.0, ... 172.5, 173.25, 174.0, 174.75, 175.5, 176.25, 177.0, 177.75, 178.5, 179.25], dtype='float32', name='longitude', length=253)) - latitudePintIndex(PandasIndex, units={'latitude': 'degrees_north'})
<PintIndex (units={'latitude': 'degrees_north'})> PandasIndex(Index([ 79.5, 78.75, 78.0, 77.25, 76.5, 75.75, 75.0, 74.25, 73.5, 72.75, 72.0, 71.25, 70.5, 69.75, 69.0, 68.25, 67.5, 66.75, 66.0, 65.25, 64.5, 63.75, 63.0, 62.25, 61.5, 60.75, 60.0, 59.25, 58.5, 57.75, 57.0, 56.25, 55.5, 54.75, 54.0, 53.25, 52.5, 51.75, 51.0, 50.25, 49.5, 48.75, 48.0, 47.25, 46.5, 45.75, 45.0, 44.25, 43.5, 42.75, 42.0, 41.25, 40.5, 39.75, 39.0, 38.25, 37.5, 36.75, 36.0, 35.25, 34.5, 33.75, 33.0, 32.25, 31.5, 30.75, 30.0, 29.25, 28.5, 27.75, 27.0, 26.25, 25.5, 24.75, 24.0, 23.25, 22.5, 21.75, 21.0, 20.25, 19.5, 18.75, 18.0, 17.25, 16.5, 15.75, 15.0, 14.25, 13.5, 12.75, 12.0, 11.25, 10.5], dtype='float32', name='latitude')) - levelPintIndex(PandasIndex, units={'level': 'mbar'})
<PintIndex (units={'level': 'mbar'})> PandasIndex(Index([200, 500, 850], dtype='int32', name='level')) - monthPintIndex(PandasIndex, units={'month': 'month'})
<PintIndex (units={'month': 'month'})> PandasIndex(Index([1, 7], dtype='int32', name='month'))
- Conventions :
- CF-1.0
- Info :
- Monthly ERA-Interim data. Downloaded and edited by fabien.maussion@uibk.ac.at
or raise on incompatible units:
quantified.sel(month=ureg.Quantity(10, "m"))
+ Exception Group Traceback (most recent call last):
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/IPython/core/interactiveshell.py", line 3701, in run_code
| exec(code_obj, self.user_global_ns, self.user_ns)
| ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/tmp/ipykernel_735/1181962863.py", line 1, in <module>
| quantified.sel(month=ureg.Quantity(10, "m"))
| ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/xarray/core/dataset.py", line 3001, in sel
| query_results = map_index_queries(
| self, indexers=indexers, method=method, tolerance=tolerance
| )
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/xarray/core/indexing.py", line 214, in map_index_queries
| results.append(index.sel(labels, **options))
| ~~~~~~~~~^^^^^^^^^^^^^^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint_xarray/index.py", line 63, in sel
| converted_labels = conversion.convert_indexer_units(labels, self.units)
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint_xarray/conversion.py", line 485, in convert_indexer_units
| raise create_exception_group(invalid, "convert_indexers")
| pint_xarray.errors.PintExceptionGroup: Cannot convert indexers (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint_xarray/conversion.py", line 480, in convert_indexer_units
| converted[name] = convert(indexer, indexer_units)
| ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint_xarray/conversion.py", line 473, in convert
| return array_convert_units(indexer, units)
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint_xarray/conversion.py", line 89, in array_convert_units
| return data.to(unit)
| ~~~~~~~^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint/facets/plain/quantity.py", line 537, in to
| magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint/facets/plain/quantity.py", line 480, in _convert_magnitude_not_inplace
| return self._REGISTRY.convert(self._magnitude, self._units, other, **ctx_kwargs)
| ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint/facets/plain/registry.py", line 1115, in convert
| return self._convert(value, src, dst, inplace, **ctx_kwargs)
| ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint/facets/context/registry.py", line 410, in _convert
| return super()._convert(value, src, dst, inplace, **ctx_kwargs)
| ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint/facets/nonmultiplicative/registry.py", line 264, in _convert
| return super()._convert(value, src, dst, inplace)
| ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/docs/checkouts/readthedocs.org/user_builds/xarray-indexes/envs/39/lib/python3.13/site-packages/pint/facets/plain/registry.py", line 1150, in _convert
| raise factor
| pint.errors.DimensionalityError: Cannot convert from 'meter' ([length]) to 'month' ([time])
| incompatible units for indexer for 'month'
+------------------------------------
Numerical operations#
We can also perform numerical operations, like integration:
quantified["windspeed"].integrate("month")
<xarray.DataArray 'windspeed' (level: 3, latitude: 241, longitude: 480)> Size: 3MB
[m·month/s] 7.107 7.108 7.11 7.09 7.071 7.101 ... 25.59 25.57 25.6 25.56 25.6
Coordinates:
* level (level) int32 12B [mbar] 200 500 850
* latitude (latitude) float32 964B [degrees_north] 90.0 89.25 ... -90.0
* longitude (longitude) float32 2kB [degrees_east] -180.0 -179.2 ... 179.2
Indexes:
longitude PintIndex(PandasIndex, units={'longitude': 'degrees_east'})
latitude PintIndex(PandasIndex, units={'latitude': 'degrees_north'})
level PintIndex(PandasIndex, units={'level': 'mbar'})- level: 3
- latitude: 241
- longitude: 480
- [m·month/s] 7.107 7.108 7.11 7.09 7.071 ... 25.57 25.6 25.56 25.6
Magnitude [[[7.106655907377615 7.107987218353831 7.110496246341027 ... 7.110310613475005 7.083242217325713 7.106102069186607] [9.418765870305108 9.442951642748277 9.420962614113783 ... 9.441772697134002 9.413337755493986 9.467317038549751] [12.479442183911132 12.501234313653107 12.459970532573983 ... 12.516205088438099 12.4826989627163 12.50586381908489] ... [9.792044437833907 9.883913486740338 9.924219467667085 ... 9.656639943107384 9.68145321262169 9.758614693761025] [9.40466243303656 9.45409092461463 9.453499176043348 ... 9.365270409177258 9.378430650827816 9.406632412283898] [8.773466018884964 8.797578723286119 8.779322205600604 ... 8.795205214774487 8.76926606861945 8.793249742374053]] [[7.797599352104047 7.813873964415079 7.808968887028341 ... 7.801013016404987 7.821346784858675 7.816611405829383] [8.104884410592906 8.160979718113305 8.137280550421618 ... 8.043333860287754 8.040731787583518 8.104074013504446] [10.399122691612849 10.438355676031172 10.449534066626027 ... 10.327643130454817 10.309449118045151 10.392218496790807] ... [23.9601377340506 23.967535805614013 23.871833967916743 ... 24.176126138810645 24.05263159935299 24.08291690082292] [20.89617519374536 20.90966499531735 20.835787282716183 ... 20.99715734003985 20.936764857322352 20.956890909693982] [17.60892629406481 17.645263734406807 17.58511944807897 ... 17.644977923771915 17.604420587510937 17.635172585366544]] [[11.396041924196055 11.409231938422813 11.384695641261487 ... 11.431907242296223 11.395980689064086 11.405597673400482] [11.360333880520084 11.382837313938982 11.361223375413946 ... 11.3567177137842 11.349004516117645 11.390019301024958] [11.830813591044954 11.858872227178153 11.869451394741276 ... 11.797797133197268 11.750857815957495 11.82841234817235] ... [29.357205546814804 29.492122383935005 29.48785670954319 ... 29.296828926545082 29.253503791820293 29.352981549400166] [21.804690222662796 21.908211152925553 21.903421438823656 ... 21.713201324679865 21.72849414984814 21.81418797826174] [25.55805510475148 25.613997624393505 25.554761188282466 ... 25.595828155889325 25.5562169586347 25.60217638652223]]]
Units meter month/second - level(level)int32[mbar] 200 500 850
- long_name :
- pressure_level
Magnitude [200 500 850]
Units millibar - latitude(latitude)float32[degrees_north] 90.0 ... -90.0
- long_name :
- latitude
Magnitude [90.0 89.25 88.5 87.75 87.0 86.25 85.5 84.75 84.0 83.25 82.5 81.75 81.0 80.25 79.5 78.75 78.0 77.25 76.5 75.75 75.0 74.25 73.5 72.75 72.0 71.25 70.5 69.75 69.0 68.25 67.5 66.75 66.0 65.25 64.5 63.75 63.0 62.25 61.5 60.75 60.0 59.25 58.5 57.75 57.0 56.25 55.5 54.75 54.0 53.25 52.5 51.75 51.0 50.25 49.5 48.75 48.0 47.25 46.5 45.75 45.0 44.25 43.5 42.75 42.0 41.25 40.5 39.75 39.0 38.25 37.5 36.75 36.0 35.25 34.5 33.75 33.0 32.25 31.5 30.75 30.0 29.25 28.5 27.75 27.0 26.25 25.5 24.75 24.0 23.25 22.5 21.75 21.0 20.25 19.5 18.75 18.0 17.25 16.5 15.75 15.0 14.25 13.5 12.75 12.0 11.25 10.5 9.75 9.0 8.25 7.5 6.75 6.0 5.25 4.5 3.75 3.0 2.25 1.5 0.75 0.0 -0.75 -1.5 -2.25 -3.0 -3.75 -4.5 -5.25 -6.0 -6.75 -7.5 -8.25 -9.0 -9.75 -10.5 -11.25 -12.0 -12.75 -13.5 -14.25 -15.0 -15.75 -16.5 -17.25 -18.0 -18.75 -19.5 -20.25 -21.0 -21.75 -22.5 -23.25 -24.0 -24.75 -25.5 -26.25 -27.0 -27.75 -28.5 -29.25 -30.0 -30.75 -31.5 -32.25 -33.0 -33.75 -34.5 -35.25 -36.0 -36.75 -37.5 -38.25 -39.0 -39.75 -40.5 -41.25 -42.0 -42.75 -43.5 -44.25 -45.0 -45.75 -46.5 -47.25 -48.0 -48.75 -49.5 -50.25 -51.0 -51.75 -52.5 -53.25 -54.0 -54.75 -55.5 -56.25 -57.0 -57.75 -58.5 -59.25 -60.0 -60.75 -61.5 -62.25 -63.0 -63.75 -64.5 -65.25 -66.0 -66.75 -67.5 -68.25 -69.0 -69.75 -70.5 -71.25 -72.0 -72.75 -73.5 -74.25 -75.0 -75.75 -76.5 -77.25 -78.0 -78.75 -79.5 -80.25 -81.0 -81.75 -82.5 -83.25 -84.0 -84.75 -85.5 -86.25 -87.0 -87.75 -88.5 -89.25 -90.0]
Units degrees_north - longitude(longitude)float32[degrees_east] -180.0 ... 179.2
- long_name :
- longitude
Magnitude [-180.0 -179.25 -178.5 -177.75 -177.0 -176.25 -175.5 -174.75 -174.0 -173.25 -172.5 -171.75 -171.0 -170.25 -169.5 -168.75 -168.0 -167.25 -166.5 -165.75 -165.0 -164.25 -163.5 -162.75 -162.0 -161.25 -160.5 -159.75 -159.0 -158.25 -157.5 -156.75 -156.0 -155.25 -154.5 -153.75 -153.0 -152.25 -151.5 -150.75 -150.0 -149.25 -148.5 -147.75 -147.0 -146.25 -145.5 -144.75 -144.0 -143.25 -142.5 -141.75 -141.0 -140.25 -139.5 -138.75 -138.0 -137.25 -136.5 -135.75 -135.0 -134.25 -133.5 -132.75 -132.0 -131.25 -130.5 -129.75 -129.0 -128.25 -127.5 -126.75 -126.0 -125.25 -124.5 -123.75 -123.0 -122.25 -121.5 -120.75 -120.0 -119.25 -118.5 -117.75 -117.0 -116.25 -115.5 -114.75 -114.0 -113.25 -112.5 -111.75 -111.0 -110.25 -109.5 -108.75 -108.0 -107.25 -106.5 -105.75 -105.0 -104.25 -103.5 -102.75 -102.0 -101.25 -100.5 -99.75 -99.0 -98.25 -97.5 -96.75 -96.0 -95.25 -94.5 -93.75 -93.0 -92.25 -91.5 -90.75 -90.0 -89.25 -88.5 -87.75 -87.0 -86.25 -85.5 -84.75 -84.0 -83.25 -82.5 -81.75 -81.0 -80.25 -79.5 -78.75 -78.0 -77.25 -76.5 -75.75 -75.0 -74.25 -73.5 -72.75 -72.0 -71.25 -70.5 -69.75 -69.0 -68.25 -67.5 -66.75 -66.0 -65.25 -64.5 -63.75 -63.0 -62.25 -61.5 -60.75 -60.0 -59.25 -58.5 -57.75 -57.0 -56.25 -55.5 -54.75 -54.0 -53.25 -52.5 -51.75 -51.0 -50.25 -49.5 -48.75 -48.0 -47.25 -46.5 -45.75 -45.0 -44.25 -43.5 -42.75 -42.0 -41.25 -40.5 -39.75 -39.0 -38.25 -37.5 -36.75 -36.0 -35.25 -34.5 -33.75 -33.0 -32.25 -31.5 -30.75 -30.0 -29.25 -28.5 -27.75 -27.0 -26.25 -25.5 -24.75 -24.0 -23.25 -22.5 -21.75 -21.0 -20.25 -19.5 -18.75 -18.0 -17.25 -16.5 -15.75 -15.0 -14.25 -13.5 -12.75 -12.0 -11.25 -10.5 -9.75 -9.0 -8.25 -7.5 -6.75 -6.0 -5.25 -4.5 -3.75 -3.0 -2.25 -1.5 -0.75 0.0 0.75 1.5 2.25 3.0 3.75 4.5 5.25 6.0 6.75 7.5 8.25 9.0 9.75 10.5 11.25 12.0 12.75 13.5 14.25 15.0 15.75 16.5 17.25 18.0 18.75 19.5 20.25 21.0 21.75 22.5 23.25 24.0 24.75 25.5 26.25 27.0 27.75 28.5 29.25 30.0 30.75 31.5 32.25 33.0 33.75 34.5 35.25 36.0 36.75 37.5 38.25 39.0 39.75 40.5 41.25 42.0 42.75 43.5 44.25 45.0 45.75 46.5 47.25 48.0 48.75 49.5 50.25 51.0 51.75 52.5 53.25 54.0 54.75 55.5 56.25 57.0 57.75 58.5 59.25 60.0 60.75 61.5 62.25 63.0 63.75 64.5 65.25 66.0 66.75 67.5 68.25 69.0 69.75 70.5 71.25 72.0 72.75 73.5 74.25 75.0 75.75 76.5 77.25 78.0 78.75 79.5 80.25 81.0 81.75 82.5 83.25 84.0 84.75 85.5 86.25 87.0 87.75 88.5 89.25 90.0 90.75 91.5 92.25 93.0 93.75 94.5 95.25 96.0 96.75 97.5 98.25 99.0 99.75 100.5 101.25 102.0 102.75 103.5 104.25 105.0 105.75 106.5 107.25 108.0 108.75 109.5 110.25 111.0 111.75 112.5 113.25 114.0 114.75 115.5 116.25 117.0 117.75 118.5 119.25 120.0 120.75 121.5 122.25 123.0 123.75 124.5 125.25 126.0 126.75 127.5 128.25 129.0 129.75 130.5 131.25 132.0 132.75 133.5 134.25 135.0 135.75 136.5 137.25 138.0 138.75 139.5 140.25 141.0 141.75 142.5 143.25 144.0 144.75 145.5 146.25 147.0 147.75 148.5 149.25 150.0 150.75 151.5 152.25 153.0 153.75 154.5 155.25 156.0 156.75 157.5 158.25 159.0 159.75 160.5 161.25 162.0 162.75 163.5 164.25 165.0 165.75 166.5 167.25 168.0 168.75 169.5 170.25 171.0 171.75 172.5 173.25 174.0 174.75 175.5 176.25 177.0 177.75 178.5 179.25]
Units degrees_east
- longitudePintIndex(PandasIndex, units={'longitude': 'degrees_east'})
<PintIndex (units={'longitude': 'degrees_east'})> PandasIndex(Index([ -180.0, -179.25, -178.5, -177.75, -177.0, -176.25, -175.5, -174.75, -174.0, -173.25, ... 172.5, 173.25, 174.0, 174.75, 175.5, 176.25, 177.0, 177.75, 178.5, 179.25], dtype='float32', name='longitude', length=480)) - latitudePintIndex(PandasIndex, units={'latitude': 'degrees_north'})
<PintIndex (units={'latitude': 'degrees_north'})> PandasIndex(Index([ 90.0, 89.25, 88.5, 87.75, 87.0, 86.25, 85.5, 84.75, 84.0, 83.25, ... -83.25, -84.0, -84.75, -85.5, -86.25, -87.0, -87.75, -88.5, -89.25, -90.0], dtype='float32', name='latitude', length=241)) - levelPintIndex(PandasIndex, units={'level': 'mbar'})
<PintIndex (units={'level': 'mbar'})> PandasIndex(Index([200, 500, 850], dtype='int32', name='level'))
Note how the units are displayed as "meter * months / second" and not the expected "meter"? This is caused by pint trying avoid implicit conversions as much as possible, which can substantially reduce the amount of computations.