SHTOOLS / SHTOOLS

SHTOOLS - Spherical Harmonic Tools

Home Page:https://shtools.github.io/SHTOOLS/

Repository from Github https://github.comSHTOOLS/SHTOOLSRepository from Github https://github.comSHTOOLS/SHTOOLS

Sampling is incorrectly set when using DHRealGrid() class.

ij264 opened this issue · comments

Description of the problem
I was trying to use SHGrid.from_array() to read in a global set of grid data, but got this error:
Screenshot from 2024-01-10 11-00-23
nlat = 91, nlon = 182, which is twice nlat, so I don't see how the error is correct.

I'm pretty sure that this is correct.

For DH grids with extend=False, nlat and nlon both are even. nlat is equal to N, which is equal to 2L+2. The size of the array is either NxN or Nx2N.

Since your input grid has nlat=91, this means that you are using grids with extend=True, which includes the redundant values at 360 E longitude and 90 S. For this case, nlat = N+1, and nlon is either N+1 or 2N+1. Thus the input nlon should be either 91 or 181.

Since your input grid doesn't conform to these rules, it isn't a valid grid that can be used with the Driscoll and Healy quadrature routine.