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

GridWindMover not contributing to trajectories #7

Open kwilcox opened 8 years ago

kwilcox commented 8 years ago

I'm attempting to create a Location for the Bering Strait using HYCOM and GFS data exported from GOODS. It doesn't appear that the GFS data is having any effect on the spill (tested runs with and without the GridWindMover and they are the same). Maybe unrelated but I can't produce a topology file for the GFS data either.

Reproduce

$ git clone https://github.com/axiom-data-science/gnome-locations.git
$ ipython
In [1]: from gnome.movers.wind_movers import GridWindMover
In [2]: gwm = GridWindMover(wind_file='./gnome-locations/bering-strait/bering_strait_save/GFS_Global_0p5deg.nc')
In [3]: gwm.export_topology('hi.topo')

Expected

A file called hi.topo in the current directory.

Results

No file hi.topo in current directory and no exceptions or error messages.

ChrisBarker-NOAA commented 8 years ago

first thought -- you are getting close to the dateline there -- darn that round earth!

GNOME can't deal with the dateline, so EVERYTHING needs to be in the same coordinate system that doesn't have a discontinuity won't cross it -- i.e. 0 -- 360 degrees.

However, GOODS should have done the right thing for this, so we'll take a look.

And also not sure if it's related but if you don't get a topology file, then something is going wrong with the spatial index, so that could explain it too.

AmyMacFadyen commented 8 years ago

Kyle, can you confirm that your map, currents, and winds are all in the same coordinates (i.e. from 0-360 or -180-180)? If your subset crossed the dateline then GOODS will export in 0-360. However, if some of your subsetting regions crossed and some didn't then things will not go well in GNOME (your currents and/or winds could be off the map).

I am not sure the topo issue is related. I don't know that we ever added the option to build topo for winds. Maybe Caitlin can weigh in on that...

On Mon, Oct 5, 2015 at 2:23 PM, Chris Barker notifications@github.com wrote:

first thought -- you are getting close to the dateline there -- darn that round earth!

GNOME can't deal with the dateline, so EVERYTHING needs to be in the same coordinate system that doesn't have a discontinuity won't cross it -- i.e. 0 -- 360 degrees.

However, GOODS should have done the right thing for this, so we'll take a look.

And also not sure if it's related but if you don't get a topology file, then something is going wrong with the spatial index, so that could explain it too.

— Reply to this email directly or view it on GitHub https://github.com/NOAA-ORR-ERD/PyGnome/issues/7#issuecomment-145672529.

ChrisBarker-NOAA commented 8 years ago

@coconnor8 : ideas?

coconnor8 commented 8 years ago

You should be able to export topology for winds if they are curvilinear. No movement does sound like a topology issue though. I'd have to see the file to be sure.

AmyMacFadyen commented 8 years ago

GFS is a regular grid (1/2 degree) so I don't think its a topology issue.

On Mon, Oct 5, 2015 at 4:00 PM, coconnor8 notifications@github.com wrote:

You should be able to export topology for winds if they are curvilinear. No movement does sound like a topology issue though. I'd have to see the file to be sure.

— Reply to this email directly or view it on GitHub https://github.com/NOAA-ORR-ERD/PyGnome/issues/7#issuecomment-145692870.

kwilcox commented 8 years ago

@coconnor8 The GFS file i'm using is from here.

@AmyMacFadyen Both HYCOM and GFS NetCDF files are 0-360 (exported from GOODS) and available here as HYCOM.nc and GFS_Global_0p5deg.nc.

coconnor8 commented 8 years ago

Can you show the grid and/or velocities for the winds? Are they showing up on the map ? I think the map and currents may be in -180 to 180 and the winds in > 180.

AmyMacFadyen commented 8 years ago

I took a look at the files and made a script using pygnome to run using these inputs. Everything seems fine with the currents, winds, and map. In fact, everything works fine in pygnome so this is an issue with the creation of the movers in the client -- totally out of my wheelhouse!

Maybe we can have Nathan have a look at it. We're having a GNOME meeting in 5 minutes anyway, so I'll bring it up. Stay tuned!

On Tue, Oct 6, 2015 at 9:25 AM, coconnor8 notifications@github.com wrote:

Can you show the grid and/or velocities for the winds? Are they showing up on the map ? I think the map and currents may be in -180 to 180 and the winds in > 180.

— Reply to this email directly or view it on GitHub https://github.com/NOAA-ORR-ERD/PyGnome/issues/7#issuecomment-145918765.

kwilcox commented 8 years ago

@AmyMacFadyen Would you mind sharing the script you wrote for testing with me? Mine may be... less than optimal

AmyMacFadyen commented 8 years ago

Kyle, I emailed you the script but I'll paste it in here just for completeness.

from gnome.model import Model from datetime import datetime, timedelta from gnome.map import MapFromBNA from gnome.movers import GridCurrentMover, GridWindMover from gnome.outputters import Renderer from gnome import scripting from gnome.spill import point_line_release_spill

start_time = datetime(2015, 9, 25, 0, 0) model = Model(start_time=start_time, duration=timedelta(days=3), time_step=60 * 15, #seconds )

mapfile = 'bering-strait.bna' model.map = MapFromBNA(mapfile)

curr_file = 'HYCOM.nc' topology_file = 'HYCOM.topo' current_mover = GridCurrentMover(curr_file, topology_file) model.movers += current_mover

spill = point_line_release_spill(1000,start_position=(190, 64, 0.0),release_time=start_time) model.spills += spill

currents only case

images_dir = 'currents' scripting.make_images_dir(images_dir) renderer = Renderer(mapfile,images_dir,output_timestep=timedelta(hours=6)) model.outputters += renderer

model.full_run()

currents and winds

wind_file = 'GFS_Global_0p5deg.nc' wind_mover = GridWindMover(wind_file) model.movers += wind_mover

model.outputters.clear() images_dir = 'wind_currents' scripting.make_images_dir(images_dir) renderer = Renderer(mapfile,images_dir,output_timestep=timedelta(hours=6)) model.outputters += renderer

model.full_run()

On Tue, Oct 6, 2015 at 10:06 AM, Kyle Wilcox notifications@github.com wrote:

@AmyMacFadyen https://github.com/AmyMacFadyen Would you mind sharing the script you wrote for testing with me? Mine may be... less than optima

— Reply to this email directly or view it on GitHub https://github.com/NOAA-ORR-ERD/PyGnome/issues/7#issuecomment-145929361.