OceanParcels / Parcels

Main code for Parcels (Probably A Really Computationally Efficient Lagrangian Simulator)
https://www.oceanparcels.org
MIT License
295 stars 136 forks source link

Unable to decode by xarray for netcdf from hycom #679

Closed ryohekono closed 5 years ago

ryohekono commented 5 years ago

Dear anyone,

I am a very beginner of python and working on the very beginning of the first tutorial now. My issue is when I use hycom netCDF files at the section of "Reading in data from arbritrary NetCDF files" in the first tutorial, FieldSet.from_netcdf() gives me back warnings of "File hycom---uv3z.nc could not be decoded properly by xarray (version 0.13.0) ". I've been stuck on here and no clue how to solve this issue. Probably because of this issue, I cannot create the right output_file of particleset.

issue

I've already tried to modify the netcdf_engine='xarray' to 'scipy' in the Field.py file, but it didn't work. This might be a very easy and stupid question, but I really need any solutions. Thank you.

Link: HYCOM data files I use mainly (ones ending with ut3z.nc) ftp://ftp.hycom.org/datasets/GLBu0.08/expt_91.1/data/hindcasts/2016/

erikvansebille commented 5 years ago

Dear @ryohekono. This may have to do with the calendar in the files. Have a look at the tutorial at https://nbviewer.jupyter.org/github/OceanParcels/parcels/blob/master/parcels/examples/tutorial_timestamps.ipynb that explains how you can use the timestamps argument to circumvent the decoding of calendars.

ryohekono commented 5 years ago

Hello @erikvansebille, and thank you very much for the answer. I tried timestampts and it still gives me back a message of undecoding. I am so sorry to keep asking you, but I hope you could have a look at my issue.

issue1

erikvansebille commented 5 years ago

Dear @ryohekono. Looking at your screenshots again, I'm not sure what exactly the problem is. You see Warnings, but these may not have to be a problem. They are thrown by xarray, and we've seen them before in our own experiments too. Still, the particle execution is fine

Can you check that the particle execution is really wrong? Do you get any errors? Otherwise, I think you can just ignore these warnings

ryohekono commented 5 years ago

Hi @erikvansebille , thank you so much for your response back! If i can simply ignore the warning messages, that's good to hear. But I still keep receiving the same error when i attempt to execute to create the output. (Please have a look at the photo below) Is there any possibly plausible ideas to solve this? I've been stuck here over a week...

issue2 issue3

erikvansebille commented 5 years ago

I've just check the issue, and it seems to be a problem with the way land values are stored in the hycom data.

The solution is to add vmin=-2000 when you create the FieldSet.from_netcdf

ryohekono commented 5 years ago

Hi, @erikvansebille Thank you so much! It's finally worked successfully! I really appreciate your support. Thank you!

giospud commented 4 years ago

Hi guys, I am stuck as well with the same problem. Could you please list the full command in order to set vmin=-2000 beacuse I am not understanding how to do it

erikvansebille commented 4 years ago

I think you've solved it now in https://github.com/OceanParcels/parcels/issues/865?

Indeed,

fieldset = FieldSet.from_netcdf(filenames, variables, dimensions, vmin=-2000)

is the way to add vmin