diff --git a/ci/environment-upstream-dev.yml b/ci/environment-upstream-dev.yml index 1de629b..825267b 100644 --- a/ci/environment-upstream-dev.yml +++ b/ci/environment-upstream-dev.yml @@ -10,6 +10,7 @@ dependencies: - intake-xarray>=0.3 - netcdf4 - pip + - pre-commit - pydap - pytest - pytest-cov diff --git a/ci/environment.yml b/ci/environment.yml index 1818ab6..d682ae1 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -11,6 +11,7 @@ dependencies: - intake-xarray>=0.3 - netcdf4 - pip + - pre-commit - pydap - pytest - pytest-cov diff --git a/docs/source/tutorial.ipynb b/docs/source/tutorial.ipynb index ddbb518..c8e5613 100644 --- a/docs/source/tutorial.ipynb +++ b/docs/source/tutorial.ipynb @@ -47,11 +47,10 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "\n", - "\n" + "\n\n" ] } ], @@ -78,6 +77,7 @@ "metadata": {}, "outputs": [ { + "output_type": "execute_result", "data": { "text/plain": [ "['err.mnmean.v3.nc',\n", @@ -89,9 +89,8 @@ " 'sst.mon.1981-2010.ltm.v4.nc']" ] }, - "execution_count": 4, "metadata": {}, - "output_type": "execute_result" + "execution_count": 4 } ], "source": [ @@ -113,19 +112,10 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "sources:\n", - " err.mnmean.v3.nc:\n", - " args:\n", - " chunks: {}\n", - " urlpath: https://psl.noaa.gov/thredds/dodsC/Datasets/noaa.ersst/err.mnmean.v3.nc\n", - " description: THREDDS data\n", - " driver: intake_xarray.opendap.OpenDapSource\n", - " metadata:\n", - " catalog_dir: null\n", - "\n" + "sources:\n err.mnmean.v3.nc:\n args:\n chunks: {}\n urlpath: https://psl.noaa.gov/thredds/dodsC/Datasets/noaa.ersst/err.mnmean.v3.nc\n description: THREDDS data\n driver: intake_xarray.opendap.OpenDapSource\n metadata:\n catalog_dir: null\n\n" ] } ], @@ -141,8 +131,8 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ "\n" ] @@ -169,522 +159,15 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "CPU times: user 694 ms, sys: 223 ms, total: 917 ms\n", - "Wall time: 11.5 s\n" + "CPU times: user 248 ms, sys: 24.2 ms, total: 273 ms\nWall time: 3.92 s\n" ] }, { + "output_type": "execute_result", "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset>\n",
-       "Dimensions:    (lat: 89, lon: 180, nbnds: 2, time: 1994)\n",
-       "Coordinates:\n",
-       "  * lat        (lat) float32 88.0 86.0 84.0 82.0 ... -82.0 -84.0 -86.0 -88.0\n",
-       "  * lon        (lon) float32 0.0 2.0 4.0 6.0 8.0 ... 352.0 354.0 356.0 358.0\n",
-       "  * time       (time) datetime64[ns] 1854-01-01 1854-02-01 ... 2020-02-01\n",
-       "Dimensions without coordinates: nbnds\n",
-       "Data variables:\n",
-       "    time_bnds  (time, nbnds) float64 dask.array<chunksize=(1994, 2), meta=np.ndarray>\n",
-       "    err        (time, lat, lon) float32 dask.array<chunksize=(1994, 89, 180), meta=np.ndarray>\n",
-       "Attributes:\n",
-       "    title:                           NOAA Extended Reconstructed SST V3\n",
-       "    Conventions:                     CF-1.0\n",
-       "    history:                         Thu Jul  1 14:04:15 2010: ncatted -O -a ...\n",
-       "    comments:                        The extended reconstructed sea surface t...\n",
-       "    platform:                        Model\n",
-       "    source:                          NOAA/NESDIS/National Climatic Data Center\n",
-       "    institution:                     NOAA/NESDIS/National Climatic Data Center\n",
-       "    citation:                        Smith, T.M., R.W. Reynolds, Thomas C. Pe...\n",
-       "    dataset_title:                   Extended Reconstructed Sea Surface Tempe...\n",
-       "    source_doc:                      https://www.ncdc.noaa.gov/data-access/ma...\n",
-       "    References:                      https://www.psl.noaa.gov/data/gridded/da...\n",
-       "    DODS_EXTRA.Unlimited_Dimension:  time
" - ], "text/plain": [ "\n", "Dimensions: (lat: 89, lon: 180, nbnds: 2, time: 1994)\n", @@ -709,11 +192,11 @@ " source_doc: https://www.ncdc.noaa.gov/data-access/ma...\n", " References: https://www.psl.noaa.gov/data/gridded/da...\n", " DODS_EXTRA.Unlimited_Dimension: time" - ] + ], + "text/html": "
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
<xarray.Dataset>\nDimensions:    (lat: 89, lon: 180, nbnds: 2, time: 1994)\nCoordinates:\n  * lat        (lat) float32 88.0 86.0 84.0 82.0 ... -82.0 -84.0 -86.0 -88.0\n  * lon        (lon) float32 0.0 2.0 4.0 6.0 8.0 ... 352.0 354.0 356.0 358.0\n  * time       (time) datetime64[ns] 1854-01-01 1854-02-01 ... 2020-02-01\nDimensions without coordinates: nbnds\nData variables:\n    time_bnds  (time, nbnds) float64 dask.array<chunksize=(1994, 2), meta=np.ndarray>\n    err        (time, lat, lon) float32 dask.array<chunksize=(1994, 89, 180), meta=np.ndarray>\nAttributes:\n    title:                           NOAA Extended Reconstructed SST V3\n    Conventions:                     CF-1.0\n    history:                         Thu Jul  1 14:04:15 2010: ncatted -O -a ...\n    comments:                        The extended reconstructed sea surface t...\n    platform:                        Model\n    source:                          NOAA/NESDIS/National Climatic Data Center\n    institution:                     NOAA/NESDIS/National Climatic Data Center\n    citation:                        Smith, T.M., R.W. Reynolds, Thomas C. Pe...\n    dataset_title:                   Extended Reconstructed Sea Surface Tempe...\n    source_doc:                      https://www.ncdc.noaa.gov/data-access/ma...\n    References:                      https://www.psl.noaa.gov/data/gridded/da...\n    DODS_EXTRA.Unlimited_Dimension:  time
" }, - "execution_count": 7, "metadata": {}, - "output_type": "execute_result" + "execution_count": 7 } ], "source": [ @@ -738,578 +221,15 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "CPU times: user 210 ms, sys: 18.6 ms, total: 229 ms\n", - "Wall time: 7.33 s\n" + "CPU times: user 201 ms, sys: 19.9 ms, total: 221 ms\nWall time: 3.93 s\n" ] }, { + "output_type": "execute_result", "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset>\n",
-       "Dimensions:    (lat: 89, lon: 180, nbnds: 2, time: 1994)\n",
-       "Coordinates:\n",
-       "  * lat        (lat) float32 88.0 86.0 84.0 82.0 ... -82.0 -84.0 -86.0 -88.0\n",
-       "  * lon        (lon) float32 0.0 2.0 4.0 6.0 8.0 ... 352.0 354.0 356.0 358.0\n",
-       "  * time       (time) datetime64[ns] 1854-01-01 1854-02-01 ... 2020-02-01\n",
-       "Dimensions without coordinates: nbnds\n",
-       "Data variables:\n",
-       "    time_bnds  (time, nbnds) float64 dask.array<chunksize=(100, 2), meta=np.ndarray>\n",
-       "    err        (time, lat, lon) float32 dask.array<chunksize=(100, 89, 90), meta=np.ndarray>\n",
-       "Attributes:\n",
-       "    title:                           NOAA Extended Reconstructed SST V3\n",
-       "    Conventions:                     CF-1.0\n",
-       "    history:                         Thu Jul  1 14:04:15 2010: ncatted -O -a ...\n",
-       "    comments:                        The extended reconstructed sea surface t...\n",
-       "    platform:                        Model\n",
-       "    source:                          NOAA/NESDIS/National Climatic Data Center\n",
-       "    institution:                     NOAA/NESDIS/National Climatic Data Center\n",
-       "    citation:                        Smith, T.M., R.W. Reynolds, Thomas C. Pe...\n",
-       "    dataset_title:                   Extended Reconstructed Sea Surface Tempe...\n",
-       "    source_doc:                      https://www.ncdc.noaa.gov/data-access/ma...\n",
-       "    References:                      https://www.psl.noaa.gov/data/gridded/da...\n",
-       "    DODS_EXTRA.Unlimited_Dimension:  time
" - ], "text/plain": [ "\n", "Dimensions: (lat: 89, lon: 180, nbnds: 2, time: 1994)\n", @@ -1334,11 +254,11 @@ " source_doc: https://www.ncdc.noaa.gov/data-access/ma...\n", " References: https://www.psl.noaa.gov/data/gridded/da...\n", " DODS_EXTRA.Unlimited_Dimension: time" - ] + ], + "text/html": "
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
<xarray.Dataset>\nDimensions:    (lat: 89, lon: 180, nbnds: 2, time: 1994)\nCoordinates:\n  * lat        (lat) float32 88.0 86.0 84.0 82.0 ... -82.0 -84.0 -86.0 -88.0\n  * lon        (lon) float32 0.0 2.0 4.0 6.0 8.0 ... 352.0 354.0 356.0 358.0\n  * time       (time) datetime64[ns] 1854-01-01 1854-02-01 ... 2020-02-01\nDimensions without coordinates: nbnds\nData variables:\n    time_bnds  (time, nbnds) float64 dask.array<chunksize=(100, 2), meta=np.ndarray>\n    err        (time, lat, lon) float32 dask.array<chunksize=(100, 89, 90), meta=np.ndarray>\nAttributes:\n    title:                           NOAA Extended Reconstructed SST V3\n    Conventions:                     CF-1.0\n    history:                         Thu Jul  1 14:04:15 2010: ncatted -O -a ...\n    comments:                        The extended reconstructed sea surface t...\n    platform:                        Model\n    source:                          NOAA/NESDIS/National Climatic Data Center\n    institution:                     NOAA/NESDIS/National Climatic Data Center\n    citation:                        Smith, T.M., R.W. Reynolds, Thomas C. Pe...\n    dataset_title:                   Extended Reconstructed Sea Surface Tempe...\n    source_doc:                      https://www.ncdc.noaa.gov/data-access/ma...\n    References:                      https://www.psl.noaa.gov/data/gridded/da...\n    DODS_EXTRA.Unlimited_Dimension:  time
" }, - "execution_count": 8, "metadata": {}, - "output_type": "execute_result" + "execution_count": 8 } ], "source": [ @@ -1365,14 +285,14 @@ "metadata": {}, "outputs": [ { + "output_type": "execute_result", "data": { "text/plain": [ - "['Datasets', 'Aggregations']" + "['Datasets', 'Projects', 'Aggregations']" ] }, - "execution_count": 9, "metadata": {}, - "output_type": "execute_result" + "execution_count": 9 } ], "source": [ @@ -1388,10 +308,10 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "['20thC_ReanV2', '20thC_ReanV2c', '20thC_ReanV3', 'ATOMIC', 'COBE', 'COBE2', 'CarbonTracker', 'E3SM', 'E3SM_LE', 'LIM', 'NARR', 'S2S', 'SERDP_regimeshifts', 'Timeseries', 'cmap', 'coads', 'cpc_global_precip', 'cpc_global_temp', 'cpc_us_hour_precip', 'cpc_us_precip', 'cpcsoil', 'cru', 'dai_pdsi', 'ghcncams', 'ghcngridded', 'gistemp', 'godas', 'gpcc', 'gpcp', 'icoads', 'icoads2.5', 'interp_OLR', 'jmatemp', 'kaplan_sst', 'livneh', 'mlost', 'mlostv3b', 'ncep', 'ncep.marine', 'ncep.pac.ocean', 'ncep.reanalysis', 'ncep.reanalysis.dailyavgs', 'ncep.reanalysis.derived', 'ncep.reanalysis2', 'ncep.reanalysis2.dailyavgs', 'ncep.reanalysis2.derived', 'noaa.ersst', 'noaa.ersst.v3', 'noaa.ersst.v4', 'noaa.ersst.v5', 'noaa.oisst.v2', 'noaa.oisst.v2.derived', 'noaa.oisst.v2.highres', 'noaa_hrc', 'noaaglobaltemp', 'noaamergedtemp', 'nodc.woa94', 'nodc.woa98', 'olrcdr', 'prec', 'precl', 'snowcover', 'udel.airt.precip', 'uninterp_OLR']\n" + "['20thC_ReanV2c', '20thC_ReanV3', 'ATOMIC', 'COBE', 'COBE2', 'CarbonTracker', 'E3SM', 'E3SM_LE', 'LIM', 'NARR', 'S2S', 'SERDP_regimeshifts', 'Timeseries', 'cmap', 'coads', 'cpc_global_precip', 'cpc_global_temp', 'cpc_us_hour_precip', 'cpc_us_precip', 'cpcsoil', 'cru', 'dai_pdsi', 'ghcncams', 'ghcngridded', 'gistemp', 'godas', 'gpcc', 'gpcp', 'icoads', 'icoads2.5', 'interp_OLR', 'jmatemp', 'kaplan_sst', 'livneh', 'mlost', 'mlostv3b', 'ncep', 'ncep.marine', 'ncep.pac.ocean', 'ncep.reanalysis', 'ncep.reanalysis.dailyavgs', 'ncep.reanalysis.derived', 'ncep.reanalysis2', 'ncep.reanalysis2.dailyavgs', 'ncep.reanalysis2.derived', 'noaa.ersst', 'noaa.ersst.v3', 'noaa.ersst.v4', 'noaa.ersst.v5', 'noaa.oisst.v2', 'noaa.oisst.v2.derived', 'noaa.oisst.v2.highres', 'noaa_hrc', 'noaaglobaltemp', 'noaamergedtemp', 'nodc.woa94', 'nodc.woa98', 'olrcdr', 'prec', 'precl', 'rte-rrtmgp', 'snowcover', 'udel.airt.precip', 'uninterp_OLR']\n" ] } ], @@ -1406,8 +326,8 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ "['other_gauss', 'pressure', 'surface', 'surface_gauss', 'tropopause']\n" ] @@ -1424,8 +344,8 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ "['air.sig995.1948.nc', 'air.sig995.1949.nc', 'air.sig995.1950.nc', 'air.sig995.1951.nc', 'air.sig995.1952.nc', 'air.sig995.1953.nc', 'air.sig995.1954.nc', 'air.sig995.1955.nc', 'air.sig995.1956.nc', 'air.sig995.1957.nc']\n" ] @@ -1453,22 +373,10 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "sources:\n", - " thredds_merged:\n", - " args:\n", - " path:\n", - " - Datasets\n", - " - ncep.reanalysis.dailyavgs\n", - " - surface\n", - " - air*sig995*194*.nc\n", - " url: https://psl.noaa.gov/thredds/catalog.xml\n", - " description: ''\n", - " driver: intake_thredds.source.THREDDSMergedSource\n", - " metadata: {}\n", - "\n" + "sources:\n thredds_merged:\n args:\n path:\n - Datasets\n - ncep.reanalysis.dailyavgs\n - surface\n - air*sig995*194*.nc\n url: https://psl.noaa.gov/thredds/catalog.xml\n description: ''\n driver: intake_thredds.source.THREDDSMergedSource\n metadata: {}\n\n" ] } ], @@ -1498,485 +406,17 @@ "metadata": {}, "outputs": [ { - "name": "stderr", "output_type": "stream", - "text": [ - "Dataset(s): 100%|████████████████████████████████| 2/2 [00:15<00:00, 7.77s/it]" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CPU times: user 907 ms, sys: 70.5 ms, total: 977 ms\n", - "Wall time: 20.9 s\n" - ] - }, - { "name": "stderr", - "output_type": "stream", "text": [ + "Dataset(s): 100%|████████████████████████████████| 2/2 [00:07<00:00, 3.85s/it]CPU times: user 821 ms, sys: 57.6 ms, total: 879 ms\n", + "Wall time: 10.6 s\n", "\n" ] }, { + "output_type": "execute_result", "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset>\n",
-       "Dimensions:  (lat: 73, lon: 144, time: 731)\n",
-       "Coordinates:\n",
-       "  * lon      (lon) float32 0.0 2.5 5.0 7.5 10.0 ... 350.0 352.5 355.0 357.5\n",
-       "  * time     (time) datetime64[ns] 1948-01-01 1948-01-02 ... 1949-12-31\n",
-       "  * lat      (lat) float32 90.0 87.5 85.0 82.5 80.0 ... -82.5 -85.0 -87.5 -90.0\n",
-       "Data variables:\n",
-       "    air      (time, lat, lon) float32 dask.array<chunksize=(366, 73, 144), meta=np.ndarray>\n",
-       "Attributes:\n",
-       "    Conventions:                     COARDS\n",
-       "    title:                           mean daily NMC reanalysis (1948)\n",
-       "    description:                     Data is from NMC initialized reanalysis\\...\n",
-       "    platform:                        Model\n",
-       "    history:                         created 99/05/11 by Hoop (netCDF2.3)\\nCo...\n",
-       "    dataset_title:                   NCEP-NCAR Reanalysis 1\n",
-       "    References:                      http://www.psl.noaa.gov/data/gridded/dat...\n",
-       "    DODS_EXTRA.Unlimited_Dimension:  time
" - ], "text/plain": [ "\n", "Dimensions: (lat: 73, lon: 144, time: 731)\n", @@ -1995,11 +435,11 @@ " dataset_title: NCEP-NCAR Reanalysis 1\n", " References: http://www.psl.noaa.gov/data/gridded/dat...\n", " DODS_EXTRA.Unlimited_Dimension: time" - ] + ], + "text/html": "
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
<xarray.Dataset>\nDimensions:  (lat: 73, lon: 144, time: 731)\nCoordinates:\n  * lon      (lon) float32 0.0 2.5 5.0 7.5 10.0 ... 350.0 352.5 355.0 357.5\n  * time     (time) datetime64[ns] 1948-01-01 1948-01-02 ... 1949-12-31\n  * lat      (lat) float32 90.0 87.5 85.0 82.5 80.0 ... -82.5 -85.0 -87.5 -90.0\nData variables:\n    air      (time, lat, lon) float32 dask.array<chunksize=(366, 73, 144), meta=np.ndarray>\nAttributes:\n    Conventions:                     COARDS\n    title:                           mean daily NMC reanalysis (1948)\n    description:                     Data is from NMC initialized reanalysis\\...\n    platform:                        Model\n    history:                         created 99/05/11 by Hoop (netCDF2.3)\\nCo...\n    dataset_title:                   NCEP-NCAR Reanalysis 1\n    References:                      http://www.psl.noaa.gov/data/gridded/dat...\n    DODS_EXTRA.Unlimited_Dimension:  time
" }, - "execution_count": 14, "metadata": {}, - "output_type": "execute_result" + "execution_count": 14 } ], "source": [ @@ -2025,24 +465,10 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "sources:\n", - " thredds_merged:\n", - " args:\n", - " driver: netcdf\n", - " path:\n", - " - Datasets\n", - " - ncep.reanalysis.dailyavgs\n", - " - surface\n", - " - air.sig995.194*.nc\n", - " url: simplecache::https://psl.noaa.gov/thredds/catalog.xml\n", - " description: ''\n", - " driver: intake_thredds.source.THREDDSMergedSource\n", - " metadata:\n", - " fsspec_pre_url: 'simplecache::'\n", - "\n" + "sources:\n thredds_merged:\n args:\n driver: netcdf\n path:\n - Datasets\n - ncep.reanalysis.dailyavgs\n - surface\n - air.sig995.194*.nc\n url: simplecache::https://psl.noaa.gov/thredds/catalog.xml\n description: ''\n driver: intake_thredds.source.THREDDSMergedSource\n metadata:\n fsspec_pre_url: 'simplecache::'\n\n" ] } ], @@ -2069,24 +495,11 @@ "metadata": {}, "outputs": [ { - "name": "stderr", - "output_type": "stream", - "text": [ - "Dataset(s): 100%|████████████████████████████████| 2/2 [00:10<00:00, 5.44s/it]" - ] - }, - { - "name": "stdout", "output_type": "stream", - "text": [ - "CPU times: user 875 ms, sys: 186 ms, total: 1.06 s\n", - "Wall time: 19.1 s\n" - ] - }, - { "name": "stderr", - "output_type": "stream", "text": [ + "Dataset(s): 100%|████████████████████████████████| 2/2 [00:00<00:00, 21.43it/s]CPU times: user 422 ms, sys: 31.4 ms, total: 454 ms\n", + "Wall time: 2.89 s\n", "\n" ] } @@ -2111,11 +524,10 @@ "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "CPU times: user 10 µs, sys: 1e+03 ns, total: 11 µs\n", - "Wall time: 12.9 µs\n" + "CPU times: user 8 µs, sys: 0 ns, total: 8 µs\nWall time: 11.2 µs\n" ] } ], @@ -2124,19 +536,83 @@ "%time ds = source.to_dask()" ] }, + { + "source": [ + "## Multi-file concat_kwargs cfgrib" + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "source": [ + "Another example of this is to read in ensemble members in parallel for GEFS. The example below reads in 21 ensemble members for a single timestep. It also demonstrates usage of `xarray_kwargs` which are passed on to `xarray` for opening the files, which in this cases uses the `cfgrib` engine:" + ], + "cell_type": "markdown", + "metadata": {} + }, { "cell_type": "code", "execution_count": 19, "metadata": {}, - "outputs": [], - "source": [ - "import shutil\n", - "\n", - "shutil.rmtree('my_caching_folder')" + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "Dataset(s): 100%|██████████████████████████████| 21/21 [00:00<00:00, 35.56it/s]\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "\n", + "Dimensions: (latitude: 181, longitude: 360, number: 21)\n", + "Coordinates:\n", + " * number (number) int64 20 19 18 17 16 15 14 13 ... 6 5 4 3 2 1 0\n", + " time datetime64[ns] 2020-08-31\n", + " step timedelta64[ns] 15 days 12:00:00\n", + " heightAboveGround float64 2.0\n", + " * latitude (latitude) float64 90.0 89.0 88.0 ... -88.0 -89.0 -90.0\n", + " * longitude (longitude) float64 0.0 1.0 2.0 3.0 ... 357.0 358.0 359.0\n", + " valid_time datetime64[ns] 2020-09-15T12:00:00\n", + "Data variables:\n", + " t2m (number, latitude, longitude) float32 dask.array\n", + "Attributes:\n", + " GRIB_edition: 2\n", + " GRIB_centre: kwbc\n", + " GRIB_centreDescription: US National Weather Service - NCEP \n", + " GRIB_subCentre: 2\n", + " Conventions: CF-1.7\n", + " institution: US National Weather Service - NCEP \n", + " history: 2021-06-09T17:47 GRIB to CDM+CF via cfgrib-0.9.9..." + ], + "text/html": "
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
<xarray.Dataset>\nDimensions:            (latitude: 181, longitude: 360, number: 21)\nCoordinates:\n  * number             (number) int64 20 19 18 17 16 15 14 13 ... 6 5 4 3 2 1 0\n    time               datetime64[ns] 2020-08-31\n    step               timedelta64[ns] 15 days 12:00:00\n    heightAboveGround  float64 2.0\n  * latitude           (latitude) float64 90.0 89.0 88.0 ... -88.0 -89.0 -90.0\n  * longitude          (longitude) float64 0.0 1.0 2.0 3.0 ... 357.0 358.0 359.0\n    valid_time         datetime64[ns] 2020-09-15T12:00:00\nData variables:\n    t2m                (number, latitude, longitude) float32 dask.array<chunksize=(1, 181, 360), meta=np.ndarray>\nAttributes:\n    GRIB_edition:            2\n    GRIB_centre:             kwbc\n    GRIB_centreDescription:  US National Weather Service - NCEP \n    GRIB_subCentre:          2\n    Conventions:             CF-1.7\n    institution:             US National Weather Service - NCEP \n    history:                 2021-06-09T17:47 GRIB to CDM+CF via cfgrib-0.9.9...
" + }, + "metadata": {}, + "execution_count": 19 + } ], + "source": [ + "cat_url = 'https://www.ncei.noaa.gov/thredds/catalog/model-gefs-003/202008/20200831/catalog.xml'\n", + "source = intake.open_thredds_merged(\n", + " f'simplecache::{cat_url}',\n", + " path=[\"NCEP gens-a Grid 3 Member-Forecast *-372 for 2020-08-31 00:00*\"],\n", + " driver=\"netcdf\",\n", + " concat_kwargs={\"dim\": \"number\"},\n", + " xarray_kwargs=dict(\n", + " engine=\"cfgrib\",\n", + " backend_kwargs=dict(\n", + " filter_by_keys={\"typeOfLevel\": \"heightAboveGround\", \"cfVarName\": \"t2m\"}\n", + " ),\n", + " ),\n", + ")\n", + "source.to_dask()" + ] + }, + { "cell_type": "code", "execution_count": null, - "id": "biblical-diana", "metadata": {}, "outputs": [], "source": [] @@ -2144,9 +620,8 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" + "name": "python394jvsc74a57bd08c9dd1675ed1475511ca7cc9377f79452dc415e3683ecf81bd1eba05161e223d", + "display_name": "Python 3.9.4 64-bit ('intake-thredds-dev': conda)" }, "language_info": { "codemirror_mode": { @@ -2158,7 +633,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.0" + "version": "3.9.4" }, "widgets": { "application/vnd.jupyter.widget-state+json": { @@ -2166,6 +641,11 @@ "version_major": 2, "version_minor": 0 } + }, + "metadata": { + "interpreter": { + "hash": "8c9dd1675ed1475511ca7cc9377f79452dc415e3683ecf81bd1eba05161e223d" + } } }, "nbformat": 4,