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

Section interpolation and masking. #7

Open
eocene opened this issue Jan 21, 2021 · 3 comments
Open

Section interpolation and masking. #7

eocene opened this issue Jan 21, 2021 · 3 comments

Comments

@eocene
Copy link

eocene commented Jan 21, 2021

Running run_rapidmoc.py on output from various models on their native grids, for some models the program fails and returns:

`

thetao: using mask information from {DATA_LOC}/thetao_RAW.nc.

so: using mask information from {DATA_LOC}/so_RAW.nc.

tauuo: using mask information from {DATA_LOC}/tauuo_RAW.nc.

vo: using mask information from {DATA_LOC}/vo_RAW.nc.

Traceback (most recent call last):

File "{CODE_LOC}/RapidMoc/run_rapidmoc.py", line 16, in <module>

main()

File "{CODE_LOC}/RapidMoc/rapidmoc/rapidmoc.py", line 112, in main

t_on_v = sections.interpolate(t, v)

File "{CODE_LOC}RapidMoc/rapidmoc/sections.py", line 446, in interpolate

sinterp.data = np.ma.MaskedArray(s1.interp_along_section(dist, x0, y0), mask=mask)    

File "{PYTHON_LOC}/lib/python3.9/site-packages/numpy/ma/core.py", line 2909, in __new__

raise MaskError(msg % (nd, nm))

numpy.ma.core.MaskError: Mask and data not compatible: data size is 3061620, mask size is 1270200.

`

Has anyone had experience with this error? It works on some models and not others, but it's not clear why.

Thank you for your help in advance!

@cdr30
Copy link
Owner

cdr30 commented Jan 21, 2021

Hi, it looks like the mask and data definitions are incompatible for some reason. By default masks are inferred from the missing data in the files. Could you attach/paste your config file so I can see if there are any obvious issues? Also, could you paste the output of "ncdump -h" applied to each of the input data files.

In the meantime you can try specifying missing data masks manually using the following options (see description of config file in README):

[temperature/salinity/tau/meridional_velocity]
maskf = path to netcdf file containing explicit data mask [string, optional]
maskvar = netcdf variable name for mask in maskf [string, optional]
maskmdi = missing data indicator for maskvar [float, optional]

@eocene
Copy link
Author

eocene commented Jan 21, 2021

Hi - thanks so much for the quick response!

Attached are those 5 files:
ncdump_h_tauuo.txt
ncdump_h_vo.txt
ncdump_h_so.txt
ncdump_h_thetao.txt
config.ini.ACCESS-ESM1-5.txt

I'll try the manual masking in the meantime like you suggest!

Thank you very much for your time!

@cdr30
Copy link
Owner

cdr30 commented Jan 22, 2021

Hi - it looks like the time dimension is different in the salinity data file (time=370) compared to other files (time=900). This will definitely cause problems as data must be the same shape.

Depending on the grid staggering, you may also want to specify j2 = j1 + 1 for t/s/tau files so that these data are averaged onto the velocity grid (though it probably won't make much difference). See README for more details: "Note that it is possible to specify a range of indices in the y-direction. If j1 != j2, then data is extracted over a range of j-indices and then averaged to create a single zonal section. This allows temperature and salinity to be averaged onto the velocity section in a way that respects the staggering of the original model grid."

There are also example netcdf and config files in the test_data folder if you want to compare with your data to make sure you have the data dimensions/config set consistently.

Chris

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

2 participants