From acfb938f35d07ccd7de07deba2b61d25780e962e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Ko=CC=88lling?= Date: Thu, 16 May 2024 10:36:21 +0200 Subject: [PATCH] HERA5: fix missing lon/lat Easygems now assumes latitude and longitude to be named lat and lon since https://github.com/mpimet/easygems/pull/6 . This fix uses the `attach_coords` method to ensure that healpix coordinates are defined accordingly. --- orcestra_book/hera5.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/orcestra_book/hera5.md b/orcestra_book/hera5.md index 54b0ccdd..07959a25 100644 --- a/orcestra_book/hera5.md +++ b/orcestra_book/hera5.md @@ -50,7 +50,7 @@ list(cat) ``` ```{code-cell} ipython3 -cat.HERA5.to_dask() +cat.HERA5.to_dask().pipe(egh.attach_coords) ``` ### Some notes on the dataset @@ -79,7 +79,7 @@ We would like to plot the 2m air temperature at one location, the BCO, in August For this rather short time period, we would like to work with the hourly data. Therefore, we need to specify the time hierarchy when addressing the data in the catalog. ```{code-cell} ipython3 -era5 = cat.HERA5(time="PT1H").to_dask() +era5 = cat.HERA5(time="PT1H").to_dask().pipe(egh.attach_coords) ``` Next, we select the cell index that is the nearest neighbor to the BCO location using [`healpy.ang2pix()`](https://healpy.readthedocs.io/en/latest/generated/healpy.pixelfunc.ang2pix.html#healpy.pixelfunc.ang2pix). @@ -132,7 +132,7 @@ era5["r"].sel( ).mean( "time" ).groupby( - era5.latitude.sel(cell=is_orcestra) + era5.lat.sel(cell=is_orcestra) ).mean().plot( x="latitude", yincrease=False, @@ -164,7 +164,7 @@ hp.mollview( The `healpy` package only provides functions to plot the whole globe. However, in real-life analyses it is often necessary to constrain a plot to certain regions. The function `easygems.healpix_show()` allows to plot two-dimensional data onto a cartopy `GeoAxis` with arbitrary projection and extent. ```{code-cell} ipython3 -era5 = cat.HERA5(time="P1M").to_dask() +era5 = cat.HERA5(time="P1M").to_dask().pipe(egh.attach_coords) var = era5["tp"] fig, ax = plt.subplots(figsize=(10, 6), subplot_kw={"projection": ccrs.PlateCarree()})