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

Add a specific grid to salem for RACMO greenland data #163

Open
bearecinos opened this issue Dec 13, 2019 · 1 comment
Open

Add a specific grid to salem for RACMO greenland data #163

bearecinos opened this issue Dec 13, 2019 · 1 comment

Comments

@bearecinos
Copy link

bearecinos commented Dec 13, 2019

Hello @fmaussion,

My problem is that I am trying to open two NetCDF files with this salem function:

data = salem.GeoNetcdf(fpath)

salem.GeoNetcdf()

  1. Greenland mask (topography)
  2. Greenland MB data

Both files have a not well define grid:
mask = salem.GeoNetcdf(mask_path)

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-a371a0171808> in <module>
----> 1 mask = salem.GeoNetcdf(mask_path)

~/.virtualenvs/oggm_env_latest/lib/python3.6/site-packages/salem/datasets.py in __init__(self, file, grid, time, monthbegin)
    382             grid = sio.grid_from_dataset(self._nc)
    383             if grid is None:
--> 384                 raise RuntimeError('File grid not understood')
    385         if time is None:
    386             time = sio.netcdf_time(self._nc, monthbegin=monthbegin)

RuntimeError: File grid not understood`

I then use xarray to open it but I still encounter the grid interpretation problem. With a grid defined like this:

mask = xr.open_dataset(mask_path) mask.grid

Map Projection:Polar Stereographic Ellipsoid - Map Reference Latitude: 90.0 - Map Reference Longitude: -39.0 - Map Second Reference Latitude: 71.0 - Map Eccentricity: 0.081819190843 ;wgs84 - Map Equatorial Radius: 6378137.0 ;wgs84 meters - Grid Map Origin Column: 160 - Grid Map Origin Row: -120 - Grid Map Units per Cell: 5000 - Grid Width: 301 - Grid Height: 561

Without salem or xarray being able to read such a grid I wont be able to build a function to interpolate each pixel of the data to the glacier grid in OGGM.
Would it be possible to integrate this type of grid in Salem?

Could we also add a different calendar?
smb_data = xr.open_dataset(smb_path, decode_times=False)
If I read the MB data I must also add that decode_times = False statement. Since the time units are also not recognise:

smb_data.time.units
'Months since 2018-01-15 00:00:0'

For more information on the data write me on slack. :) I appreciate the help.

@fmaussion
Copy link
Owner

Hi Bea, can you please share a data file? (ideally not too big)

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