Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with grid indices #1

Open
jkrasting opened this issue Aug 10, 2023 · 1 comment
Open

Issue with grid indices #1

jkrasting opened this issue Aug 10, 2023 · 1 comment

Comments

@jkrasting
Copy link

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
Copy link
Author

Slicing issue was corrected by forcibly casting the jmin index as an integer in the MIDAS displaced_pole function. See mjharriso/MIDAS#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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant