NOAA-ORR-ERD / PyGnome

The General NOAA Operational Modeling Environment
https://gnome.orr.noaa.gov/doc/pygnome/index.html
Other
55 stars 44 forks source link

Problems with wind data #91

Open egiraldof opened 3 years ago

egiraldof commented 3 years ago

Hello,

I have tried downloading GFS wind data from GOODS and interpolating it with a script I made in Python.

I am trying to build the new NetCDF in the same way as the original, but I have the following error:

ValueError: timestamp out of range for platform localtime()/gmtime() function

I would appreciate the help.

wind.zip

jay-hennen commented 3 years ago

Thanks for bringing this to our attention. Can you specify exactly which source you used in GOODS? The time array appears to be fully masked for some reason; in other words the problem at the moment appears to be with the data source

ChrisBarker-NOAA commented 3 years ago

Jay, I think it's the GFS data:

https://gnome.orr.noaa.gov/goods/currents/GFS/choose_subregion

Though I'm not sure if it's the 1/2 degree of 1 degree.

AmyMacFadyen commented 3 years ago

But the problem with the masking of the time variable is likely happening post-download in whatever interpolation you are trying to do? If I download GFS from GOODS it loads in fine. Can you elaborate on what it is you are trying to do?

ChrisBarker-NOAA commented 3 years ago

Good catch Amy.

Regarding interpolation -- It's likely that PyGNOME itself can do what you need -- depending on what you need, of course :-)

Otherwise, the gridded package might help -- though it's a bit weak it writing out of files at this point.

egiraldof commented 3 years ago

I'm using data from the GFS, at 1/2 degree.

I'm trying to simulate a spill in a bay in Colombia, the domain is quite small, so 1/2° of resolution is not enough. That is, I don't have a single point left within my study area.

When I upload the file downloaded directly from GOODS to PyGnome, I don't get any errors. But when I use my code to interpolate the data in the domain and have a more refined grid, I get the error: ValueError: timestamp out of range for platform localtime()/gmtime() function.

However, it seems weird to me because I create a NetCDF the same as the original, I keep the same time-masked array as GOODS files, I keep the same variables and attributes, just resize lat and lon.

I don't know how to interpolate directly from PyGnome, if you can tell me how to do it, that would be great.

ChrisBarker-NOAA commented 3 years ago

IF you load a subset of the grid that covers your region, GNOME will interpolate to the actual locations of the elements. That is -- it should "just work".

Unless you need to do something fancier than linear interpolation, which is what GNOME does.

Do keep in mind the limitations of using a global model on a small scale, however.

-CHB

egiraldof commented 3 years ago

I don't know if I understood correctly, so I only download GFS data for a larger area (containing my area of interest) and PyGnome interpolates the 1/2 ° data in the whole domain and thus I would have wind data over the entire area? I want to be sure to use wind data as a mover on the drift of the particles.

I know the limitations of using a global model on a small scale, but I really don't have a better data source with better resolution.

Thanks for the help, very kind!

ChrisBarker-NOAA commented 3 years ago

yes.

But it does not interpolate the data ahead of time. Rather, it interpolates to the element positions at each time step.

If you look at the results (by, for example, turning the wind on an off) it will be clear that it is working :-)

If it does not appear to be working, then it's a bug -- let us know and we'll figure it out.

-CHB