Page 1 of 1

How to calculate the corners of the lat/lon grids in Daymet

Posted: Fri Feb 02, 2024 12:50 am America/New_York
by peteden
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!

Re: How to calculate the corners of the lat/lon grids in Daymet

Posted: Sat Feb 03, 2024 10:27 am America/New_York
by rupeshornl
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.

Re: How to calculate the corners of the lat/lon grids in Daymet

Posted: Sun Feb 04, 2024 1:50 pm America/New_York
by peteden
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!

Re: How to calculate the corners of the lat/lon grids in Daymet

Posted: Thu Feb 08, 2024 7:19 am America/New_York
by rupeshornl
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!