-
-
Save dcamron/f55df1d59a8972c320ea1773416ce029 to your computer and use it in GitHub Desktop.
This notebook is designed to briefly introduce and demonstrate interacting with GRIB files and the messages they contain using Python + pygrib (plus a little extra tip towards xarray at the end.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Working with GRIB in Python\n", | |
"A notebook in support of Unidata's users\n", | |
"\n", | |
"---\n", | |
"\n", | |
"[[1] - pygrib documentation](https://jswhit.github.io/pygrib/docs/pygrib-module.html)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import pygrib" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"I'll be working with GFS quarter-degree output [available from NOAA NCEP](https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl). Pygrib `open()` instances can generally be interacted with like other Python `open()` interfaces. So we can list some/all of our messages to get an idea of what our file looks like." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[1:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:hybrid:level 1:fcst time 0 hrs:from 202006261200,\n", | |
" 2:Ice water mixing ratio:kg kg**-1 (instant):regular_ll:hybrid:level 1:fcst time 0 hrs:from 202006261200,\n", | |
" 3:Rain mixing ratio:kg kg**-1 (instant):regular_ll:hybrid:level 1:fcst time 0 hrs:from 202006261200,\n", | |
" 4:Snow mixing ratio:kg kg**-1 (instant):regular_ll:hybrid:level 1:fcst time 0 hrs:from 202006261200,\n", | |
" 5:Graupel (snow pellets):kg kg**-1 (instant):regular_ll:hybrid:level 1:fcst time 0 hrs:from 202006261200]" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"infile = '../../Downloads/gfs.t12z.pgrb2.0p25.anl'\n", | |
"\n", | |
"grib = pygrib.open(infile)\n", | |
"\n", | |
"list(grib)[0:5]" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Now, we know we want to look for messages containing *Temperature* data, so we can use `pygrib.open.select()` as you've mentioned." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[7:Temperature:K (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 0 hrs:from 202006261200,\n", | |
" 12:Temperature:K (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 0 hrs:from 202006261200,\n", | |
" 17:Temperature:K (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 0 hrs:from 202006261200,\n", | |
" 22:Temperature:K (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 0 hrs:from 202006261200,\n", | |
" 27:Temperature:K (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 0 hrs:from 202006261200]" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"grib.select(name='Temperature')[0:5]" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This has provided us with a list of grib messages. If we want to find messages containing *Temperature* data at *1000 hPa* then we can specify that as well." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[337:Temperature:K (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 0 hrs:from 202006261200]" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"grib.select(name='Temperature', level=1000)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This has provided us with a list with our one message that satisfies our `select()` conditions. We can select this one message or select its specified key, *337*, from the original `pygrib.open()` instance. Either will give us our `pygrib.gribmessage()` [class (docs)](https://jswhit.github.io/pygrib/docs/pygrib.gribmessage-class.html) to pull our data and more from." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"337:Temperature:K (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 0 hrs:from 202006261200" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"message = grib.select(name='Temperature', level=1000)\n", | |
"message = grib[337]\n", | |
"\n", | |
"message" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This behaves like a dictionary, and we can see the available GRIB message keys with `gribmessage.keys()`. We will look at the first 5." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"['globalDomain',\n", | |
" 'GRIBEditionNumber',\n", | |
" 'tablesVersionLatest',\n", | |
" 'grib2divider',\n", | |
" 'is_efas']" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"message.keys()[0:5]" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Among these is the `values` key you previously mentioned. We can access the data values this way (the below two demonstrations are identical.)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"array([[272.7 , 272.7 , 272.7 , ..., 272.7 , 272.7 ,\n", | |
" 272.7 ],\n", | |
" [272.80002, 272.80002, 272.80002, ..., 272.80002, 272.80002,\n", | |
" 272.80002],\n", | |
" [273. , 273. , 273. , ..., 273. , 273. ,\n", | |
" 273. ],\n", | |
" ...,\n", | |
" [238.7 , 238.7 , 238.7 , ..., 238.6 , 238.6 ,\n", | |
" 238.6 ],\n", | |
" [238.8 , 238.8 , 238.8 , ..., 238.8 , 238.8 ,\n", | |
" 238.8 ],\n", | |
" [238. , 238. , 238. , ..., 238. , 238. ,\n", | |
" 238. ]], dtype=float32)" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"val = message['values']\n", | |
"val = message.values\n", | |
"\n", | |
"val" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"But what does this look like? Where do we go from here? We can inspect the shape." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(721, 1440)" | |
] | |
}, | |
"execution_count": 8, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"val.shape" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This has a shape that looks physically two-dimensional. Let's take a look at the corresponding latitudes and longitudes and see if they look the same. We can use [`pygrib.gribmessage.latlons()` ](https://jswhit.github.io/pygrib/docs/pygrib.gribmessage-class.html#latlons) which will give us first our latitudes, then our longitudes." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"lats, lons = message.latlons()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(array([[ 90. , 90. , 90. , ..., 90. , 90. , 90. ],\n", | |
" [ 89.75, 89.75, 89.75, ..., 89.75, 89.75, 89.75],\n", | |
" [ 89.5 , 89.5 , 89.5 , ..., 89.5 , 89.5 , 89.5 ],\n", | |
" ...,\n", | |
" [-89.5 , -89.5 , -89.5 , ..., -89.5 , -89.5 , -89.5 ],\n", | |
" [-89.75, -89.75, -89.75, ..., -89.75, -89.75, -89.75],\n", | |
" [-90. , -90. , -90. , ..., -90. , -90. , -90. ]]),\n", | |
" array([[0.0000e+00, 2.5000e-01, 5.0000e-01, ..., 3.5925e+02, 3.5950e+02,\n", | |
" 3.5975e+02],\n", | |
" [0.0000e+00, 2.5000e-01, 5.0000e-01, ..., 3.5925e+02, 3.5950e+02,\n", | |
" 3.5975e+02],\n", | |
" [0.0000e+00, 2.5000e-01, 5.0000e-01, ..., 3.5925e+02, 3.5950e+02,\n", | |
" 3.5975e+02],\n", | |
" ...,\n", | |
" [0.0000e+00, 2.5000e-01, 5.0000e-01, ..., 3.5925e+02, 3.5950e+02,\n", | |
" 3.5975e+02],\n", | |
" [0.0000e+00, 2.5000e-01, 5.0000e-01, ..., 3.5925e+02, 3.5950e+02,\n", | |
" 3.5975e+02],\n", | |
" [0.0000e+00, 2.5000e-01, 5.0000e-01, ..., 3.5925e+02, 3.5950e+02,\n", | |
" 3.5975e+02]]))" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"lats, lons" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"((721, 1440), (721, 1440))" | |
] | |
}, | |
"execution_count": 11, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"lats.shape, lons.shape" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"And these arrays correspond in shape to our data values! So now for each point in our `721 x 1440` array we have our data and the corresponding latitude and longitude. Diving into GRIB files with pygrib generally looks the same as we've demonstrated here. From here we can use `matplotlib` or our favorite plotting packages to make maps of our data! There are other ways you can play around and subset the data using `select()` as well!" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"As a final heads-up, I will point out that we can read in our GRIB file in an arguably more user-friendly way [using xarray with cfgrib](http://xarray.pydata.org/en/stable/io.html?highlight=grib#grib-format-via-cfgrib) (must be installed separately.) Though in my case, I had to play around with the `backend_kwargs` for opening up the dataset to filter out messages on differing coordinate systems." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import xarray as xr" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"skipping variable: paramId==260131 shortName='o3mr'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([400, 350, 300, 250, 200, 150, 100, 70, 50, 30, 20, 10, 7,\n", | |
" 5, 3, 2, 1]))\n", | |
"skipping variable: paramId==157 shortName='r'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 10]))\n", | |
"skipping variable: paramId==3041 shortName='absv'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10]))\n", | |
"skipping variable: paramId==260018 shortName='clwmr'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50]))\n", | |
"skipping variable: paramId==260019 shortName='icmr'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50]))\n", | |
"skipping variable: paramId==260020 shortName='rwmr'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50]))\n", | |
"skipping variable: paramId==260021 shortName='snmr'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50]))\n", | |
"skipping variable: paramId==260028 shortName='grle'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50]))\n", | |
"skipping variable: paramId==135 shortName='w'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100]))\n", | |
"skipping variable: paramId==260238 shortName='wz'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100]))\n", | |
"skipping variable: paramId==260080 shortName='5wavh'\n", | |
"Traceback (most recent call last):\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 602, in build_dataset_components\n", | |
" dict_merge(variables, coord_vars)\n", | |
" File \"/Users/drewcamron/miniconda3/envs/labtest/lib/python3.8/site-packages/cfgrib/dataset.py\", line 536, in dict_merge\n", | |
" raise DatasetBuildError(\n", | |
"cfgrib.dataset.DatasetBuildError: key present and new value is different: key='isobaricInhPa' value=Variable(dimensions=('isobaricInhPa',), data=array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600,\n", | |
" 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 70,\n", | |
" 50, 30, 20, 10, 7, 5, 3, 2, 1])) new_value=Variable(dimensions=(), data=500)\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n", | |
"<defs>\n", | |
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n", | |
"<title>Show/Hide data repr</title>\n", | |
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n", | |
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", | |
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", | |
"</symbol>\n", | |
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n", | |
"<title>Show/Hide attributes</title>\n", | |
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n", | |
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", | |
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", | |
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", | |
"</symbol>\n", | |
"</defs>\n", | |
"</svg>\n", | |
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n", | |
" *\n", | |
" */\n", | |
"\n", | |
":root {\n", | |
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n", | |
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n", | |
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n", | |
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n", | |
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n", | |
" --xr-background-color: var(--jp-layout-color0, white);\n", | |
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n", | |
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n", | |
"}\n", | |
"\n", | |
".xr-wrap {\n", | |
" min-width: 300px;\n", | |
" max-width: 700px;\n", | |
"}\n", | |
"\n", | |
".xr-header {\n", | |
" padding-top: 6px;\n", | |
" padding-bottom: 6px;\n", | |
" margin-bottom: 4px;\n", | |
" border-bottom: solid 1px var(--xr-border-color);\n", | |
"}\n", | |
"\n", | |
".xr-header > div,\n", | |
".xr-header > ul {\n", | |
" display: inline;\n", | |
" margin-top: 0;\n", | |
" margin-bottom: 0;\n", | |
"}\n", | |
"\n", | |
".xr-obj-type,\n", | |
".xr-array-name {\n", | |
" margin-left: 2px;\n", | |
" margin-right: 10px;\n", | |
"}\n", | |
"\n", | |
".xr-obj-type {\n", | |
" color: var(--xr-font-color2);\n", | |
"}\n", | |
"\n", | |
".xr-sections {\n", | |
" padding-left: 0 !important;\n", | |
" display: grid;\n", | |
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n", | |
"}\n", | |
"\n", | |
".xr-section-item {\n", | |
" display: contents;\n", | |
"}\n", | |
"\n", | |
".xr-section-item input {\n", | |
" display: none;\n", | |
"}\n", | |
"\n", | |
".xr-section-item input + label {\n", | |
" color: var(--xr-disabled-color);\n", | |
"}\n", | |
"\n", | |
".xr-section-item input:enabled + label {\n", | |
" cursor: pointer;\n", | |
" color: var(--xr-font-color2);\n", | |
"}\n", | |
"\n", | |
".xr-section-item input:enabled + label:hover {\n", | |
" color: var(--xr-font-color0);\n", | |
"}\n", | |
"\n", | |
".xr-section-summary {\n", | |
" grid-column: 1;\n", | |
" color: var(--xr-font-color2);\n", | |
" font-weight: 500;\n", | |
"}\n", | |
"\n", | |
".xr-section-summary > span {\n", | |
" display: inline-block;\n", | |
" padding-left: 0.5em;\n", | |
"}\n", | |
"\n", | |
".xr-section-summary-in:disabled + label {\n", | |
" color: var(--xr-font-color2);\n", | |
"}\n", | |
"\n", | |
".xr-section-summary-in + label:before {\n", | |
" display: inline-block;\n", | |
" content: '►';\n", | |
" font-size: 11px;\n", | |
" width: 15px;\n", | |
" text-align: center;\n", | |
"}\n", | |
"\n", | |
".xr-section-summary-in:disabled + label:before {\n", | |
" color: var(--xr-disabled-color);\n", | |
"}\n", | |
"\n", | |
".xr-section-summary-in:checked + label:before {\n", | |
" content: '▼';\n", | |
"}\n", | |
"\n", | |
".xr-section-summary-in:checked + label > span {\n", | |
" display: none;\n", | |
"}\n", | |
"\n", | |
".xr-section-summary,\n", | |
".xr-section-inline-details {\n", | |
" padding-top: 4px;\n", | |
" padding-bottom: 4px;\n", | |
"}\n", | |
"\n", | |
".xr-section-inline-details {\n", | |
" grid-column: 2 / -1;\n", | |
"}\n", | |
"\n", | |
".xr-section-details {\n", | |
" display: none;\n", | |
" grid-column: 1 / -1;\n", | |
" margin-bottom: 5px;\n", | |
"}\n", | |
"\n", | |
".xr-section-summary-in:checked ~ .xr-section-details {\n", | |
" display: contents;\n", | |
"}\n", | |
"\n", | |
".xr-array-wrap {\n", | |
" grid-column: 1 / -1;\n", | |
" display: grid;\n", | |
" grid-template-columns: 20px auto;\n", | |
"}\n", | |
"\n", | |
".xr-array-wrap > label {\n", | |
" grid-column: 1;\n", | |
" vertical-align: top;\n", | |
"}\n", | |
"\n", | |
".xr-preview {\n", | |
" color: var(--xr-font-color3);\n", | |
"}\n", | |
"\n", | |
".xr-array-preview,\n", | |
".xr-array-data {\n", | |
" padding: 0 5px !important;\n", | |
" grid-column: 2;\n", | |
"}\n", | |
"\n", | |
".xr-array-data,\n", | |
".xr-array-in:checked ~ .xr-array-preview {\n", | |
" display: none;\n", | |
"}\n", | |
"\n", | |
".xr-array-in:checked ~ .xr-array-data,\n", | |
".xr-array-preview {\n", | |
" display: inline-block;\n", | |
"}\n", | |
"\n", | |
".xr-dim-list {\n", | |
" display: inline-block !important;\n", | |
" list-style: none;\n", | |
" padding: 0 !important;\n", | |
" margin: 0;\n", | |
"}\n", | |
"\n", | |
".xr-dim-list li {\n", | |
" display: inline-block;\n", | |
" padding: 0;\n", | |
" margin: 0;\n", | |
"}\n", | |
"\n", | |
".xr-dim-list:before {\n", | |
" content: '(';\n", | |
"}\n", | |
"\n", | |
".xr-dim-list:after {\n", | |
" content: ')';\n", | |
"}\n", | |
"\n", | |
".xr-dim-list li:not(:last-child):after {\n", | |
" content: ',';\n", | |
" padding-right: 5px;\n", | |
"}\n", | |
"\n", | |
".xr-has-index {\n", | |
" font-weight: bold;\n", | |
"}\n", | |
"\n", | |
".xr-var-list,\n", | |
".xr-var-item {\n", | |
" display: contents;\n", | |
"}\n", | |
"\n", | |
".xr-var-item > div,\n", | |
".xr-var-item label,\n", | |
".xr-var-item > .xr-var-name span {\n", | |
" background-color: var(--xr-background-color-row-even);\n", | |
" margin-bottom: 0;\n", | |
"}\n", | |
"\n", | |
".xr-var-item > .xr-var-name:hover span {\n", | |
" padding-right: 5px;\n", | |
"}\n", | |
"\n", | |
".xr-var-list > li:nth-child(odd) > div,\n", | |
".xr-var-list > li:nth-child(odd) > label,\n", | |
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n", | |
" background-color: var(--xr-background-color-row-odd);\n", | |
"}\n", | |
"\n", | |
".xr-var-name {\n", | |
" grid-column: 1;\n", | |
"}\n", | |
"\n", | |
".xr-var-dims {\n", | |
" grid-column: 2;\n", | |
"}\n", | |
"\n", | |
".xr-var-dtype {\n", | |
" grid-column: 3;\n", | |
" text-align: right;\n", | |
" color: var(--xr-font-color2);\n", | |
"}\n", | |
"\n", | |
".xr-var-preview {\n", | |
" grid-column: 4;\n", | |
"}\n", | |
"\n", | |
".xr-var-name,\n", | |
".xr-var-dims,\n", | |
".xr-var-dtype,\n", | |
".xr-preview,\n", | |
".xr-attrs dt {\n", | |
" white-space: nowrap;\n", | |
" overflow: hidden;\n", | |
" text-overflow: ellipsis;\n", | |
" padding-right: 10px;\n", | |
"}\n", | |
"\n", | |
".xr-var-name:hover,\n", | |
".xr-var-dims:hover,\n", | |
".xr-var-dtype:hover,\n", | |
".xr-attrs dt:hover {\n", | |
" overflow: visible;\n", | |
" width: auto;\n", | |
" z-index: 1;\n", | |
"}\n", | |
"\n", | |
".xr-var-attrs,\n", | |
".xr-var-data {\n", | |
" display: none;\n", | |
" background-color: var(--xr-background-color) !important;\n", | |
" padding-bottom: 5px !important;\n", | |
"}\n", | |
"\n", | |
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n", | |
".xr-var-data-in:checked ~ .xr-var-data {\n", | |
" display: block;\n", | |
"}\n", | |
"\n", | |
".xr-var-data > table {\n", | |
" float: right;\n", | |
"}\n", | |
"\n", | |
".xr-var-name span,\n", | |
".xr-var-data,\n", | |
".xr-attrs {\n", | |
" padding-left: 25px !important;\n", | |
"}\n", | |
"\n", | |
".xr-attrs,\n", | |
".xr-var-attrs,\n", | |
".xr-var-data {\n", | |
" grid-column: 1 / -1;\n", | |
"}\n", | |
"\n", | |
"dl.xr-attrs {\n", | |
" padding: 0;\n", | |
" margin: 0;\n", | |
" display: grid;\n", | |
" grid-template-columns: 125px auto;\n", | |
"}\n", | |
"\n", | |
".xr-attrs dt, dd {\n", | |
" padding: 0;\n", | |
" margin: 0;\n", | |
" float: left;\n", | |
" padding-right: 10px;\n", | |
" width: auto;\n", | |
"}\n", | |
"\n", | |
".xr-attrs dt {\n", | |
" font-weight: normal;\n", | |
" grid-column: 1;\n", | |
"}\n", | |
"\n", | |
".xr-attrs dt:hover span {\n", | |
" display: inline-block;\n", | |
" background: var(--xr-background-color);\n", | |
" padding-right: 10px;\n", | |
"}\n", | |
"\n", | |
".xr-attrs dd {\n", | |
" grid-column: 2;\n", | |
" white-space: pre-wrap;\n", | |
" word-break: break-all;\n", | |
"}\n", | |
"\n", | |
".xr-icon-database,\n", | |
".xr-icon-file-text2 {\n", | |
" display: inline-block;\n", | |
" vertical-align: middle;\n", | |
" width: 1em;\n", | |
" height: 1.5em !important;\n", | |
" stroke-width: 0;\n", | |
" stroke: currentColor;\n", | |
" fill: currentColor;\n", | |
"}\n", | |
"</style><div class='xr-wrap'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-d11a4c70-63ae-4a3a-8d84-5759dc39d964' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-d11a4c70-63ae-4a3a-8d84-5759dc39d964' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>isobaricInhPa</span>: 31</li><li><span class='xr-has-index'>latitude</span>: 721</li><li><span class='xr-has-index'>longitude</span>: 1440</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-464b2b99-fb55-484a-b0a4-e3e1b90c0219' class='xr-section-summary-in' type='checkbox' checked><label for='section-464b2b99-fb55-484a-b0a4-e3e1b90c0219' class='xr-section-summary' >Coordinates: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>time</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-7f43b43f-ff5d-4890-ab6e-b68ec1bc0931' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-7f43b43f-ff5d-4890-ab6e-b68ec1bc0931' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-59cb9470-09f5-43d0-b108-ddc992e9b3aa' class='xr-var-data-in' type='checkbox'><label for='data-59cb9470-09f5-43d0-b108-ddc992e9b3aa' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>initial time of forecast</dd><dt><span>standard_name :</span></dt><dd>forecast_reference_time</dd></dl></div><pre class='xr-var-data'>array('2020-06-26T12:00:00.000000000', dtype='datetime64[ns]')</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>step</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>timedelta64[ns]</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-2e72e203-fce8-477b-9a5f-f901bde52649' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-2e72e203-fce8-477b-9a5f-f901bde52649' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-154fde48-9ca0-427c-97ad-1ca0e186de3d' class='xr-var-data-in' type='checkbox'><label for='data-154fde48-9ca0-427c-97ad-1ca0e186de3d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>time since forecast_reference_time</dd><dt><span>standard_name :</span></dt><dd>forecast_period</dd></dl></div><pre class='xr-var-data'>array(0, dtype='timedelta64[ns]')</pre></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>isobaricInhPa</span></div><div class='xr-var-dims'>(isobaricInhPa)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1000 975 950 925 900 ... 7 5 3 2 1</div><input id='attrs-3d4b7ed5-9b35-42af-bc99-ad64cc726956' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-3d4b7ed5-9b35-42af-bc99-ad64cc726956' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9e7b7426-e167-4f0d-a8b2-1fa325f56ece' class='xr-var-data-in' type='checkbox'><label for='data-9e7b7426-e167-4f0d-a8b2-1fa325f56ece' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>pressure</dd><dt><span>units :</span></dt><dd>hPa</dd><dt><span>positive :</span></dt><dd>down</dd><dt><span>stored_direction :</span></dt><dd>decreasing</dd><dt><span>standard_name :</span></dt><dd>air_pressure</dd></dl></div><pre class='xr-var-data'>array([1000, 975, 950, 925, 900, 850, 800, 750, 700, 650, 600, 550,\n", | |
" 500, 450, 400, 350, 300, 250, 200, 150, 100, 70, 50, 30,\n", | |
" 20, 10, 7, 5, 3, 2, 1])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>latitude</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>90.0 89.75 89.5 ... -89.75 -90.0</div><input id='attrs-5b8a1a3b-7ce8-402d-8956-16c77b9f4cc3' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-5b8a1a3b-7ce8-402d-8956-16c77b9f4cc3' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d40d39f2-16f8-4c9c-be06-cac3290d8ab7' class='xr-var-data-in' type='checkbox'><label for='data-d40d39f2-16f8-4c9c-be06-cac3290d8ab7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>standard_name :</span></dt><dd>latitude</dd><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>stored_direction :</span></dt><dd>decreasing</dd></dl></div><pre class='xr-var-data'>array([ 90. , 89.75, 89.5 , ..., -89.5 , -89.75, -90. ])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>longitude</span></div><div class='xr-var-dims'>(longitude)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 0.25 0.5 ... 359.2 359.5 359.8</div><input id='attrs-a708d236-3a6e-4341-820b-bd2f0cb6cf85' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-a708d236-3a6e-4341-820b-bd2f0cb6cf85' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-50f85d4f-627a-47ca-a013-f7dc681830d9' class='xr-var-data-in' type='checkbox'><label for='data-50f85d4f-627a-47ca-a013-f7dc681830d9' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>units :</span></dt><dd>degrees_east</dd><dt><span>standard_name :</span></dt><dd>longitude</dd><dt><span>long_name :</span></dt><dd>longitude</dd></dl></div><pre class='xr-var-data'>array([0.0000e+00, 2.5000e-01, 5.0000e-01, ..., 3.5925e+02, 3.5950e+02,\n", | |
" 3.5975e+02])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>valid_time</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-c4ed85dc-a26d-4ae5-a115-beab09c57fd5' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-c4ed85dc-a26d-4ae5-a115-beab09c57fd5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ed49de08-582f-428e-9e28-819106ab745d' class='xr-var-data-in' type='checkbox'><label for='data-ed49de08-582f-428e-9e28-819106ab745d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>standard_name :</span></dt><dd>time</dd><dt><span>long_name :</span></dt><dd>time</dd></dl></div><pre class='xr-var-data'>array('2020-06-26T12:00:00.000000000', dtype='datetime64[ns]')</pre></li></ul></div></li><li class='xr-section-item'><input id='section-173d29e1-69c7-47aa-a840-04653e11a2bb' class='xr-section-summary-in' type='checkbox' checked><label for='section-173d29e1-69c7-47aa-a840-04653e11a2bb' class='xr-section-summary' >Data variables: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>gh</span></div><div class='xr-var-dims'>(isobaricInhPa, latitude, longitude)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-f7c0bb37-3f21-469b-98a6-49db27820382' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-f7c0bb37-3f21-469b-98a6-49db27820382' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4f949436-90c0-4f81-bbb7-3417491cddc0' class='xr-var-data-in' type='checkbox'><label for='data-4f949436-90c0-4f81-bbb7-3417491cddc0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>GRIB_paramId :</span></dt><dd>156</dd><dt><span>GRIB_shortName :</span></dt><dd>gh</dd><dt><span>GRIB_units :</span></dt><dd>gpm</dd><dt><span>GRIB_name :</span></dt><dd>Geopotential Height</dd><dt><span>GRIB_cfName :</span></dt><dd>geopotential_height</dd><dt><span>GRIB_cfVarName :</span></dt><dd>gh</dd><dt><span>GRIB_dataType :</span></dt><dd>an</dd><dt><span>GRIB_missingValue :</span></dt><dd>9999</dd><dt><span>GRIB_numberOfPoints :</span></dt><dd>1038240</dd><dt><span>GRIB_typeOfLevel :</span></dt><dd>isobaricInhPa</dd><dt><span>GRIB_NV :</span></dt><dd>0</dd><dt><span>GRIB_stepUnits :</span></dt><dd>1</dd><dt><span>GRIB_stepType :</span></dt><dd>instant</dd><dt><span>GRIB_gridType :</span></dt><dd>regular_ll</dd><dt><span>GRIB_gridDefinitionDescription :</span></dt><dd>Latitude/longitude. Also called equidistant cylindrical, or Plate Carree</dd><dt><span>GRIB_Nx :</span></dt><dd>1440</dd><dt><span>GRIB_iDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_iScansNegatively :</span></dt><dd>0</dd><dt><span>GRIB_longitudeOfFirstGridPointInDegrees :</span></dt><dd>0.0</dd><dt><span>GRIB_longitudeOfLastGridPointInDegrees :</span></dt><dd>359.75</dd><dt><span>GRIB_Ny :</span></dt><dd>721</dd><dt><span>GRIB_jDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_jPointsAreConsecutive :</span></dt><dd>0</dd><dt><span>GRIB_jScansPositively :</span></dt><dd>0</dd><dt><span>GRIB_latitudeOfFirstGridPointInDegrees :</span></dt><dd>90.0</dd><dt><span>GRIB_latitudeOfLastGridPointInDegrees :</span></dt><dd>-90.0</dd><dt><span>long_name :</span></dt><dd>Geopotential Height</dd><dt><span>units :</span></dt><dd>gpm</dd><dt><span>standard_name :</span></dt><dd>geopotential_height</dd></dl></div><pre class='xr-var-data'>[32185440 values with dtype=float32]</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>t</span></div><div class='xr-var-dims'>(isobaricInhPa, latitude, longitude)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-29299872-415f-46f9-9107-d61713fd6d91' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-29299872-415f-46f9-9107-d61713fd6d91' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-f40b50b7-fe63-4adc-a365-3138f44316bb' class='xr-var-data-in' type='checkbox'><label for='data-f40b50b7-fe63-4adc-a365-3138f44316bb' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>GRIB_paramId :</span></dt><dd>130</dd><dt><span>GRIB_shortName :</span></dt><dd>t</dd><dt><span>GRIB_units :</span></dt><dd>K</dd><dt><span>GRIB_name :</span></dt><dd>Temperature</dd><dt><span>GRIB_cfName :</span></dt><dd>air_temperature</dd><dt><span>GRIB_cfVarName :</span></dt><dd>t</dd><dt><span>GRIB_dataType :</span></dt><dd>an</dd><dt><span>GRIB_missingValue :</span></dt><dd>9999</dd><dt><span>GRIB_numberOfPoints :</span></dt><dd>1038240</dd><dt><span>GRIB_typeOfLevel :</span></dt><dd>isobaricInhPa</dd><dt><span>GRIB_NV :</span></dt><dd>0</dd><dt><span>GRIB_stepUnits :</span></dt><dd>1</dd><dt><span>GRIB_stepType :</span></dt><dd>instant</dd><dt><span>GRIB_gridType :</span></dt><dd>regular_ll</dd><dt><span>GRIB_gridDefinitionDescription :</span></dt><dd>Latitude/longitude. Also called equidistant cylindrical, or Plate Carree</dd><dt><span>GRIB_Nx :</span></dt><dd>1440</dd><dt><span>GRIB_iDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_iScansNegatively :</span></dt><dd>0</dd><dt><span>GRIB_longitudeOfFirstGridPointInDegrees :</span></dt><dd>0.0</dd><dt><span>GRIB_longitudeOfLastGridPointInDegrees :</span></dt><dd>359.75</dd><dt><span>GRIB_Ny :</span></dt><dd>721</dd><dt><span>GRIB_jDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_jPointsAreConsecutive :</span></dt><dd>0</dd><dt><span>GRIB_jScansPositively :</span></dt><dd>0</dd><dt><span>GRIB_latitudeOfFirstGridPointInDegrees :</span></dt><dd>90.0</dd><dt><span>GRIB_latitudeOfLastGridPointInDegrees :</span></dt><dd>-90.0</dd><dt><span>long_name :</span></dt><dd>Temperature</dd><dt><span>units :</span></dt><dd>K</dd><dt><span>standard_name :</span></dt><dd>air_temperature</dd></dl></div><pre class='xr-var-data'>[32185440 values with dtype=float32]</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>u</span></div><div class='xr-var-dims'>(isobaricInhPa, latitude, longitude)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-dbce9ef7-dec9-46b7-bbe4-567b62527dd8' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-dbce9ef7-dec9-46b7-bbe4-567b62527dd8' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-8d6b0662-1fed-48f7-9014-87d18d48ba91' class='xr-var-data-in' type='checkbox'><label for='data-8d6b0662-1fed-48f7-9014-87d18d48ba91' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>GRIB_paramId :</span></dt><dd>131</dd><dt><span>GRIB_shortName :</span></dt><dd>u</dd><dt><span>GRIB_units :</span></dt><dd>m s**-1</dd><dt><span>GRIB_name :</span></dt><dd>U component of wind</dd><dt><span>GRIB_cfName :</span></dt><dd>eastward_wind</dd><dt><span>GRIB_cfVarName :</span></dt><dd>u</dd><dt><span>GRIB_dataType :</span></dt><dd>an</dd><dt><span>GRIB_missingValue :</span></dt><dd>9999</dd><dt><span>GRIB_numberOfPoints :</span></dt><dd>1038240</dd><dt><span>GRIB_typeOfLevel :</span></dt><dd>isobaricInhPa</dd><dt><span>GRIB_NV :</span></dt><dd>0</dd><dt><span>GRIB_stepUnits :</span></dt><dd>1</dd><dt><span>GRIB_stepType :</span></dt><dd>instant</dd><dt><span>GRIB_gridType :</span></dt><dd>regular_ll</dd><dt><span>GRIB_gridDefinitionDescription :</span></dt><dd>Latitude/longitude. Also called equidistant cylindrical, or Plate Carree</dd><dt><span>GRIB_Nx :</span></dt><dd>1440</dd><dt><span>GRIB_iDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_iScansNegatively :</span></dt><dd>0</dd><dt><span>GRIB_longitudeOfFirstGridPointInDegrees :</span></dt><dd>0.0</dd><dt><span>GRIB_longitudeOfLastGridPointInDegrees :</span></dt><dd>359.75</dd><dt><span>GRIB_Ny :</span></dt><dd>721</dd><dt><span>GRIB_jDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_jPointsAreConsecutive :</span></dt><dd>0</dd><dt><span>GRIB_jScansPositively :</span></dt><dd>0</dd><dt><span>GRIB_latitudeOfFirstGridPointInDegrees :</span></dt><dd>90.0</dd><dt><span>GRIB_latitudeOfLastGridPointInDegrees :</span></dt><dd>-90.0</dd><dt><span>long_name :</span></dt><dd>U component of wind</dd><dt><span>units :</span></dt><dd>m s**-1</dd><dt><span>standard_name :</span></dt><dd>eastward_wind</dd></dl></div><pre class='xr-var-data'>[32185440 values with dtype=float32]</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>v</span></div><div class='xr-var-dims'>(isobaricInhPa, latitude, longitude)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-d2eb580d-bfeb-41c0-b50d-e0fed611e6f1' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-d2eb580d-bfeb-41c0-b50d-e0fed611e6f1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d9659b21-290d-4903-a69d-a0bd42855e37' class='xr-var-data-in' type='checkbox'><label for='data-d9659b21-290d-4903-a69d-a0bd42855e37' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>GRIB_paramId :</span></dt><dd>132</dd><dt><span>GRIB_shortName :</span></dt><dd>v</dd><dt><span>GRIB_units :</span></dt><dd>m s**-1</dd><dt><span>GRIB_name :</span></dt><dd>V component of wind</dd><dt><span>GRIB_cfName :</span></dt><dd>northward_wind</dd><dt><span>GRIB_cfVarName :</span></dt><dd>v</dd><dt><span>GRIB_dataType :</span></dt><dd>an</dd><dt><span>GRIB_missingValue :</span></dt><dd>9999</dd><dt><span>GRIB_numberOfPoints :</span></dt><dd>1038240</dd><dt><span>GRIB_typeOfLevel :</span></dt><dd>isobaricInhPa</dd><dt><span>GRIB_NV :</span></dt><dd>0</dd><dt><span>GRIB_stepUnits :</span></dt><dd>1</dd><dt><span>GRIB_stepType :</span></dt><dd>instant</dd><dt><span>GRIB_gridType :</span></dt><dd>regular_ll</dd><dt><span>GRIB_gridDefinitionDescription :</span></dt><dd>Latitude/longitude. Also called equidistant cylindrical, or Plate Carree</dd><dt><span>GRIB_Nx :</span></dt><dd>1440</dd><dt><span>GRIB_iDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_iScansNegatively :</span></dt><dd>0</dd><dt><span>GRIB_longitudeOfFirstGridPointInDegrees :</span></dt><dd>0.0</dd><dt><span>GRIB_longitudeOfLastGridPointInDegrees :</span></dt><dd>359.75</dd><dt><span>GRIB_Ny :</span></dt><dd>721</dd><dt><span>GRIB_jDirectionIncrementInDegrees :</span></dt><dd>0.25</dd><dt><span>GRIB_jPointsAreConsecutive :</span></dt><dd>0</dd><dt><span>GRIB_jScansPositively :</span></dt><dd>0</dd><dt><span>GRIB_latitudeOfFirstGridPointInDegrees :</span></dt><dd>90.0</dd><dt><span>GRIB_latitudeOfLastGridPointInDegrees :</span></dt><dd>-90.0</dd><dt><span>long_name :</span></dt><dd>V component of wind</dd><dt><span>units :</span></dt><dd>m s**-1</dd><dt><span>standard_name :</span></dt><dd>northward_wind</dd></dl></div><pre class='xr-var-data'>[32185440 values with dtype=float32]</pre></li></ul></div></li><li class='xr-section-item'><input id='section-e9637b35-0888-442c-811f-6475d90c04eb' class='xr-section-summary-in' type='checkbox' checked><label for='section-e9637b35-0888-442c-811f-6475d90c04eb' class='xr-section-summary' >Attributes: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>GRIB_edition :</span></dt><dd>2</dd><dt><span>GRIB_centre :</span></dt><dd>kwbc</dd><dt><span>GRIB_centreDescription :</span></dt><dd>US National Weather Service - NCEP </dd><dt><span>GRIB_subCentre :</span></dt><dd>0</dd><dt><span>Conventions :</span></dt><dd>CF-1.7</dd><dt><span>institution :</span></dt><dd>US National Weather Service - NCEP </dd><dt><span>history :</span></dt><dd>2020-06-26T15:24:32 GRIB to CDM+CF via cfgrib-0.9.8.3/ecCodes-2.18.0 with {"source": "/Users/drewcamron/Downloads/gfs.t12z.pgrb2.0p25.anl", "filter_by_keys": {"typeOfLevel": "isobaricInhPa"}, "encode_cf": ["parameter", "time", "geography", "vertical"]}</dd></dl></div></li></ul></div></div>" | |
], | |
"text/plain": [ | |
"<xarray.Dataset>\n", | |
"Dimensions: (isobaricInhPa: 31, latitude: 721, longitude: 1440)\n", | |
"Coordinates:\n", | |
" time datetime64[ns] ...\n", | |
" step timedelta64[ns] ...\n", | |
" * isobaricInhPa (isobaricInhPa) int64 1000 975 950 925 900 850 ... 7 5 3 2 1\n", | |
" * latitude (latitude) float64 90.0 89.75 89.5 ... -89.5 -89.75 -90.0\n", | |
" * longitude (longitude) float64 0.0 0.25 0.5 0.75 ... 359.2 359.5 359.8\n", | |
" valid_time datetime64[ns] ...\n", | |
"Data variables:\n", | |
" gh (isobaricInhPa, latitude, longitude) float32 ...\n", | |
" t (isobaricInhPa, latitude, longitude) float32 ...\n", | |
" u (isobaricInhPa, latitude, longitude) float32 ...\n", | |
" v (isobaricInhPa, latitude, longitude) float32 ...\n", | |
"Attributes:\n", | |
" GRIB_edition: 2\n", | |
" GRIB_centre: kwbc\n", | |
" GRIB_centreDescription: US National Weather Service - NCEP \n", | |
" GRIB_subCentre: 0\n", | |
" Conventions: CF-1.7\n", | |
" institution: US National Weather Service - NCEP \n", | |
" history: 2020-06-26T15:24:32 GRIB to CDM+CF via cfgrib-0...." | |
] | |
}, | |
"execution_count": 13, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"ds = xr.open_dataset(infile, engine='cfgrib', backend_kwargs={'filter_by_keys': {'typeOfLevel': 'isobaricInhPa'}})\n", | |
"ds" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment