Open a dataset from the online repository (requires internet). If a local copy is found then always use that to avoid network traffic. Available datasets: * ``"air_temperature"``: NCEP reanalysis subset * ``"air_temperature_gradient"``: NCEP reanalysis subset with approximate
(
name: str,
cache: bool = True,
cache_dir: str | os.PathLike | None = None,
*,
engine: T_Engine = None,
**kws,
)
| 83 | |
| 84 | # idea borrowed from Seaborn |
| 85 | def open_dataset( |
| 86 | name: str, |
| 87 | cache: bool = True, |
| 88 | cache_dir: str | os.PathLike | None = None, |
| 89 | *, |
| 90 | engine: T_Engine = None, |
| 91 | **kws, |
| 92 | ) -> Dataset: |
| 93 | """ |
| 94 | Open a dataset from the online repository (requires internet). |
| 95 | |
| 96 | If a local copy is found then always use that to avoid network traffic. |
| 97 | |
| 98 | Available datasets: |
| 99 | |
| 100 | * ``"air_temperature"``: NCEP reanalysis subset |
| 101 | * ``"air_temperature_gradient"``: NCEP reanalysis subset with approximate x,y gradients |
| 102 | * ``"basin_mask"``: Dataset with ocean basins marked using integers |
| 103 | * ``"ASE_ice_velocity"``: MEaSUREs InSAR-Based Ice Velocity of the Amundsen Sea Embayment, Antarctica, Version 1 |
| 104 | * ``"rasm"``: Output of the Regional Arctic System Model (RASM) |
| 105 | * ``"ROMS_example"``: Regional Ocean Model System (ROMS) output |
| 106 | * ``"tiny"``: small synthetic dataset with a 1D data variable |
| 107 | * ``"era5-2mt-2019-03-uk.grib"``: ERA5 temperature data over the UK |
| 108 | * ``"eraint_uvz"``: data from ERA-Interim reanalysis, monthly averages of upper level data |
| 109 | * ``"ersstv5"``: NOAA's Extended Reconstructed Sea Surface Temperature monthly averages |
| 110 | |
| 111 | Parameters |
| 112 | ---------- |
| 113 | name : str |
| 114 | Name of the file containing the dataset. |
| 115 | e.g. 'air_temperature' |
| 116 | cache_dir : path-like, optional |
| 117 | The directory in which to search for and write cached data. |
| 118 | cache : bool, optional |
| 119 | If True, then cache data locally for use on subsequent calls |
| 120 | **kws : dict, optional |
| 121 | Passed to xarray.open_dataset |
| 122 | |
| 123 | See Also |
| 124 | -------- |
| 125 | tutorial.load_dataset |
| 126 | open_dataset |
| 127 | load_dataset |
| 128 | """ |
| 129 | try: |
| 130 | import pooch |
| 131 | except ImportError as e: |
| 132 | raise ImportError( |
| 133 | "tutorial.open_dataset depends on pooch to download and manage datasets." |
| 134 | " To proceed please install pooch." |
| 135 | ) from e |
| 136 | |
| 137 | logger = pooch.get_logger() |
| 138 | logger.setLevel("WARNING") |
| 139 | |
| 140 | cache_dir = _construct_cache_dir(cache_dir) |
| 141 | if name in external_urls: |
| 142 | url = external_urls[name] |
no test coverage detected
searching dependent graphs…