adcroft / OM4_025_grid

Scripts for generating the 0.25 degree grid for OM4
0 stars 0 forks source link

Issue with grid indices #1

Open jkrasting opened 1 year ago

jkrasting commented 1 year ago

The 0.25º grid generation create_grids.py is failing in a slicing operation. Slice index appears to be of the wrong data type based on the error message:

cd OM4_025_grid; make
make[1]: Entering directory '/net2/jpk/MOM6-examples/ice_ocean_SIS2/OM4_025/preprocessing/OM4_025_grid'
unlimit stacksize; setenv PYTHONPATH ./local/lib/python; python create_grids.py
constructing a mercator supergrid with (ny,nx) =  1400 2880
nominal starting lat and starting longitude = -65.0 -300.0
and nominal width in latitude =  125.0
mercator max/min latitude= 64.0589597296948 -66.85954724706843
mercator nj,ni= 1400 2880
mercator starting longitude= -300.0
mercator ending longitude= 60.0
generated a tripolar supergrid of size (ny,nx)=  480 2880
tripolar grid starting longitude =  -300.0
tripolar grid starting latitude =  64.0589597296948
constructing a spherical supergrid with (ny,nx) =  1400 2880
nominal starting lat and starting longitude = -65.0 -300.0
and nominal width in latitude =  125.0
antarctic spherical max/min latitude= -66.85954724706843 -78.0
spherical nj,ni= 220 2880
spherical starting longitude= -300.0
spherical ending longitude= 60.0
(220, 2881)
Traceback (most recent call last):
  File "create_grids.py", line 101, in <module>
    antarctic_cap=supergrid(xdat=X,ydat=Y,axis_units='degrees',displace_pole=True,r0_pole=r0_pole,lon0_pole=lon0_pole,doughnut=doughnut)
  File "/net2/jpk/MOM6-examples/ice_ocean_SIS2/OM4_025/preprocessing/OM4_025_grid/local/lib/python/midas/rectgrid_gen.py", line 112, in __init__
    r,phi = self.displaced_pole(r0_pole,lon0_pole,excluded_fraction=doughnut)
  File "/net2/jpk/MOM6-examples/ice_ocean_SIS2/OM4_025/preprocessing/OM4_025_grid/local/lib/python/midas/rectgrid_gen.py", line 646, in displaced_pole
    return r_out[jmin:,:], phi_out[jmin:,:]
TypeError: slice indices must be integers or None or have an __index__ method
jkrasting commented 1 year ago

Slicing issue was corrected by forcibly casting the jmin index as an integer in the MIDAS displaced_pole function. See https://github.com/mjharriso/MIDAS/issues/20. jmin in this specific case was 20.0 and I simply cast it as int(jmin)

The code runs, although the resulting grids do not match their reference checksum values.

md5sum -c md5sums.txt
antarctic_spherical_supergrid.nc: FAILED
mercator_supergrid.nc: FAILED
ncap_supergrid.nc: FAILED
scap_supergrid.nc: FAILED
supergrid.nc: FAILED
ocean_hgrid.nc: FAILED
md5sum: WARNING: 1 line is improperly formatted
md5sum: WARNING: 6 computed checksums did NOT match

Thoughts, @adcroft?