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

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
peteden
Posts: 1
Joined: Thu Jan 25, 2024 10:14 am America/New_York
Answers: 0

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

by peteden » Fri Feb 02, 2024 12:50 am America/New_York

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!

Tags:

rupeshornl
Subject Matter Expert
Subject Matter Expert
Posts: 17
Joined: Mon Jun 28, 2021 10:37 am America/New_York
Answers: 0
Has thanked: 1 time
Contact:

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

by rupeshornl » Sat Feb 03, 2024 10:27 am America/New_York

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.

peteden
Posts: 1
Joined: Thu Jan 25, 2024 10:14 am America/New_York
Answers: 0

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

by peteden » Sun Feb 04, 2024 1:50 pm America/New_York

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!

rupeshornl
Subject Matter Expert
Subject Matter Expert
Posts: 17
Joined: Mon Jun 28, 2021 10:37 am America/New_York
Answers: 0
Has thanked: 1 time
Contact:

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

by rupeshornl » Thu Feb 08, 2024 7:19 am America/New_York

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!

Post Reply