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

Hard crash on ROMS raw output file #79

Open
knutfrode opened this issue Sep 6, 2023 · 3 comments
Open

Hard crash on ROMS raw output file #79

knutfrode opened this issue Sep 6, 2023 · 3 comments

Comments

@knutfrode
Copy link

When trying to use the at-method with the script/dataset bwlow, it crashes with the following error message:

/home/knutfd/miniconda3/envs/opendrift/lib/python3.11/site-packages/gridded/pysgrid/sgrid.py:272: UserWarning: Assuming low padding for faces
  warnings.warn('Assuming low padding for faces')
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 4) >= this->size() (which is 4)
Aborted (core dumped)
import gridded

# https://github.com/OpenDrift/opendrift/blob/master/tests/test_data/2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc
f = '/home/knutfd/software/opendrift/tests/test_data/2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc'
ds = gridded.Dataset(f)

temp = ds['temp']
p = [[14.2, 68, 0]]
t = temp.time.data[0]
print(t)
temp.at(points=p, time=t)
                             
@ChrisBarker-NOAA
Copy link
Contributor

@jay-hennen: I looked quickly at this, but haven't figure it out.

I suspect the hard crash is from CellTree2d -- where else would it be? So there is something wrong with this grid that celltree doesn't like.

IIUC, this file was processed from ROMS -- and I think the rho grid and psi grid may have gotten a bit changed -- e.g. they are the same size, which I don't think is usually the case. That may be the source of the warning: 'Assuming low padding for faces'

But it should never hard crash, and I think this should probably work, if being odd at thr boundaries.

@jay-hennen
Copy link
Contributor

Yes, it's from CellTree2D

After peeking in, the problem is that lon_psi and lat_psi are both full of zeros. lon_rho and lat_rho seem to have valid data, but the CellTree is built across the psi grid.

(Pdb) self.data._grp['lon_psi'][:]
masked_array(
  data=[[0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0],
        ...,
        [0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0]],
  mask=False,
  fill_value=999999,
  dtype=int16)

@ChrisBarker-NOAA
Copy link
Contributor

Hmm -- is it worth a sanity check on grid definitions before calling cell_tree?

Not sure how expensive that would be -- but at least a couple things would be good.

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

3 participants