Giter Site home page Giter Site logo

noaa-orr-erd / pygnome Goto Github PK

View Code? Open in Web Editor NEW
54.0 21.0 44.0 196.73 MB

The General NOAA Operational Modeling Environment

Home Page: https://gnome.orr.noaa.gov/doc/pygnome/index.html

License: Other

Python 10.65% MATLAB 0.02% C++ 27.30% C 37.72% R 1.06% Shell 0.24% Jupyter Notebook 6.84% Roff 0.93% Cython 0.73% Rez 14.47% CMake 0.03%

pygnome's Introduction

GNOME Logo

PyGNOME

Introduction

GNOME (General NOAA Operational Modeling Environment) is a modeling tool developed by the National Oceanic and Atmospheric Administration (NOAA), Office of Response and Restoration (ORR), Emergency Response Division.

It is designed to support oil and other hazardous material spills in the coastal environment, and is also a full featured, flexible particle tracking system, that can be used for other oceanographic transport applications, such as fish larvae, marine debris, etc.

PyGNOME is a python package that encapsulates GNOME's functionality.

Disclaimer:

This code is under active development

  • It should not be considered an officially endorsed NOAA product.
  • Output produced by this code should not be considered endorsed by NOAA.

Documentation

Project Documentation

FAQ

Installation

We have put some effort into making this package reasonably easy, or at least possible, to install on a few different computing platforms:

  • OS-X
  • Windows
  • Linux (tested on CentOS 7)

This package contains modules written in C/C++, and they must be compiled for this package to function, and we primarily use the Anaconda distribution of Python for installation. Anaconda is built primarily for scientific, engineering, and math applications. It is now the only supported way to get set up to use PyGNOME, and it is used in our development and testing process.

Install using Anaconda

The WebGNOME Interface:

Scripting is the most featurefull way to access PyGNOME's capabilities. However we have developed a system that allows a user to create and run PyGNOME models from a web browser.

There is a publicly available instance of WebGNOME at:

https://gnome.orr.noaa.gov

If you want to run your own instance of WebGNOME, the code is in the following projects:

  • WebGnomeAPI: A web server that implements the PyGNOME interface
  • WebGnomeClient: A Web application for setting up and running PyGNOME models

Fair Warning:

The WebGNOME system is under active development, and by its very nature does not expose the full capabilities of PyGNOME.

pygnome's People

Contributors

abrookins avatar alexmiranda-noaa avatar amymacfadyen avatar chrisbarker-noaa avatar coconnor8 avatar dylanrighi avatar jamesmakela avatar jamesmakela-noaa avatar jasminesandhu avatar jay-hennen avatar kwilcox avatar leogeng1982 avatar naomiwilkins-noaa avatar ocefpaf avatar pythonchb avatar sandhujasmine avatar zelenke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pygnome's Issues

Issues installing PyGnome

@ChrisBarker-NOAA

Dear Chris,

We have tried installing PyGnome on different computers and operating systems (macOS, Windows 8.1 and windows 10). However, we end up receiving errors or the whole process crashes.

This is the error I receive on macOS:

MacBook-Pro:py_gnome MustiDarsh$ py.test
Traceback (most recent call last):
File "/Users/MustiDarsh/anaconda/lib/python2.7/site-packages/_pytest/config.py", line 362, in _importconftest
mod = conftestpath.pyimport()
File "/Users/MustiDarsh/anaconda/lib/python2.7/site-packages/py/_path/local.py", line 662, in pyimport
import(modname)
File "/Users/MustiDarsh/anaconda/lib/python2.7/site-packages/pytest/assertion/rewrite.py", line 216, in load_module
py.builtin.exec(co, mod.dict)
File "/Users/MustiDarsh/anaconda/lib/python2.7/site-packages/py/builtin.py", line 221, in exec
exec2(obj, globals, locals)
File "", line 7, in exec2
File "/Users/MustiDarsh/PyGnome/py_gnome/tests/conftest.py", line 15, in 
from gnome.utilities import rand
ImportError: No module named gnome.utilities
ERROR: could not load /Users/MustiDarsh/PyGnome/py_gnome/tests/conftest.py

I have tried to remove everything and install from the ground up but unfortunately the error still remains. I also tried installing on Windows. On windows it starts the the test of py_gnome but it freezes and then crashes when it is working on test_ice_mover.py (see image)

image001

I got the error on Windows 10 as well.

Looking forward to hearing from you what to do about these errors.

Regards,

MD

issues running PyGnome

Hi all,

After installing PyGnome and getting it working it was time to discover the various possibilities and features within PyGnome. I edited my script((based on code snippets from examples in the script folder) and added a couple of new things to test:

import os
from datetime import datetime, timedelta

import numpy as np

import gnome
from gnome import scripting
from gnome.basic_types import datetime_value_2d

from gnome.utilities.projections import GeoProjection
from gnome.utilities.remote_data import get_datafile

from gnome.environment import Wind, Tide
from gnome.map import MapFromBNA

from gnome.model import Model
from gnome.spill import continuous_release_spill
from gnome.scripting import surface_point_line_spill
from gnome.movers import GridCurrentMover

from gnome.outputters import Renderer, NetCDFOutput, KMZOutput

# # let's get the console log working:
gnome.initialize_console_log()

# define base directory
base_dir = os.path.dirname(__file__)


print 'creating the maps'
mapfile = get_datafile(os.path.join('coast2.bna'))
gnome_map = MapFromBNA(mapfile,
                       refloat_halflife=1,  # hours
                       raster_size=2048*2048  # about 4 MB
                       )

renderer = Renderer(mapfile,
                    "images",
                    size=(800, 800),
                    projection_class=GeoProjection)

print 'initializing the model'
start_time = datetime(2017, 3, 7, 0, 0)

# 15 minutes in seconds
# Default to now, rounded to the nearest hour
model = Model(time_step=900,
              start_time=start_time,
              duration=timedelta(hours=6),
              map=gnome_map,
              uncertain=True)

print 'adding outputters'
model.outputters += renderer

netcdf_file = os.path.join(base_dir, 'test.nc')
scripting.remove_netcdf(netcdf_file)
model.outputters += NetCDFOutput(netcdf_file, which_data='all')

model.outputters += KMZOutput(os.path.join(base_dir, 'test.kmz'))

c_mover = GridCurrentMover('output2.nc')
print 'adding current'
model.movers += c_mover


print 'adding a spill'

spill = surface_point_line_spill(num_elements=1000,
                                 start_position=(5.0, 53.2, 0.0),
                                 release_time=start_time,
                                 end_release_time= start_time + timedelta(hours=6),
                                 amount=5000,
                                 substance='ALASKA NORTH SLOPE (MIDDLE PIPELINE)',
                                 units='bbl',
                                 windage_range=(0.01,0.02),
                                 windage_persist=-1,
                                 name='My spill')


model.spills += spill

scripting.make_images_dir()
print "running the model"
model.full_run()

The console log is activated and I get the following error:

/Users/MustiDarsh/anaconda2/envs/gnome/bin/python2.7 /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/veld.py
creating the maps
initializing the model
INFO - model - line:342 - 25428 - rewound model - Model
adding outputters
removed /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/test.nc
removed /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/test.nc
adding current
INFO - model - line:342 - 25428 - rewound model - Model
INFO - model - line:342 - 25428 - rewound model - Model
adding a spill
DEBUG - _transaction - line:108 - new transaction
DEBUG - element_type - line:71 - 25428 - constructed element_type: ElementType
DEBUG - spill - line:711 - 25428 - deepcopied spill 70516c1c-0e5a-11e7-8899-a45e60ebaf6b
images_dir is: /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/images
removing... /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/images
running the model
WARNING - element_type - line:98 - obj_type attribute does not exist in element_type initializers
INFO - model - line:342 - 25428 - rewound model - Model
WARNING - element_type - line:98 - obj_type attribute does not exist in element_type initializers
INFO - spill_container - line:498 - 25428 - number of substances: 1
INFO - spill_container - line:498 - 25428 - number of substances: 1
Starting animation
<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
dimensions(sizes):
variables(dimensions):
groups:

<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
dimensions(sizes):
variables(dimensions):
groups:

DEBUG - model - line:692 - 25428 - setup_model_run complete for: Model
Traceback (most recent call last):
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/veld.py", line 85, in
model.full_run()
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/model.py", line 968, in full_run
results = self.step()
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/model.py", line 915, in step
num_released = sc.release_elements(self.time_step, self.model_time)
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill_container.py", line 920, in release_elements
self._data_arrays)
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 800, in set_newparticle_values
self._elem_mass(num_new_particles, current_time, time_step)
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 459, in _elem_mass
_mass = self.get_mass('kg')
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 679, in get_mass
water_temp = self.water.get('temperature')
AttributeError: 'NoneType' object has no attribute 'get'

I have tried to figure out the problem by going to the files shown in the error, sadly I wasn't able to find what is causing the error. Hopefully someone here could.

I have also tried a different type of spill to see whether the error is within a definition of a spill or something else. The following spill def was tested:

from gnome.spill import continuous_release_spill
end_time = start_time + timedelta(hours=6)
spill = continuous_release_spill(initial_elements=100,
                                 num_elements=1000,
                                 start_position=(5.0, 53.2, 0.0),
                                 release_time=start_time,
                                 end_position=None,
                                 end_release_time=None,
                                 element_type=None,
                                 substance=None,
                                 on=True,
                                 amount=1000,
                                 units='bbls',
                                 name='Point Release')

The following error was printed to my terminal.

/Users/MustiDarsh/anaconda2/envs/gnome/bin/python2.7 /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/veld.py
creating the maps
initializing the model
adding outputters
adding current
adding a spill
Traceback (most recent call last):
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/veld.py", line 81, in
name='Point Release')
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 1045, in continuous_release_spill
name=name)
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 262, in init
raise TypeError("Units must be provided with amount spilled")
TypeError: Units must be provided with amount spilled

I tried different units like l, bbl, tonnes, tons, ton but the error remained. Chris mentioned that internally mass is used since oil is actually conserved that way. From what I found in the code is that kg is the standard unit for mass in PyGnome. Since it was mentioned that mass is the standard internally I tried to use define different units (g,kg, tons and tonnes) but the error remained.

I found that the script_weatherers.py contained a spill example where barrels were the unit used. When I ran that script I got the following error:

/Users/MustiDarsh/anaconda2/envs/gnome/bin/python2.7 /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/scripts/script_weatherers/script_weatherers.py
images_dir is: /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/scripts/script_weatherers/images
removing... /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/scripts/script_weatherers/images
initializing the model
removed /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/scripts/script_weatherers/script_weatherers.nc
removed /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/scripts/script_weatherers/script_weatherers.nc
adding a spill
adding a RandomMover:
adding a wind mover:
adding weatherers and cleanup options:
<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
dimensions(sizes):
variables(dimensions):
groups:

<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
dimensions(sizes):
variables(dimensions):
groups:

Traceback (most recent call last):
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/scripts/script_weatherers/script_weatherers.py", line 153, in
model.full_run()
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/model.py", line 968, in full_run
results = self.step()
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/model.py", line 881, in step
"is invalid", msgs)
RuntimeError: ('Setup model run complete but model is invalid', ['warning: ChemicalDispersion: no waves object defined'])

To find out whether the error is in my code or in an external dependency I ran the file run_all.py in the /scripts/ directory. After executing a couple scripts the terminal was disrupted by the following error:

/Users/MustiDarsh/anaconda2/envs/gnome/bin/python2.7 /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/veld.py
creating the maps
initializing the model
INFO - model - line:342 - 25428 - rewound model - Model
adding outputters
removed /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/test.nc
removed /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/test.nc
adding current
INFO - model - line:342 - 25428 - rewound model - Model
INFO - model - line:342 - 25428 - rewound model - Model
adding a spill
DEBUG - _transaction - line:108 - new transaction
DEBUG - element_type - line:71 - 25428 - constructed element_type: ElementType
DEBUG - spill - line:711 - 25428 - deepcopied spill 70516c1c-0e5a-11e7-8899-a45e60ebaf6b
images_dir is: /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/images
removing... /Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/images
running the model
WARNING - element_type - line:98 - obj_type attribute does not exist in element_type initializers
INFO - model - line:342 - 25428 - rewound model - Model
WARNING - element_type - line:98 - obj_type attribute does not exist in element_type initializers
INFO - spill_container - line:498 - 25428 - number of substances: 1
INFO - spill_container - line:498 - 25428 - number of substances: 1
Starting animation
<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
dimensions(sizes):
variables(dimensions):
groups:

<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
dimensions(sizes):
variables(dimensions):
groups:

DEBUG - model - line:692 - 25428 - setup_model_run complete for: Model
Traceback (most recent call last):
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/MMMvM/testPG01/veld.py", line 85, in
model.full_run()
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/model.py", line 968, in full_run
results = self.step()
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/model.py", line 915, in step
num_released = sc.release_elements(self.time_step, self.model_time)
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill_container.py", line 920, in release_elements
self._data_arrays)
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 800, in set_newparticle_values
self._elem_mass(num_new_particles, current_time, time_step)
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 459, in _elem_mass
_mass = self.get_mass('kg')
File "/Users/MustiDarsh/GNOME_SOURCE/PyGnome/py_gnome/gnome/spill/spill.py", line 679, in get_mass
water_temp = self.water.get('temperature')
AttributeError: 'NoneType' object has no attribute 'get'

For now I can create and execute scripts according to the example here:
http://noaa-orr-erd.github.io/PyGnome/scripting/scripting_intro.html#initialize-the-model

I hope these console outputs help in figuring this out. I am going to look in the code and hopefully find what causes the error.

Looking forward to hearing from you.

Regards,

MD

Warnings Installation GNOME

**Hello!

I'm installing PyGnome 0.6.2, when I run the tests, the following warnings appear:**

tests/unit_tests/test_outputters/test_geojson.py::test_geojson_multipoint_output
  C:\Users\CIOH - AROPE\Anaconda2\envs\gnome\lib\site-packages\numpy\lib\type_check.py:546: DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead
    'a.item() instead', DeprecationWarning, stacklevel=1)

tests/unit_tests/test_weatherers/test_dissolution.py::test_dissolution_k_ow[oil_bahia-311.15-3-1.03156e+12-True]
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\dissolution.py:389: RuntimeWarning: invalid value encountered in true_divide
    N_drop_a = ((C_dis / K_ow).T * (k_w / 3600.0)).T
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\dissolution.py:457: RuntimeWarning: divide by zero encountered in true_divide
    (c_oil / k_ow))
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\dissolution.py:464: RuntimeWarning: invalid value encountered in multiply
    return np.nan_to_num(N_s * arom_mask)

tests/unit_tests/test_weatherers/test_dissolution.py::test_full_run[oil_ans_mp-288.7-55.34]
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\dissolution.py:457: RuntimeWarning: invalid value encountered in true_divide
    (c_oil / k_ow))

tests/unit_tests/test_weatherers/test_dissolution.py::test_full_run_no_evap[benzene-288.15-9731.05479]
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\dissolution.py:170: RuntimeWarning: invalid value encountered in true_divide
    (fmasses / mol_wt).sum(axis=1))
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\dissolution.py:255: RuntimeWarning: invalid value encountered in true_divide
    avg_rho = (((masses.T / masses.sum(axis=1).T).T * densities)
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\dissolution.py:339: RuntimeWarning: invalid value encountered in true_divide
    mass_fractions = (masses.T / masses.sum(axis=1)).T
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\weathering_data.py:143: RuntimeWarning: invalid value encountered in divide
    data['mass'].reshape(len(data['mass']), -1))
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\weathering_data.py:153: RuntimeWarning: invalid value encountered in greater
    if np.any(new_rho > self.water.density):
  c:\users\cioh - arope\pygnome\py_gnome\gnome\weatherers\spreading.py:587: RuntimeWarning: invalid value encountered in power
    (thickness * rel_buoy * gravity)) ** (1. / 3.)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
= 1332 passed, 78 skipped, 19 xfailed, 4 xpassed, 438 warnings in 793.83 seconds =

I thought that the version of NumPy was too new, but to show error when i upgraded it
I don't know if this could be a problem in the future.

Thank for the help! :)

Leidy Castro
Msc Oceanography and marine environmental management

Stable release timeline?

Hello PyGnome developers,

Apologies for using an issue to ask this. Any estimate on when a stable release of PyGnome will be available? We are looking to use GNOME in our response tool but we're a Linux shop. Our initial plans were to run GNOME in a wrapper on a virtual machine (or via WINE?) but that approach would be painful at best. If a Python based GNOME2 is getting close to prime time, maybe we can be beta testers/guinea pigs?

what is the output format for continuous spill?

I am running the "A subsurface release" example on "http://noaa-orr-erd.github.io/PyGnome/scripting/mixedlayer_release.html?highlight=subsurface". Since the example is for instantaneous spill. I want to use expand the example to continuous spill. And then I write the code using subsurface_plume_spill model. But the model result is different. The variable 'pos' in my code every time has a different length. Anyone can explain why?

def make_model(rise_vel):

print 'initializing the model'
start_time = datetime(2010, 4, 20, 0, 0)
spill_time = datetime(2010,4, 20, 0 ,0)
end_time = datetime(2010,7,15,0,0)
model = Model(start_time=start_time, duration=timedelta(days=5),
              time_step=5 * 60, uncertain=False)     # start time is start time of model; duration is 

print 'adding the map'
model.map = GnomeMap(map_bounds=((-88.56694,28.93781),(-88.16694,28.93781),(-88.16694,28.53781),(-88.56694,28.53781)))

print 'adding spill'
ud = UniformDistribution(low=50e-6,high=50e-6)
spill = subsurface_plume_spill(num_elements=1000,
                               start_position=(-88.36694, 28.7381,1200),
                               release_time=start_time,
                               distribution=ud,
                               distribution_type='droplet_size',
                               end_release_time= end_time,
                               amount=5000,
                               substance='ALASKA NORTH SLOPE (MIDDLE PIPELINE)',
                               units='bbl',
                               windage_range=(0.01,0.02),
                               windage_persist=-1,
                               name='My spill')
model.spills += spill
print spill

if rise_vel:
    model.movers += RiseVelocityMover()

model.movers += RandomVerticalMover(vertical_diffusion_coef_above_ml=50,
                                    vertical_diffusion_coef_below_ml=.11,
                                    mixed_layer_depth=10)

return model

model = make_model(rise_vel=False)
t = np.empty((model.num_time_steps,59),datetime)
depths = np.empty((model.num_time_steps,59),)
print depths
print len(depths[0,:])
for i,step in enumerate(model):
t[i,:] = [model.model_time] * 59
sc = model.spills.items()[0]
pos = sc['positions']
print len(pos[:,2])

beached spill does not refloat

Dear GNOME developer, I apologize for opening an issue here.
I am using SUNTANS hydrodynamic model and NAM wind model to drive GNOME in Galveston Bay area. However, it doesn't appear that the beached spill will refloat. I have set the refloat_halflife to be one hour.
I can confirm the land and water is specified correct in GNOME. Can you given me any hint of what problem might be? Thank you in advance.

A problem/ Using ECMWF wind data

Dear all,
I want to use ECMWF wind data sets in PyGnome. When I execute the code, I get a Value Error: timestamp out of range for platform localtime()/gmtime() function.
For your information, I have used Pygnome with GFS wind data set, and it was OK, but the ECMWF wind data sets lead to an Value Error.

I have attached my script and the input files. I will appreciate if anyone can help me.

Gulf - Copy.zip

Issue with NetCDF Ocean Current and Wind Files Not Reading in Correctly in Model.Movers

Hello,
I have an issue with certain 3km NCOM Current and HRRR wind nc files causing errors in pyGNOME but others packaged/downloaded in the same way have no trouble running in pyGNOME. The formats for both the working and non-working nc files are the same including the variable/dimension names (dates are different though) and the data does not appear to be corrupt as I can still pull information from the NetCDF files and its is correct in both Python and Matlab. In addition the GNOME Desktop tool is able to use the file seemingly with no issue to cause a spill to move.

I have verified that when running a pyGNOME simulation the issue is indeed these problematic NetCDF files as I can remove the addition of the currents/winds to Model.Mover and the simulation runs correctly. I currently use a text file to point to the location of the Netcdf files containing the winds and ocean currents. Typically I download (same source for the working and non-working) the zipped NCOM data for a few days and package about 10 days of ocean currents into one NetCDF file that is formatted to run in pyGNOME and then run the model, which for the almost all cases works without issue. The code passes through the Model Setup but fails when the model is run when using the problematic nc files however. I have tried to download and package the data multiple times but with no success which could mean the downloaded data has something wrong, however the generated NetCDF file reads in correctly into GNOME Desktop which would make me the issue is potentially not the downloaded data.

Is there something specifically different for the requirements on a NetCDF mover input file for the GNOME Desktop tool and pyGNOME? Or any issue potentially with how certain data is formatted? In reason these files generated with the same script and methods wouldn't work in pyGNOME?

An error with weathering

Dear all,
When using PyGnome with weathering, I get an error "OperationalError: (sqlite3.OperationalError) unable to open database file".
I think this is because the model can not recognize the oil type. In the error address, I see there is something wrong with sqlalchemy module. my sqlalchemy module version is 1.0.13. My platform is windows 8 (64 bit).

Do you have any idea how can I solve this problem? Is this related to my sqlalchemy module version?

I have attached the simple code and map file.

Regards
Payam

Weathering.zip

CatsMover with Tide doesn't serialize correctly

Context:

Trying to serialize a model (trajectory only, so far) and reconstitute it later so we can run models in the background via celery. (working with proposed fix noted below!)

Issue:

The filename field of a Tide object inside of a CatsMover isn't serialized with its full path like it is inside of the CatsMover parent.

Tracing the calls and playing with IPython, I found the codepath it takes. I expected any Serializable to continue to call .serialize() on any child Serializable, but it seems to short-circuit with .to_dict() instead. Therefore, Tide.serialize, which is supposed to fix this attribute, is never called.

Looking back a bit in history for the Serializable class, I see that Serializable.to_dict used to take a json_ parameter (and is still documented that it does), but does not anymore as of 671499d when a bunch of things were refactored.

I am able to circumvent this by adding a Tide.filename_to_dict, which is a helper that Serializable.attr_to_dict calls - I am not sure this is the correct solution for all cases, though, as we've lost the json_ param and the (uncalled) Tide.serialize method only does that fixup when json_='save', although I don't why. If this is an acceptable fix I'll PR it:

class Tide(Environment, Serializable):
    ...
    def filename_to_dict(self):
        return self.cy_obj.path_filename

This is only for when the model is serialized with json_=webapi, aka the default. save has a different but similar issue.

Building PyGnome Error Fatal Netcdf in linux

Hi everyone!

I have tried to build pygnome in Linux but when I put "python setup.py develop" I get this error:

../lib_gnome/TimeGridVel_c.cpp:17:10: fatal error: netcdf.h: No existe el archivo o el directorio 17 | #include "netcdf.h

I have already verified that the netcdf4 library is installed

Captura_error

and I don't know if there is something else that I am missing.

Thanks for your help :)

ImportError: No module named gnome

Hi Chris et al.

I'm getting back into pygnome and have run into an issue when running the test scripts with the following error:

ImportError: No module named gnome

Strange thing is that I've run the tests successfully before. Hopefully something simple. Any ideas?

Thanks

Rob

Missing packages for linux32

Checking conda requirements using (conda install --file conda_requirements.txt )
I am Getting the Output as below...

Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata .........
Solving package specifications: .
Error: Packages missing in current linux-32 channels:

  • py_gd
  • testfixtures
  • regex

Unable to find these packages suitable for linux-32.
Please help to install the requirements in my linux-32 channels.
Thanks!

Model Environment (water+wind+wave)

Dear all,
I have prepared my thesis model for final run, and everything has been good ( for the 2D part). I have some questions regarding the weathering part of the model. It seems that this part of the model covers less details, compared to other parts.
I want to know what are the most advanced capabilities that I can use for getting the most realistic results. For example:
1- For "water" environment, I define water with a fixed temperature and salinity as a global object:

water = Water(temperature=280.928, salinity=35)

Is it possible to define water object based on gridded field of temperature? (temperature variable in space and time, or only variable in time)

2- For "wind" environment, can I use the gridded wind data set which I use as wind mover? Is wind direction a very important parameter?

3- How does the "waves" environment function work? does it generate wave data based on defined wind and water environment? Which method does it use?

4- Is there a weathering module for considering the effect of photo-oxidation or sedimentation?

Best regards
Payam

GridWindMover not contributing to trajectories

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.

gnome utilities error

Sorry for Troubling you Again.
Now I have working with Ubuntu 14.04 64-bit version.
All Packages were installed .
While trying for py.test it throws error like

from gnome.utilities import rand
ImportError: No module named gnome.utilities

While searched for the solution , I got this command as a solution.
sudo apt-get install unity-tweak-tool gnome-tweak-tool

But After Executing the command also , I am getting the same error.
ImportError: No module named gnome.utilities

Thanks in Advance!!!

Gnome output with time sequence

Hi,

I would like to run PyGnome using ROMS output and when I tried to run PyGnome for non-weathering particles with 5 day forecast model outputs, the dimension of the locations (longitude and latitude) did not have time dimension. The metadata of the gnome netcdf output is as follow. I was expecting to get the dimension of the particle locations as (time,data) rather than (data). And the same for depth. What did I do wrong? I checked script_ny_roms script to create my own run script. It created multiple figure files, though.

Thanks,

DJ

DJ Kobashi
Dept. of Oceanography
Texas A&M University

netcdf txla_gnome {
dimensions:
time = UNLIMITED ; // (121 currently)
data = UNLIMITED ; // (3441 currently)
two = 2 ;
three = 3 ;
variables:
double time(time) ;
time:comment = "unspecified time zone" ;
time:long_name = "time since the beginning of the simulation" ;
time:standard_name = "time" ;
time:calendar = "gregorian" ;
time:units = "seconds since 2017-04-10T00:00:00" ;
int particle_count(time) ;
particle_count:units = "1" ;
particle_count:long_name = "number of particles in a given timestep" ;
particle_count:ragged_row_count = "particle count at nth timestep" ;
ushort spill_num(data) ;
spill_num:long_name = "spill to which the particle belongs" ;
spill_num:spills_map = "0: Spill, " ;
double longitude(data) ;
longitude:units = "degrees_east" ;
longitude:long_name = "longitude of the particle" ;
longitude:standard_name = "longitude" ;
int age(data) ;
age:units = "seconds" ;
age:long_name = "age of particle from time of release" ;
double depth(data) ;
depth:units = "meters" ;
depth:long_name = "particle depth below sea surface" ;
depth:standard_name = "depth" ;
depth:axis = "z positive down" ;
double mass(data) ;
mass:units = "kilograms" ;
mass:long_name = "mass of particle" ;
double latitude(data) ;
latitude:units = "degrees_north" ;
latitude:long_name = "latitude of the particle" ;
latitude:standard_name = "latitude" ;
short status_codes(data) ;
status_codes:flag_meanings = "0: not_released, 2: in_water, 3: on_land, 7: off_maps, 10: evaporated, 12: to_be_removed," ;
status_codes:long_name = "particle status code" ;
status_codes:flag_values = "7 12 0 10 2 3" ;
uint id(data) ;
id:long_name = "particle ID" ;

// global attributes:
:comment = "Particle output from the NOAA PyGnome model" ;
:feature_type = "particle_trajectory" ;
:conventions = "CF-1.6" ;
:source = "PyGnome version v0.0.4" ;
:references = "TBD" ;
:institution = "NOAA Emergency Response Division" ;
:creation_date = "2017-04-11T09:50:27" ;

Building py_gnome w/ Linux, cannot find netcdf.h

I have successfully built py_gnome on a windows based machine, but I am trying to build it on a Linux machine running Ubuntu 16.04 LTS. When I run python setup.py install from ../py_gnome I get a bunch of warnings, but then get this error:

../lib_gnome/TimeGridVel_c.cpp:17:20: fatal error: netcdf.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

I looked and netcdf.h is stored in the directory third_party_lib/.. but the setup.py only checks:
if sys.platform is "darwin" or "win32":
For me sys.platform equals linux2.
So I don't think the correct directory is being assigned for finding netcdf files.

Clean-up options

Dear friends,
I have some questions about three clean-up options in PyGnome: Skimmer, Burn and ChemicalDispersion.
When I activate these options in my model, I see that visually the clean-up operations have no effect on the spill trajectory. Apparently, these operations only reduce the mass of LEs and do not change their path, at all. I checked the code in detail, and noted that when, for example, a skimmer is activated in the model, a number of LEs are marked for skimming. I would like to know:
1- How these LEs are selected and marked? are all LEs are selected? Is it possible to mark a certain set of LEs?
2- Is it possible to define, for example, a specific skimmer in a certain location? for example, a skimmer at a location 20 km far from the source? or, a dispersant to be applied for only one branch of the oil slick in a certain location?
3- Is it possible to confine/trap the LEs by boom (to stop their transport?)

Also, if possible please let me know if there is a guideline on the mathematical fundamentals of these operations in PyGnome (e.g. the meaning of fraction_sprayed in ChemicalDispesion).

Best Regards
Payam Amir-Heidari

Is it possible to run PyGnome using Jupyter Notebooks?

Hello!

I'm stating with PyGnome after a while on the desktop version. I found it very useful to work with Jupyter Notebooks, specially because I intend to fill the scripts with explanations and topics.

How can I use the notebook in the gnome environment? I tried to open it from the conda prompt from inside the environment, but id doesn't seem to work.

Thanks.

Expected output types from PyGnome

Hello NOAA folks!

In the desktop version I used to save the simulations in NOAA Standard Splot File Series format in order to run some post-processing like drawing slick boundaries, estimating area etc. I noticed the new geojson format, which was completely new for me. My question is, are you going to stick to geojson format or we should expect other options, including the ones which are available at the desktop version? What is the idea behind the change for this new format?

Look forward to hearing from you.

Cheers!

PyGridCurrentMover function not availabke.

Dear all,

I installed PyGNOME like a week or two ago on my local computer and it has gnome.movers.py_current_mover.PyGridCurrentMover. Then I installed PyGNOME on another machine (cluster) a couple of days ago and the above function is not available. I created run script based on script_ny_roms.py as I use ROMS output as current input.

Have you updated the function and Is there any alternative function to use?
The lines I am taking about are the following where url is the OPeNDAP address of ROMS output history file.

cf = GridCurrent.from_netCDF((url))
u_mover = PyGridCurrentMover(cf, default_num_method='Euler')
model.movers += u_mover

Thanks in advance.

DJ Kobashi

NetCDF2CUR

I have a couple .NC files that I need to convert to .cur file so that I can open them in my model. So far I have been able to read in all the data using the NetCDF library. The only thing left for me to do is create the .cur file. Now, I was thinking about simply creating a .cur file and using fwrite to write the data to the file. I am not sure if this will work.

Is there a library I missed or something that is specified to perform such an action.

Thanks in advance

Can we generate standard oils?

Robert posed this question to me.

Can we generate a standard oil based on input criteria (maybe starting with what we already use, which is density and kinematic viscosity)?
The proposal is that we query the oils in our oil database based on the ranged criteria, and use the (weighted?) average of the measured values to construct a standard oil that fits the criteria.

This could be general functionality to put into the oil_library module so that PyGnome could use it, and the oil library API could have this feature as well for the web client to use.

Python 3 roadmap

Hi,
pygnome is now python 2. python 2 will not be maintained after 2020/01/01
Have there been any discussions about porting to python 3 ?
Are there any known blockers ?
We may have some budget to work on it. are there people that could help us ?
Thanks

A web interface for PyGnome

Dear all,

As far as I checked, it seems that PyGNOME is capable of porting it on the web so that PyGNOME can be run with a custom setting (e.g. particle location (lon,lat,depth), type of oils to be tracked and the amount) selected by users.

I am interested in setting up a web interface like the following websites so that users can run PyGNOME and track particles (e.g. crude oil) with our model output (based on ROMS).
http://omgsrv1.meas.ncsu.edu:8080/ocean-circulation-useast2/trajectory.jsp
http://www.csiro.au/connie2/
https://ourocean.jpl.nasa.gov/SCB/scbmangen.jsp

I found a few tools NOAA-ORR-ERD provides. However, it's a bit confusing as to how I use each (or all) of the available tools. For example, PyGNOME has a directory called web/gnome. Yet, there are tools called WebGnomeClient and WebGnomeAPI. I wonder if anyone has some tutorial that I can follow to use those tools and to set up a web interface.

Thanks in advance.

DJ Kobashi
Dept of Oceanography
Texas A&M Univ.

Gnome.scripting: is there more info available?

Hello all!

This PyGnome thing is very exciting. I find it a way clever way of doing those simulations, mainly because everyone of them is a different challenge now. You've done a nice job there NOAA staff.

I've been trying to understand the difference between using a release function available at the spill module and a helper function available at the scripting utilities. Is there any? I mean, for instance, there is a point_line_release in both of those modules. Which one should I use? And why there is a GridRealease in the spill module, but if I look for a uniform distribution I have to call the scripting again?

Maybe because there's not enough documentation on the scripting utilities section I am missing something.

Look to hear from you, guys.
Cheers!

Problem running installation script

Hi,
I'm trying to install pyGnome on Windows 10 and have been following the instructions. All good until running the setup script:
python setup.py develop
where I get an error:
pygnome setup script screen grab
Hopefully something simple.
Thanks and I look forward to hearing from you.
Regards
Rob

no HYCOM_3d.nc for "script_gulf_tamoc.py"

Hi, when I run the 'script_gulf_tamoc.py' file, there is no file named 'HYCOM_3d.nc'. The same thing happened to "script_arctic_tamoc.py", can anyone upload the files? Thanks.

Import Error: No module named osgeo

Dear Sir,
When running the script_runner, I have an import error: no module named osgeo.
I had a similar problem with unit_conversion module, and I updated it manually; it worked.

The problem is that I can not find "osgeo" module neither in Anaconda.org or GitHub.

would you mind please upload it?

Sincerely
Payam

Add CZML output option

We're currently using KML to display the trajectories in TerriaJS. Because TerriaJS is based on Cesium, we think we can get better animation performance and display control by using CZML instead.

conda install py_gnome?

I'm a bit confused. I see an environment.yml file here to build a py_gnome custom environment:
https://github.com/NOAA-ORR-ERD/PyGnome/blob/master/py_gnome/environment.yml
which worked fine when I did

conda env create environment.yml

but the resulting environment does not contain py_gnome or gnome. Thus running one of the scripts in this environment results in

---> 19 from gnome import scripting
     20 from gnome.basic_types import datetime_value_2d
     21 

ImportError: No module named gnome

I then looked for py_gnome (or something similar) on the NOAA-ORR-ERD channel at https://anaconda.org/NOAA-ORR-ERD/packages but did not find anything that looked suitable.

I see a conda-recipe in https://github.com/NOAA-ORR-ERD/PyGnome/tree/master/py_gnome/py_gnome_conda_recipe but it looks old, and there is no build.bat file.

What is the easiest way to get py_gnome installed into my py_gnome environment with Anaconda on windows?

Building and linking the libgnome shared lib

The code in

PyGnome/py_gnome/setup.py

Lines 454 to 460 in 0ecb501

libpath = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'gnome', 'cy_gnome')
## Need this for finding lib during linking and at runtime
## using -rpath to define runtime path. Use $ORIGIN to define libgnome.so
## relative to cy_*.so
os.environ['LDFLAGS'] = "-L{0} -Wl,-rpath='$ORIGIN'".format(libpath)

sets libpath with libpath = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'gnome', 'cy_gnome')

I guess that this will point to the source at py_gnome/gnome/cy_gnome and not the libgnome.so.

That breaks python setup.py build. However, python setup.py install does work due to a hard-coded path in

bdir = glob.glob(os.path.join('build/*/gnome/cy_gnome', 'libgnome.so'))
. That makes it difficult to create a re-relocatable conda package by forcing us to set the a LD_LIBRARY_PATH pointing to where libgnome is.

Full trajectories/paths in netcdf output

Hi all,

I noticed that the WebGnomeAPI/Client projects allow you to download a zip file of your model run, containing two .nc files - both appear to be finishing positions (last timestep) of each particle in the simulation. Code to generate that appears to be here.

Ultimately, we'd like a trajectory for each particle over the entire model run, not just the single timestep. I'm assuming this is not possible now, but wondering what kind of modifications can be done to support such a thing. I'm thinking it involves executing a similar method to _save_spill_data every time a timestep is computed.

Thoughts?

TAMOC test case

Hi,

I was trying to run the script_tamoc.py to test the tamoc - gnome coupling. However, I ended up with following error message. Can someone advise what is going on?

(gnome0.6) vihangs-MacBook-Pro:script_tamoc vihang$ ipython script_tamoc.py
/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/scipy/optimize/minpack.py:785: OptimizeWarning: Covariance of the parameters could not be estimated
category=OptimizeWarning)
images_dir is: /Users/vihang/pygnome0.6/PyGnome/py_gnome/scripts/script_tamoc/images
removing... /Users/vihang/pygnome0.6/PyGnome/py_gnome/scripts/script_tamoc/images
initializing the model
adding the map
adding outputters
removed script_plume.nc
adding Horizontal and Vertical diffusion
adding Rise Velocity
adding a circular current and eastward current
Adding TAMOC spill
about to start running the model
Starting animation

ValueError Traceback (most recent call last)
/Users/vihang/pygnome0.6/PyGnome/py_gnome/scripts/script_tamoc/script_tamoc.py in ()
136 model = make_model()
137 print "about to start running the model"
--> 138 for step in model:
139 print step['step_num']
140 if step['step_num'] == 23:

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/pyGnome-0.6.0-py2.7-macosx-10.9-x86_64.egg/gnome/model.pyc in next(self)
1011 :return: the step number
1012 '''
-> 1013 return self.step()
1014
1015 def full_run(self, rewind=True):

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/pyGnome-0.6.0-py2.7-macosx-10.9-x86_64.egg/gnome/model.pyc in step(self)
972 # release particles for next step - these particles will be aged
973 # in the next step
--> 974 num_released = sc.release_elements(self.time_step, self.model_time)
975
976 # initialize data - currently only weatherers do this so cycle

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/pyGnome-0.6.0-py2.7-macosx-10.9-x86_64.egg/gnome/spill_container.pyc in release_elements(self, time_step, model_time)
889 # only spills that are included here - no need to check
890 # spill.on flag
--> 891 num_rel = spill.num_elements_to_release(model_time, time_step)
892 if num_rel > 0:
893 # update 'spill_num' ArrayType's initial_value so it

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/pyGnome-0.6.0-py2.7-macosx-10.9-x86_64.egg/gnome/tamoc/tamoc_spill.pyc in num_elements_to_release(self, current_time, time_step)
598 return 0
599
--> 600 self.droplets= self.run_tamoc(current_time, time_step)
601
602 duration = (self.end_release_time - self.release_time).total_seconds()

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/pyGnome-0.6.0-py2.7-macosx-10.9-x86_64.egg/gnome/tamoc/tamoc_spill.pyc in run_tamoc(self, current_time, time_step)
333 if self.last_tamoc_time is None:
334 self.last_tamoc_time = current_time
--> 335 self.droplets, self.diss_components = self._run_tamoc()
336 return self.droplets
337

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/pyGnome-0.6.0-py2.7-macosx-10.9-x86_64.egg/gnome/tamoc/tamoc_spill.pyc in _run_tamoc(self)
393 depths = tp['depths']
394
--> 395 profile = self.get_profile(nc_file, fname_ctd, ua, va, wa, depths)
396
397 # Get the release fluid composition

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/pyGnome-0.6.0-py2.7-macosx-10.9-x86_64.egg/gnome/tamoc/tamoc_spill.pyc in get_profile(self, nc_name, fname, u_a, v_a, w_a, depths)
755 P_data = np.vstack((data[:, 0], P)).transpose()
756 nc = ambient.fill_nc_db(nc, P_data, ['z', 'pressure'], ['m', 'Pa'],
--> 757 ['average', 'computed'], 0)
758
759 # Create an ambient.Profile object from this dataset

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/tamoc/ambient.pyc in fill_nc_db(nc, data, var_symbols, var_units, comments, z_col)
1000 interp_data = np.zeros((z.shape[0],ny+1))
1001 interp_data[:,z_col] = z[:]
-> 1002 interp_data[:,y_cols] = f(z[:]).transpose()
1003 data = np.copy(interp_data)
1004

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/scipy/interpolate/polyint.pyc in call(self, x)
76
77 """
---> 78 x, x_shape = self._prepare_x(x)
79 y = self._evaluate(x)
80 return self._finish_y(y, x_shape)

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/scipy/interpolate/polyint.pyc in _prepare_x(self, x)
88 def _prepare_x(self, x):
89 """Reshape input x array to 1-D"""
---> 90 x = _asarray_validated(x, check_finite=False, as_inexact=True)
91 x_shape = x.shape
92 return x.ravel(), x_shape

/Users/vihang/anaconda2/envs/gnome0.6/lib/python2.7/site-packages/scipy/_lib/_util.pyc in _asarray_validated(a, check_finite, sparse_ok, objects_ok, mask_ok, as_inexact)
234 if not mask_ok:
235 if np.ma.isMaskedArray(a):
--> 236 raise ValueError('masked arrays are not supported')
237 toarray = np.asarray_chkfinite if check_finite else np.asarray
238 a = toarray(a)

ValueError: masked arrays are not supported

GridWind object does not support indexing

Hi

I tried to run PyGNOME with ROMS output and I had the following error I did not have before.

adding a wind mover:
Traceback (most recent call last):
  File "run_pygnome_ensembles.py", line 243, in <module>
    model = make_model(gridfile,datafile,start_time,duration,netcdf_file = outfile, location_file=loc_file)
  File "run_pygnome_ensembles.py", line 128, in make_model
    w_mover = PyWindMover(wf, default_num_method='Euler')  
  File "/home/dj/software/PyGnome/py_gnome/gnome/movers/py_wind_movers.py", line 98, in __init__
    **kwargs)
  File "/home/dj/anaconda2/envs/gnome/lib/python2.7/site-packages/gridded/variable.py", line 764, in from_netCDF
    ds = dg = get_dataset(grid_file)
  File "/home/dj/anaconda2/envs/gnome/lib/python2.7/site-packages/gridded/utilities.py", line 370, in get_dataset
    return nc4.MFDataset(ncfile)
  File "netCDF4/_netCDF4.pyx", line 6108, in netCDF4._netCDF4.MFDataset.__init__
TypeError: 'GridWind' object does not support indexing

The line of the code which caused the error is below.

    print 'adding a wind mover:'
    wf = GridWind.from_netCDF(url,varnames=['Uwind','Vwind'])
    w_mover = PyWindMover(wf, default_num_method='Euler')
    model.movers += w_mover

NetCDF file metadata is below. I extracted surface layer using NCO to run PyGNOME. I was told PyGNOME should run without any modifications.

netcdf TXLA2.ocn.his.2016_03_12_c00_surf {
dimensions:
	tracer = 2 ;
	s_rho = 1 ;
	s_w = 1 ;
	ocean_time = UNLIMITED ; // (1344 currently)
	eta_rho = 191 ;
	xi_rho = 671 ;
	eta_psi = 190 ;
	xi_psi = 670 ;
	eta_u = 191 ;
	xi_u = 670 ;
	eta_v = 190 ;
	xi_v = 671 ;
variables:
	double Akk_bak ;
		Akk_bak:long_name = "background vertical mixing coefficient for turbulent energy" ;
		Akk_bak:units = "meter2 second-1" ;
	double Akp_bak ;
		Akp_bak:long_name = "background vertical mixing coefficient for length scale" ;
		Akp_bak:units = "meter2 second-1" ;
	double Akt_bak(tracer) ;
		Akt_bak:long_name = "background vertical mixing coefficient for tracers" ;
		Akt_bak:units = "meter2 second-1" ;
	double Akv_bak ;
		Akv_bak:long_name = "background vertical mixing coefficient for momentum" ;
		Akv_bak:units = "meter2 second-1" ;
	double Charnok_alpha ;
		Charnok_alpha:long_name = "Charnok factor for surface roughness" ;
	double CrgBan_cw ;
		CrgBan_cw:long_name = "surface flux due to Craig and Banner wave breaking" ;
	double Cs_r(s_rho) ;
		Cs_r:long_name = "S-coordinate stretching curves at RHO-points" ;
		Cs_r:valid_min = -1. ;
		Cs_r:valid_max = 0. ;
		Cs_r:field = "Cs_r, scalar" ;
	double Cs_w(s_w) ;
		Cs_w:long_name = "S-coordinate stretching curves at W-points" ;
		Cs_w:valid_min = -1. ;
		Cs_w:valid_max = 0. ;
		Cs_w:field = "Cs_w, scalar" ;
	double Falpha ;
		Falpha:long_name = "Power-law shape barotropic filter parameter" ;
	double Fbeta ;
		Fbeta:long_name = "Power-law shape barotropic filter parameter" ;
	double Fgamma ;
		Fgamma:long_name = "Power-law shape barotropic filter parameter" ;
	int Lm2CLM ;
		Lm2CLM:long_name = "2D momentum climatology processing switch" ;
		Lm2CLM:flag_values = 0, 1 ;
		Lm2CLM:flag_meanings = ".FALSE. .TRUE." ;
	int Lm3CLM ;
		Lm3CLM:long_name = "3D momentum climatology processing switch" ;
		Lm3CLM:flag_values = 0, 1 ;
		Lm3CLM:flag_meanings = ".FALSE. .TRUE." ;
	int LnudgeM2CLM ;
		LnudgeM2CLM:long_name = "2D momentum climatology nudging activation switch" ;
		LnudgeM2CLM:flag_values = 0, 1 ;
		LnudgeM2CLM:flag_meanings = ".FALSE. .TRUE." ;
	int LnudgeM3CLM ;
		LnudgeM3CLM:long_name = "3D momentum climatology nudging activation switch" ;
		LnudgeM3CLM:flag_values = 0, 1 ;
		LnudgeM3CLM:flag_meanings = ".FALSE. .TRUE." ;
	int LnudgeTCLM(tracer) ;
		LnudgeTCLM:long_name = "tracer climatology nudging activation switch" ;
		LnudgeTCLM:flag_values = 0, 1 ;
		LnudgeTCLM:flag_meanings = ".FALSE. .TRUE." ;
	int LsshCLM ;
		LsshCLM:long_name = "sea surface height climatology processing switch" ;
		LsshCLM:flag_values = 0, 1 ;
		LsshCLM:flag_meanings = ".FALSE. .TRUE." ;
	int LtracerCLM(tracer) ;
		LtracerCLM:long_name = "tracer climatology processing switch" ;
		LtracerCLM:flag_values = 0, 1 ;
		LtracerCLM:flag_meanings = ".FALSE. .TRUE." ;
	int LtracerSponge(tracer) ;
		LtracerSponge:long_name = "horizontal diffusivity sponge activation switch" ;
		LtracerSponge:flag_values = 0, 1 ;
		LtracerSponge:flag_meanings = ".FALSE. .TRUE." ;
	int LtracerSrc(tracer) ;
		LtracerSrc:long_name = "tracer point sources and sink activation switch" ;
		LtracerSrc:flag_values = 0, 1 ;
		LtracerSrc:flag_meanings = ".FALSE. .TRUE." ;
	int LuvSponge ;
		LuvSponge:long_name = "horizontal viscosity sponge activation switch" ;
		LuvSponge:flag_values = 0, 1 ;
		LuvSponge:flag_meanings = ".FALSE. .TRUE." ;
	int LuvSrc ;
		LuvSrc:long_name = "momentum point sources and sink activation switch" ;
		LuvSrc:flag_values = 0, 1 ;
		LuvSrc:flag_meanings = ".FALSE. .TRUE." ;
	int LwSrc ;
		LwSrc:long_name = "mass point sources and sink activation switch" ;
		LwSrc:flag_values = 0, 1 ;
		LwSrc:flag_meanings = ".FALSE. .TRUE." ;
	double M2nudg ;
		M2nudg:long_name = "2D momentum nudging/relaxation inverse time scale" ;
		M2nudg:units = "day-1" ;
	double M3nudg ;
		M3nudg:long_name = "3D momentum nudging/relaxation inverse time scale" ;
		M3nudg:units = "day-1" ;
	float Pair(ocean_time, eta_rho, xi_rho) ;
		Pair:long_name = "surface air pressure" ;
		Pair:units = "millibar" ;
		Pair:time = "ocean_time" ;
		Pair:coordinates = "lon_rho lat_rho ocean_time" ;
		Pair:field = "Pair, scalar, series" ;
		Pair:_FillValue = 1.e+37f ;
	double Tcline ;
		Tcline:long_name = "S-coordinate surface/bottom layer width" ;
		Tcline:units = "meter" ;
	double Tnudg(tracer) ;
		Tnudg:long_name = "Tracers nudging/relaxation inverse time scale" ;
		Tnudg:units = "day-1" ;
	float Uwind(ocean_time, eta_rho, xi_rho) ;
		Uwind:long_name = "surface u-wind component" ;
		Uwind:units = "meter second-1" ;
		Uwind:time = "ocean_time" ;
		Uwind:coordinates = "lon_rho lat_rho ocean_time" ;
		Uwind:field = "u-wind, scalar, series" ;
		Uwind:_FillValue = 1.e+37f ;
	int Vstretching ;
		Vstretching:long_name = "vertical terrain-following stretching function" ;
	int Vtransform ;
		Vtransform:long_name = "vertical terrain-following transformation equation" ;
	float Vwind(ocean_time, eta_rho, xi_rho) ;
		Vwind:long_name = "surface v-wind component" ;
		Vwind:units = "meter second-1" ;
		Vwind:time = "ocean_time" ;
		Vwind:coordinates = "lon_rho lat_rho ocean_time" ;
		Vwind:field = "v-wind, scalar, series" ;
		Vwind:_FillValue = 1.e+37f ;
	double Znudg ;
		Znudg:long_name = "free-surface nudging/relaxation inverse time scale" ;
		Znudg:units = "day-1" ;
	double Zob ;
		Zob:long_name = "bottom roughness" ;
		Zob:units = "meter" ;
	double Zos ;
		Zos:long_name = "surface roughness" ;
		Zos:units = "meter" ;
	double Zos_hsig_alpha ;
		Zos_hsig_alpha:long_name = "wave amplitude factor for surface roughness" ;
	double angle(eta_rho, xi_rho) ;
		angle:long_name = "angle between XI-axis and EAST" ;
		angle:units = "radians" ;
		angle:coordinates = "lon_rho lat_rho" ;
		angle:field = "angle, scalar" ;
	int deflate ;
		deflate:long_name = "NetCDF-4/HDF5 file format deflate filer flag" ;
	int deflate_level ;
		deflate_level:long_name = "NetCDF-4/HDF5 file format deflate level parameter" ;
	double dstart ;
		dstart:long_name = "time stamp assigned to model initilization" ;
		dstart:units = "days since 1970-01-01 00:00:00" ;
	double dt ;
		dt:long_name = "size of long time-steps" ;
		dt:units = "second" ;
	double dtfast ;
		dtfast:long_name = "size of short time-steps" ;
		dtfast:units = "second" ;
	double el ;
		el:long_name = "domain length in the ETA-direction" ;
		el:units = "meter" ;
	double f(eta_rho, xi_rho) ;
		f:long_name = "Coriolis parameter at RHO-points" ;
		f:units = "second-1" ;
		f:coordinates = "lon_rho lat_rho" ;
		f:field = "coriolis, scalar" ;
	double gamma2 ;
		gamma2:long_name = "slipperiness parameter" ;
	double gls_Kmin ;
		gls_Kmin:long_name = "minimum value of specific turbulent kinetic energy" ;
	double gls_Pmin ;
		gls_Pmin:long_name = "minimum Value of dissipation" ;
	double gls_c1 ;
		gls_c1:long_name = "shear production coefficient" ;
	double gls_c2 ;
		gls_c2:long_name = "dissipation coefficient" ;
	double gls_c3m ;
		gls_c3m:long_name = "buoyancy production coefficient (minus)" ;
	double gls_c3p ;
		gls_c3p:long_name = "buoyancy production coefficient (plus)" ;
	double gls_cmu0 ;
		gls_cmu0:long_name = "stability coefficient" ;
	double gls_m ;
		gls_m:long_name = "turbulent kinetic energy exponent" ;
	double gls_n ;
		gls_n:long_name = "turbulent length scale exponent" ;
	double gls_p ;
		gls_p:long_name = "stability exponent" ;
	double gls_sigk ;
		gls_sigk:long_name = "constant Schmidt number for TKE" ;
	double gls_sigp ;
		gls_sigp:long_name = "constant Schmidt number for PSI" ;
	double h(eta_rho, xi_rho) ;
		h:long_name = "bathymetry at RHO-points" ;
		h:units = "meter" ;
		h:coordinates = "lon_rho lat_rho" ;
		h:field = "bath, scalar" ;
	double hc ;
		hc:long_name = "S-coordinate parameter, critical depth" ;
		hc:units = "meter" ;
	double lat_psi(eta_psi, xi_psi) ;
		lat_psi:long_name = "latitude of PSI-points" ;
		lat_psi:units = "degree_north" ;
		lat_psi:standard_name = "latitude" ;
		lat_psi:field = "lat_psi, scalar" ;
	double lat_rho(eta_rho, xi_rho) ;
		lat_rho:long_name = "latitude of RHO-points" ;
		lat_rho:units = "degree_north" ;
		lat_rho:standard_name = "latitude" ;
		lat_rho:field = "lat_rho, scalar" ;
	double lat_u(eta_u, xi_u) ;
		lat_u:long_name = "latitude of U-points" ;
		lat_u:units = "degree_north" ;
		lat_u:standard_name = "latitude" ;
		lat_u:field = "lat_u, scalar" ;
	double lat_v(eta_v, xi_v) ;
		lat_v:long_name = "latitude of V-points" ;
		lat_v:units = "degree_north" ;
		lat_v:standard_name = "latitude" ;
		lat_v:field = "lat_v, scalar" ;
	double lon_psi(eta_psi, xi_psi) ;
		lon_psi:long_name = "longitude of PSI-points" ;
		lon_psi:units = "degree_east" ;
		lon_psi:standard_name = "longitude" ;
		lon_psi:field = "lon_psi, scalar" ;
	double lon_rho(eta_rho, xi_rho) ;
		lon_rho:long_name = "longitude of RHO-points" ;
		lon_rho:units = "degree_east" ;
		lon_rho:standard_name = "longitude" ;
		lon_rho:field = "lon_rho, scalar" ;
	double lon_u(eta_u, xi_u) ;
		lon_u:long_name = "longitude of U-points" ;
		lon_u:units = "degree_east" ;
		lon_u:standard_name = "longitude" ;
		lon_u:field = "lon_u, scalar" ;
	double lon_v(eta_v, xi_v) ;
		lon_v:long_name = "longitude of V-points" ;
		lon_v:units = "degree_east" ;
		lon_v:standard_name = "longitude" ;
		lon_v:field = "lon_v, scalar" ;
	double mask_psi(eta_psi, xi_psi) ;
		mask_psi:long_name = "mask on psi-points" ;
		mask_psi:flag_values = 0., 1. ;
		mask_psi:flag_meanings = "land water" ;
		mask_psi:coordinates = "lon_psi lat_psi" ;
	double mask_rho(eta_rho, xi_rho) ;
		mask_rho:long_name = "mask on RHO-points" ;
		mask_rho:flag_values = 0., 1. ;
		mask_rho:flag_meanings = "land water" ;
		mask_rho:coordinates = "lon_rho lat_rho" ;
	double mask_u(eta_u, xi_u) ;
		mask_u:long_name = "mask on U-points" ;
		mask_u:flag_values = 0., 1. ;
		mask_u:flag_meanings = "land water" ;
		mask_u:coordinates = "lon_u lat_u" ;
	double mask_v(eta_v, xi_v) ;
		mask_v:long_name = "mask on V-points" ;
		mask_v:flag_values = 0., 1. ;
		mask_v:flag_meanings = "land water" ;
		mask_v:coordinates = "lon_v lat_v" ;
	int nHIS ;
		nHIS:long_name = "number of time-steps between history records" ;
	int nRST ;
		nRST:long_name = "number of time-steps between restart records" ;
	int nSTA ;
		nSTA:long_name = "number of time-steps between stations records" ;
	int ndefHIS ;
		ndefHIS:long_name = "number of time-steps between the creation of history files" ;
	int ndtfast ;
		ndtfast:long_name = "number of short time-steps" ;
	double nl_tnu2(tracer) ;
		nl_tnu2:long_name = "nonlinear model Laplacian mixing coefficient for tracers" ;
		nl_tnu2:units = "meter2 second-1" ;
	double nl_visc2 ;
		nl_visc2:long_name = "nonlinear model Laplacian mixing coefficient for momentum" ;
		nl_visc2:units = "meter2 second-1" ;
	int ntimes ;
		ntimes:long_name = "number of long time-steps" ;
	double ocean_time(ocean_time) ;
		ocean_time:long_name = "time since initialization" ;
		ocean_time:units = "seconds since 1970-01-01 00:00:00" ;
		ocean_time:calendar = "gregorian" ;
		ocean_time:field = "time, scalar, series" ;
	double pm(eta_rho, xi_rho) ;
		pm:long_name = "curvilinear coordinate metric in XI" ;
		pm:units = "meter-1" ;
		pm:coordinates = "lon_rho lat_rho" ;
		pm:field = "pm, scalar" ;
	double pn(eta_rho, xi_rho) ;
		pn:long_name = "curvilinear coordinate metric in ETA" ;
		pn:units = "meter-1" ;
		pn:coordinates = "lon_rho lat_rho" ;
		pn:field = "pn, scalar" ;
	double rdrg ;
		rdrg:long_name = "linear drag coefficient" ;
		rdrg:units = "meter second-1" ;
	double rdrg2 ;
		rdrg2:long_name = "quadratic drag coefficient" ;
	double rho0 ;
		rho0:long_name = "mean density used in Boussinesq approximation" ;
		rho0:units = "kilogram meter-3" ;
	double s_rho(s_rho) ;
		s_rho:long_name = "S-coordinate at RHO-points" ;
		s_rho:valid_min = -1. ;
		s_rho:valid_max = 0. ;
		s_rho:positive = "up" ;
		s_rho:standard_name = "ocean_s_coordinate_g2" ;
		s_rho:formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc" ;
		s_rho:field = "s_rho, scalar" ;
	double s_w(s_w) ;
		s_w:long_name = "S-coordinate at W-points" ;
		s_w:valid_min = -1. ;
		s_w:valid_max = 0. ;
		s_w:positive = "up" ;
		s_w:standard_name = "ocean_s_coordinate_g2" ;
		s_w:formula_terms = "s: s_w C: Cs_w eta: zeta depth: h depth_c: hc" ;
		s_w:field = "s_w, scalar" ;
	float salt(ocean_time, s_rho, eta_rho, xi_rho) ;
		salt:long_name = "salinity" ;
		salt:time = "ocean_time" ;
		salt:coordinates = "lon_rho lat_rho s_rho ocean_time" ;
		salt:field = "salinity, scalar, series" ;
		salt:_FillValue = 1.e+37f ;
	float shflux(ocean_time, eta_rho, xi_rho) ;
		shflux:long_name = "surface net heat flux" ;
		shflux:units = "watt meter-2" ;
		shflux:negative_value = "upward flux, cooling" ;
		shflux:positive_value = "downward flux, heating" ;
		shflux:time = "ocean_time" ;
		shflux:coordinates = "lon_rho lat_rho ocean_time" ;
		shflux:field = "surface heat flux, scalar, series" ;
		shflux:_FillValue = 1.e+37f ;
	int shuffle ;
		shuffle:long_name = "NetCDF-4/HDF5 file format shuffle filer flag" ;
	int spherical ;
		spherical:long_name = "grid type logical switch" ;
		spherical:flag_values = 0, 1 ;
		spherical:flag_meanings = "Cartesian spherical" ;
	float ssflux(ocean_time, eta_rho, xi_rho) ;
		ssflux:long_name = "surface net salt flux, (E-P)*SALT" ;
		ssflux:units = "meter second-1" ;
		ssflux:negative_value = "upward flux, freshening (net precipitation)" ;
		ssflux:positive_value = "downward flux, salting (net evaporation)" ;
		ssflux:time = "ocean_time" ;
		ssflux:coordinates = "lon_rho lat_rho ocean_time" ;
		ssflux:field = "surface net salt flux, scalar, series" ;
		ssflux:_FillValue = 1.e+37f ;
	float sustr(ocean_time, eta_u, xi_u) ;
		sustr:long_name = "surface u-momentum stress" ;
		sustr:units = "newton meter-2" ;
		sustr:time = "ocean_time" ;
		sustr:coordinates = "lon_u lat_u ocean_time" ;
		sustr:field = "surface u-momentum stress, scalar, series" ;
		sustr:_FillValue = 1.e+37f ;
	float svstr(ocean_time, eta_v, xi_v) ;
		svstr:long_name = "surface v-momentum stress" ;
		svstr:units = "newton meter-2" ;
		svstr:time = "ocean_time" ;
		svstr:coordinates = "lon_v lat_v ocean_time" ;
		svstr:field = "surface v-momentum stress, scalar, series" ;
		svstr:_FillValue = 1.e+37f ;
	double sz_alpha ;
		sz_alpha:long_name = "surface flux from wave dissipation" ;
	float temp(ocean_time, s_rho, eta_rho, xi_rho) ;
		temp:long_name = "potential temperature" ;
		temp:units = "Celsius" ;
		temp:time = "ocean_time" ;
		temp:coordinates = "lon_rho lat_rho s_rho ocean_time" ;
		temp:field = "temperature, scalar, series" ;
		temp:_FillValue = 1.e+37f ;
	double theta_b ;
		theta_b:long_name = "S-coordinate bottom control parameter" ;
	double theta_s ;
		theta_s:long_name = "S-coordinate surface control parameter" ;
	float u(ocean_time, s_rho, eta_u, xi_u) ;
		u:long_name = "u-momentum component" ;
		u:units = "meter second-1" ;
		u:time = "ocean_time" ;
		u:coordinates = "lon_u lat_u s_rho ocean_time" ;
		u:field = "u-velocity, scalar, series" ;
		u:_FillValue = 1.e+37f ;
	float v(ocean_time, s_rho, eta_v, xi_v) ;
		v:long_name = "v-momentum component" ;
		v:units = "meter second-1" ;
		v:time = "ocean_time" ;
		v:coordinates = "lon_v lat_v s_rho ocean_time" ;
		v:field = "v-velocity, scalar, series" ;
		v:_FillValue = 1.e+37f ;
	float w(ocean_time, s_w, eta_rho, xi_rho) ;
		w:long_name = "vertical momentum component" ;
		w:units = "meter second-1" ;
		w:time = "ocean_time" ;
		w:coordinates = "lon_rho lat_rho s_w ocean_time" ;
		w:field = "w-velocity, scalar, series" ;
		w:_FillValue = 1.e+37f ;
	double xl ;
		xl:long_name = "domain length in the XI-direction" ;
		xl:units = "meter" ;
	float zeta(ocean_time, eta_rho, xi_rho) ;
		zeta:long_name = "free-surface" ;
		zeta:units = "meter" ;
		zeta:time = "ocean_time" ;
		zeta:coordinates = "lon_rho lat_rho ocean_time" ;
		zeta:field = "free-surface, scalar, series" ;
		zeta:_FillValue = 1.e+37f ;

// global attributes:
		:NLM_LBC = "\nEDGE:  WEST   SOUTH  EAST   NORTH  \nzeta:  Che    Che    Che    Clo    \nubar:  Shc    Shc    Shc    Clo    \nvbar:  Shc    Shc    Shc    Clo    \nu:     Rad    Rad    Rad    Clo    \nv:     Rad    Rad    Rad    Clo    \ntemp:  Rad    Rad    Rad    Clo    \nsalt:  Rad    Rad    Rad    Clo    \ntke:   Gra    Gra    Gra    Clo" ;
		:svn_url = "https:://myroms.org/svn/src" ;
		:svn_rev = "" ;
		:code_dir = "/scratch/user/d.kobashi/source_code/COAWST/COAWST.r960-dev" ;
		:header_dir = "/home/d.kobashi/forecasts/projects/ensemble_gefs/compile" ;
		:header_file = "txla2.h" ;
		:os = "Linux" ;
		:cpu = "x86_64" ;
		:compiler_system = "ifort" ;
		:compiler_command = "/software/easybuild/software/impi/5.0.3.048-iccifort-2015.3.187-GCC-4.8.4/bin64/" ;
		:compiler_flags = "-heap-arrays -fp-model fast -mt_mpi -ip -O3 -msse2 -free" ;
		:tiling = "010x012" ;
		:history = "Tue Aug 13 13:07:21 2019: ncks -d s_rho,29 -d s_w,30 TXLA2.ocn.his.2016_03_12_c00.nc TXLA2.ocn.his.2016_03_12_c00_surf.nc\nROMS/TOMS, Version 3.7, Wednesday - August 7, 2019 -  1:28:19 PM" ;
		:ana_file = "ROMS/Functionals/ana_btflux.h, ROMS/Functionals/ana_sponge.h, ROMS/Functionals/ana_nudgcoef.h" ;
		:CPP_options = "TXLA2, ANA_BSFLUX, ANA_BTFLUX, ANA_NUDGCOEF, ANA_SPONGE, ASSUMED_SHAPE, BULK_FLUXES, CURVGRID, DEFLATE, DIFF_GRID, DJ_GRADPS, DOUBLE_PRECISION, EMINUSP, GLS_MIXING, HDF5, KANTHA_CLAYSON, LONGWAVE, MASKING, MIX_GEO_TS, MIX_S_UV, MPI, NONLINEAR, NONLIN_EOS, NO_LBC_ATT, N2S2_HORAVG, POWER_LAW, PROFILE, QCORRECTION, K_GSCHEME, RADIATION_2D, !RST_SINGLE, SALINITY, SOLAR_SOURCE, SOLVE3D, SPLINES, SPHERICAL, STATIONS, TS_MPDATA, TS_DIF2, UV_ADV, UV_COR, UV_U3HADVECTION, UV_C4VADVECTION, UV_LOGDRAG, UV_VIS2, VAR_RHO_2D, VISC_GRID, WTYPE_GRID" ;
		:NCO = "\"4.6.0\"" ;
}

Any suggestions would be appreciated.

Thanks,

-DJ

backwards

Hi everyone,
can anyone tell me if the backward option is available in this PyGnome version? I searched the documentation but couldn't find anything.
Thanks in advance.

Berto

Tides help

Hi!

I am a beginner, I'm traying to do a simulation in Pacific ocean , I have tidal data (harmonic constituents) but i don't know how to enter them into the model, (what format or structure) neither in pygnome nor in gnome.

Thank you for the help,

Best regards,

Where is the testdata for running the scripts?

The test scripts want to load local data, like this:

https://github.com/NOAA-ORR-ERD/PyGnome/blob/master/py_gnome/scripts/script_boston/script_boston.py#L84-L85

    curr_file = get_datafile(os.path.join(base_dir, r"./EbbTides.cur"))
    tide_file = get_datafile(os.path.join(base_dir, r"./EbbTidesShio.txt"))
    curr_file = get_datafile(os.path.join(base_dir,
                             r"./MerrimackMassCoast.cur"))
    tide_file = get_datafile(os.path.join(base_dir,
                             r"./MerrimackMassCoastOSSM.txt"))
    curr_file = get_datafile(os.path.join(base_dir, r"MassBaySewage.cur"))
    component_file1 = get_datafile(os.path.join(base_dir, r"./WAC10msNW.cur"))
    component_file2 = get_datafile(os.path.join(base_dir, r"./WAC10msSW.cur"))

Where do I find this data?

I tried google searching and it landed me on this web site:
http://gnome.orr.noaa.gov/py_gnome_testdata/
which times out.

It might be nice to zip these files and add them to the release (a slick feature of github)

PyGNOME installation problem

Hi, I am trying to install PyGNOME on my Linux workstation (Ubuntu 16.04).

I followed the instruction at http://noaa-orr-erd.github.io/PyGnome/installing.html.
When I tried to install requirements with conda install --file conda_requirements.txt, I had a conflict between netCDF4 and gdal.

UnsatisfiableError: The following specifications were found to be in conflict:
  - gdal >=2.1.1
  - netcdf4 1.2.7

So I commented out netCDF4 in conda_requirements.txt and installed the requirements with no issues (it installed netCDF4-1.3.1 instead of 1.2.7 specified in conda_requirements.txt). I was able to install PyGNOME.

However, when I tried to test PyGNOME with py.test under ./py_gnome/tests/units_tests, I had an error associated with libcurl.so.4
/homd/anaconda2/env/pygnome/lib/python2.7/site-packages/netCDF4/../../../libcurl.so.4: undefined symbol: libssh2_scp_recv2

The following comes with libssh2_scp_recv2 as U
nm /home/anaconda2/envs/pygnome/lib/libcurl.so.4 | grep libssh2_scp_recv2

At that point, I was not able to import netCDF4 on ipython with the same error. So I removed netCDF4 by conda remove netCDF4 and installed it again by pip install netCDF4. Then I was able to import netCDF4 after installing gridded with pip as well. However, now I cannot import gdal by getting

ImportError: libxerces-c-3.1.so: cannot open shared object file: No such file or directory

Then I remove gdal by conda remove gdal and install gdal with pip. I was able to import gdal on ipython, but not netCDF4 and py.test still fails.

The issue looks like the problem of gdal and netCDF4. And conda-forge is giving me troubles for compatibility.
I removed pygnome environment and will need to start over again. I wonder if you could tell me how to avoid the error related to netCDF4 and gdal.

I found a post in this forum saying that downgrading gdal to gdal=1.11 may work, but that's for Windows and it did not work for me.

Thanks in advance.

DJ

3 failed tests

I'm following the instructions for conda install at
https://github.com/NOAA-ORR-ERD/PyGnome/blob/master/InstallingWithAnaconda.rst
and running this:

> cd PyGnome/py_gnome/tests/unit_tests
> py.test

produces 3 failed tests.

These all seem minor but reporting them here:

============================================ FAILURES ============================================
_____________________________ test_Water_get[temperature-C-0-273.16] _____________________________

attr = 'temperature', unit = 'C', val = 0, si_val = 273.16

    @pytest.mark.parametrize(("attr", "unit", "val", "si_val"),
                             [('temperature', 'C', 0, 273.16),
                              ('sediment', 'mg/l', 5, 0.005),
                              ('sediment', 'percent', 0.005, 0.05),
                              ('wave_height', 'cm', 100.0, 1.0),
                              ('fetch', 'km', 1.0, 1000.0)])
    def test_Water_get(attr, unit, val, si_val):
        w = Water()
        setattr(w, attr, val)
        w.units[attr] = unit

>       assert w.get(attr) == si_val
E       AssertionError: assert 273.15 == 273.16
E        +  where 273.15 = <bound method Water.get of gnome.environment.environment.Water(temperature=0, salinity=35.0)>('temperature')
E        +    where <bound method Water.get of gnome.environment.environment.Water(temperature=0, salinity=35.0)> = gnome.environment.environment.Water(temperature=0, salinity=35.0).get

test_environment/test_environment.py:56: AssertionError
_________________________ test_properties_in_si[temperature-C-0-273.16] __________________________

attr = 'temperature', unit = 'C', val = 0, exp_si = 273.16

    @pytest.mark.parametrize(("attr", "unit", "val", "exp_si"),
                             [('temperature', 'C', 0, 273.16),
                              ('sediment', 'mg/l', 5, 0.005),
                              ('wave_height', 'km', .001, 1),
                              ('fetch', 'km', .01, 10),
                              ('fetch', 'm', 0.323, 0.323)])
    def test_properties_in_si(attr, unit, val, exp_si):
        '''
        set properties in non SI units and check default get() returns it in SI
        '''
        kw = {attr: val, 'units': {attr: unit}}
        w = Water(**kw)
        assert getattr(w, attr) == val
        assert w.units[attr] == unit

>       assert w.get(attr) == exp_si
E       AssertionError: assert 273.15 == 273.16
E        +  where 273.15 = <bound method Water.get of gnome.environment.environment.Water(temperature=0, salinity=35.0)>('temperature')
E        +    where <bound method Water.get of gnome.environment.environment.Water(temperature=0, salinity=35.0)> = gnome.environment.environment.Water(temperature=0, salinity=35.0).get

test_environment/test_environment.py:115: AssertionError
_____________ test_dissolution_mass_balance[oil_bahia-288.15-15.0-3-0.0036288-True] ______________

oil = 'oil_bahia', temp = 288.15, wind_speed = 15.0, num_elems = 3, expected_mb = 0.0036288
on = True

    @pytest.mark.parametrize(mb_param_names, mb_params)
    def test_dissolution_mass_balance(oil, temp, wind_speed,
                                      num_elems, expected_mb, on):
        '''
        Test a single dissolution step.
        - for this, we need a dispersion weatherer to give us a droplet size
          distribution.
        Fuel Oil #6 does not exist...
        '''
        et = floating(substance=oil)

        waves = build_waves_obj(wind_speed, 'knots', 270, temp)
        water = waves.water

        disp = NaturalDispersion(waves, water)
        diss = Dissolution(waves)

        all_array_types = diss.array_types.union(disp.array_types)

        (sc, time_step) = weathering_data_arrays(all_array_types,
                                                 water,
                                                 element_type=et,
                                                 num_elements=num_elems,
                                                 units='kg',
                                                 amount_per_element=1.0
                                                 )[:2]

        print 'time_step: {}'.format(time_step)
        print 'num spills:', len(sc.spills)
        print 'spill[0] amount: {} {}'.format(sc.spills[0].amount,
                                              sc.spills[0].units)
        print 'temperature = ', temp
        print 'wind = ',
        print '\n'.join(['\t{} {}'.format(ts[1][0], waves.wind.units)
                         for ts in waves.wind.timeseries])
        print

        # we don't want to query the oil database, but get the sample oil
        assert sc.spills[0].element_type.substance.record.id is None

        initial_amount = sc.spills[0].amount
        model_time = (sc.spills[0].release_time +
                      timedelta(seconds=time_step))

        disp.on = on
        disp.prepare_for_model_run(sc)
        disp.initialize_data(sc, sc.num_released)

        diss.on = on
        diss.prepare_for_model_run(sc)
        diss.initialize_data(sc, sc.num_released)

        disp.prepare_for_model_step(sc, time_step, model_time)
        diss.prepare_for_model_step(sc, time_step, model_time)

        disp.weather_elements(sc, time_step, model_time)
        diss.weather_elements(sc, time_step, model_time)

        if on:
            print ('fraction dissolved: {}'
                   .format(sc.mass_balance['dissolution'] / initial_amount)
                   )
            print ('fraction dissolved: {:.2%}'
                   .format(sc.mass_balance['dissolution'] / initial_amount)
                   )
            print sc.mass_balance['dissolution'], expected_mb
>           assert np.isclose(sc.mass_balance['dissolution'], expected_mb)
E           assert False
E            +  where False = <function isclose at 0x7f8bd09cea28>(0.003628851565623533, 0.0036288)
E            +    where <function isclose at 0x7f8bd09cea28> = np.isclose

test_weatherers/test_dissolution.py:266: AssertionError
-------------------------------------- Captured stdout call --------------------------------------
time_step: 900.0
num spills: 1
spill[0] amount: 3.0 kg
temperature =  288.15
wind =          15.0 knots

fraction dissolved: 0.00120961718854
fraction dissolved: 0.12%
0.00362885156562 0.0036288
=========== 3 failed, 1389 passed, 64 skipped, 5 xfailed, 1 xpassed in 168.56 seconds =======

3D current

Dear friends,
In a simple 3D model, I have a 3D current file, and I introduce it to the model as:
model.movers += GridCurrentMover('current.nc')

Is this right? (or, should I use PyCurrentMover ?)
My spill source is in the sea bed. Are LEs get affected by the current vectors in the water column?

Another question; I deal with a 2 layer water (under stratification); is it possible to define two densities (one for the lower layer and one for the upper layer)? How the model calculates the rise velocity above and below the mixing layer? (I define a global water of a specific temp and salinity, and introduce it to the spill).

FYI, I use the simple 3D module of Pygnome, not TAMOC.

Regards
/Payam

functional tests error

After building pygnome using Anaconda .when I try to run set of unit and functional tests to make sure that py_gnome is working properly. I get an error message . Please find attached output error message .Please help to resolve this issue . Thank You .
tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.