How to calculate the corners of the lat/lon grids in Daymet
How to calculate the corners of the lat/lon grids in Daymet
I just wonder how to regrid the daily precipitation (daymet_v4_daily_na_prcp_xxxx.nc) over curvilinear grids to 1-degree rectilinear grids using conservative method, which requires that the corners of the lat/lon grids be input. For example, for regridding using ESMF in NCL: https://www.ncl.ucar.edu/Applications/ESMF.shtml, it shows “if the center lat/lon grid is dimensioned 256 x 220, then the corner arrays must be 256 x 220 x 4.
I have used `cf_xarray` in Python to guess the corners of the curvilinear data, but there can be larger biases over high latitudes?
Is there any way to know the corners? Or any better way to calculate them?
Thank you in advance!
I have used `cf_xarray` in Python to guess the corners of the curvilinear data, but there can be larger biases over high latitudes?
Is there any way to know the corners? Or any better way to calculate them?
Thank you in advance!
Filters:
-
- Subject Matter Expert
- Posts: 17
- Joined: Mon Jun 28, 2021 10:37 am America/New_York
- Has thanked: 1 time
- Contact:
Re: How to calculate the corners of the lat/lon grids in Daymet
Hi @peteden, Thank you for contacting us. One way to get the corners of a Daymet grid is to create the corner coordinates in Daymet's native projection (Lambert Conformal Conic, LCC) and then convert these coordinates to lat, lon. I have posted an example Python script here:
https://github.com/rupesh2/daymet_subset/blob/main/create_latlon_bounds.py
The script adds two new variables, `lat_vertices` and `lon_vertices`, to a Daymet file. With these new variables that define the latitude and longitude bounds of the Daymet grid, you should be able to use the NCL regridding tools. Let us know if you are still having issues.
https://github.com/rupesh2/daymet_subset/blob/main/create_latlon_bounds.py
The script adds two new variables, `lat_vertices` and `lon_vertices`, to a Daymet file. With these new variables that define the latitude and longitude bounds of the Daymet grid, you should be able to use the NCL regridding tools. Let us know if you are still having issues.
Re: How to calculate the corners of the lat/lon grids in Daymet
Hi @rupeshornl. Thank you very much. However, using your code, there is an error: "OSError: [Errno -101] NetCDF: HDF error: b'/xxxxxxx/daymet_v4_daily_na_prcp_1980.nc'". What do you think that it can be resolved?
Thank you in advance!
Thank you in advance!
-
- Subject Matter Expert
- Posts: 17
- Joined: Mon Jun 28, 2021 10:37 am America/New_York
- Has thanked: 1 time
- Contact:
Re: How to calculate the corners of the lat/lon grids in Daymet
Hi @peteden, I'm sorry I missed your post earlier. Could it be that you have the netCDF file missing at `/xxxxxxx/daymet_v4_daily_na_prcp_1980.nc`, or that the file is corrupted? Could you try with another file? Thank you!