Esempio n. 1
0
class TestArray(unittest.TestCase):
    """Tests for (non-scalar) LagrangianArray"""

    def setUp(self):
        self.o = OpenOil()
        self.fake_eddy = reader_ArtificialOceanEddy.Reader(2, 62)
        self.fake_eddy.start_time = datetime(2015, 1, 1)
        self.o.add_reader([self.fake_eddy])

    def test_seed(self):
        """Test seeding"""
        self.o.seed_elements(lon=4, lat=60, number=100,
                             time=self.fake_eddy.start_time)
        self.assertEqual(len(self.o.elements), 0)
        self.assertEqual(len(self.o.elements_deactivated), 0)
        self.assertEqual(len(self.o.elements_scheduled), 100)
Esempio n. 2
0
class TestArray(unittest.TestCase):
    """Tests for (non-scalar) LagrangianArray"""
    def setUp(self):
        self.o = OpenOil()
        self.fake_eddy = reader_ArtificialOceanEddy.Reader(2, 62)
        self.fake_eddy.start_time = datetime(2015, 1, 1)
        self.o.add_reader([self.fake_eddy])

    def test_seed(self):
        """Test seeding"""
        self.o.seed_elements(lon=4,
                             lat=60,
                             number=100,
                             time=self.fake_eddy.start_time)
        self.assertEqual(len(self.o.elements), 0)
        self.assertEqual(len(self.o.elements_deactivated), 0)
        self.assertEqual(len(self.o.elements_scheduled), 100)
Esempio n. 3
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')

# Norkyst
#reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=2, llcrnrlat=59,
                    urcrnrlon=6, urcrnrlat=62,
                    resolution='i', projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
lon = [3.6, 5.1]; lat = [61., 59.6]; # Outside Bergen

# Seed elements along cone, e.g. ship track with
Esempio n. 4
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# HYCOM
#reader_hycom = reader_netCDF_CF_generic.Reader('http://tds.hycom.org/thredds/dodsC/GLBu0.08/expt_19.1/2010/3hrly')
#print reader_hycom

reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/CLS-L4-CUREUL_HS-ALT_SUM-V01.0_FULL_TIME_SERIE')

# OceanWind
reader_oceanwind = reader_netCDF_CF_generic.Reader('http://www.ncdc.noaa.gov/thredds/dodsC/oceanwinds6hr')
#print reader_oceanwind

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=100, llcrnrlat=5,
                    urcrnrlon=120, urcrnrlat=15, resolution='h')

# Add readers
print 'adding...'
o.add_reader([reader_globcurrent, reader_oceanwind, reader_basemap])


# Seed some particles
lat=10.228248; lon=106.973337
Esempio n. 5
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')

# Norkyst
#reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')

# WAM10
#reader_wam10 = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/wam/wam10_be')  # 6 hourly aggregates two months back
#reader_wam10 = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/fou-hi/wam10h/g10kmwave.nc')

# GlobCurrent
#reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/CLS-L4-CUREUL_HS-ALT_SUM-V01.0_FULL_TIME_SERIE')  # Total
#reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/GC_MOD_TIDE_GLO_010_FES2012_FULL_TIME_SERIE') # FES Tidal

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=4,
                                                llcrnrlat=59.8,
Esempio n. 6
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')
#reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(
                    llcrnrlon=4, llcrnrlat=59.7,
                    urcrnrlon=7, urcrnrlat=61.5,
                    resolution='h', projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
lon = 4.9; lat = 60.0; # Outside Bergen
Esempio n. 7
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

#reader_hycom = reader_netCDF_CF_generic.Reader('http://tds.hycom.org/thredds/dodsC/GLBu0.08/expt_19.1/2010/3hrly')
#print reader_hycom0
reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/CLS-L4-CUREUL_HS-ALT_SUM-V01.0_FULL_TIME_SERIE')  # Total

reader_oceanwind = reader_netCDF_CF_generic.Reader('http://www.ncdc.noaa.gov/thredds/dodsC/oceanwinds6hr')
#print reader_oceanwind

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(
                    llcrnrlon=-94, llcrnrlat=20,
                    urcrnrlon=-80, urcrnrlat=32, resolution='i')

# Add readers
#o.add_reader([reader_basemap, reader_hycom, reader_oceanwind])
o.add_reader([reader_basemap, reader_globcurrent, reader_oceanwind])
#o.add_reader([reader_basemap, reader_globcurrent])

# Seed some particles
lon = -88.387161; lat = 28.736669  # Macondo location
starttime = datetime(2010, 4, 21, 6, 0, 0)  # 4 hours after explosion
time = [starttime, starttime + timedelta(hours=24*40)]
Esempio n. 8
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=3, llcrnrlat=59.5,
                    urcrnrlon=7, urcrnrlat=62,
                    resolution='h', projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
lon = 4.3; lat = 60.0; # Outside Bergen
time = [reader_arome.start_time,
        reader_arome.start_time + timedelta(hours=30)]

# Seed oil elements at defined position and time
#!/usr/bin/env python

from datetime import datetime, timedelta
import numpy as np
#from models.oceandrift import OceanDrift
from models.openoil import OpenOil

#o = OceanDrift(loglevel=50)
o = OpenOil(loglevel=50)

o.config['processes']['diffusion'] = False

# We do not care about landmask or current for this seeding demonstration,
# so we simple specify fallback_values instead of adding any readers
o.fallback_values['land_binary_mask'] = 0
o.fallback_values['x_sea_water_velocity'] = 0
o.fallback_values['y_sea_water_velocity'] = 0

time=datetime(2016, 1, 20, 12, 30, 0)


print '\n' + '='*70
print 'Seeding a single element at a point:'
print 'o.seed_elements(lon=4, lat=60, time=time)'
print '='*70
o.seed_elements(lon=4, lat=60, time=time)
o.run(steps=1)
o.plot(buffer=1)


print '\n' + '='*70
Esempio n. 10
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')
#reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=4,
                                                llcrnrlat=59.7,
                                                urcrnrlon=7,
                                                urcrnrlat=61.5,
                                                resolution='h',
                                                projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
Esempio n. 11
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=3.5,
                                                llcrnrlat=60.4,
                                                urcrnrlon=7,
                                                urcrnrlat=61.8,
                                                resolution='h',
                                                projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

############################################################
# Seed oil particles within contour detected from satellite
############################################################
#!/usr/bin/env python

from datetime import datetime, timedelta
import numpy as np
#from models.oceandrift import OceanDrift
from models.openoil import OpenOil

#o = OceanDrift(loglevel=50)
o = OpenOil(loglevel=50)

o.config['processes']['diffusion'] = False

# We do not care about landmask or current for this seeding demonstration,
# so we simple specify fallback_values instead of adding any readers
o.fallback_values['land_binary_mask'] = 0
o.fallback_values['x_sea_water_velocity'] = 0
o.fallback_values['y_sea_water_velocity'] = 0

time = datetime(2016, 1, 20, 12, 30, 0)

print '\n' + '=' * 70
print 'Seeding a single element at a point:'
print 'o.seed_elements(lon=4, lat=60, time=time)'
print '=' * 70
o.seed_elements(lon=4, lat=60, time=time)
o.run(steps=1)
o.plot(buffer=1)

print '\n' + '=' * 70
print 'Seeding 100 elements within a radius of 1000 m:'
print 'o.seed_elements(lon=4, lat=60, number=100, radius=1000, time=time)'
Esempio n. 13
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

o.io_import_file('openoil.nc')

print o

o.plot(buffer=.1)
o.plot_property('mass_oil')
Esempio n. 14
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')

# Nordc4
reader_nordic4 = reader_netCDF_CF_generic.Reader(
    'http://thredds.met.no/thredds/dodsC/fou-hi/nordic4km-1h/Nordic-4km_SURF_1h_avg_00.nc'
)

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=2,
                                                llcrnrlat=78,
                                                urcrnrlon=22,
                                                urcrnrlat=82.3,
                                                resolution='i',
                                                projection='merc')

o.add_reader([reader_basemap, reader_nordic4])
o.fallback_values['y_wind'] = 35  # Northerly wind, to get stranding in ice

# Seeding some particles
lon = 8
Esempio n. 15
0
#!/usr/bin/env python

import os
from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

if not os.path.exists('openoil.nc'):
    raise ValueError('Please run example.py first to generate a '
                     'netCDF file to be imported.')

o.io_import_file('openoil.nc')

print o

o.plot(buffer=.1)
o.plot_property('mass_oil')
Esempio n. 16
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc'
)
#reader_arome = reader_netCDF_CF_generic.Reader('/disk1/data/opendrift_testdata/arome.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')
#reader_norkyst = reader_netCDF_CF_generic.Reader('/disk1/data/opendrift_testdata/norkyst800.nc')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=15.4,
                                                llcrnrlat=68.6,
                                                urcrnrlon=20.0,
                                                urcrnrlat=70.5,
                                                resolution='h',
                                                projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])
Esempio n. 17
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')

# Nordc4
reader_nordic4 = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/fou-hi/nordic4km-1h/Nordic-4km_SURF_1h_avg_00.nc')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(
                    llcrnrlon=2, llcrnrlat=78,
                    urcrnrlon=22, urcrnrlat=82.3,
                    resolution='i', projection='merc')

o.add_reader([reader_basemap, reader_nordic4])
o.fallback_values['y_wind'] = 35  # Northerly wind, to get stranding in ice

# Seeding some particles
lon = 8; lat = 79.5;  # West of Svalbard

#time = datetime(2015, 9, 22, 6, 0, 0)
#time = [reader_nordic4.start_time,
#        reader_nordic4.start_time + timedelta(hours=30)]
Esempio n. 18
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=4, llcrnrlat=59.8,
                    urcrnrlon=6, urcrnrlat=61,
                    resolution='h', projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
lon = 4.8; lat = 60.0; # Outside Bergen

time = None
time = reader_arome.start_time

# Seed elements at defined position and time
import numpy as np
Esempio n. 19
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')
#reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=3, llcrnrlat=59.5,
                    urcrnrlon=7, urcrnrlat=62,
                    resolution='h', projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
lon = 4.2; lat = 60.0; # Outside Bergen
time = [reader_arome.start_time,
        reader_arome.start_time + timedelta(hours=30)]
Esempio n. 20
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# HYCOM
#reader_hycom = reader_netCDF_CF_generic.Reader('http://tds.hycom.org/thredds/dodsC/GLBu0.08/expt_19.1/2010/3hrly')
#print reader_hycom

reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/CLS-L4-CUREUL_HS-ALT_SUM-V02.0_FULL_TIME_SERIE')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=100, llcrnrlat=5,
                    urcrnrlon=120, urcrnrlat=15, resolution='h')

# OceanWind
try:
    reader_oceanwind = reader_netCDF_CF_generic.Reader(
        'http://www.ncdc.noaa.gov/thredds/dodsC/oceanwinds6hr')
    print reader_oceanwind
    o.add_reader([reader_globcurrent, reader_oceanwind, reader_basemap])
except:
    o.add_reader([reader_globcurrent, reader_basemap])


# Seed some particles
Esempio n. 21
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')
reader_arome = reader_netCDF_CF_generic.Reader('test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')

# Norkyst
#reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')
reader_norkyst = reader_netCDF_CF_generic.Reader('test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')

# WAM10
#reader_wam10 = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/wam/wam10_be')  # 6 hourly aggregates two months back
#reader_wam10 = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/fou-hi/wam10h/g10kmwave.nc')

# GlobCurrent
#reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/CLS-L4-CUREUL_HS-ALT_SUM-V01.0_FULL_TIME_SERIE')  # Total
#reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/GC_MOD_TIDE_GLO_010_FES2012_FULL_TIME_SERIE') # FES Tidal

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=4, llcrnrlat=59.8,
                    urcrnrlon=6, urcrnrlat=61,
                    resolution='h', projection='merc')
Esempio n. 22
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

reader_hycom = reader_netCDF_CF_generic.Reader('http://tds.hycom.org/thredds/dodsC/GLBu0.08/expt_19.1/2010/3hrly')
#print reader_hycom0
#reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/CLS-L4-CUREUL_HS-ALT_SUM-V01.0_FULL_TIME_SERIE')  # Total

reader_oceanwind = reader_netCDF_CF_generic.Reader('http://www.ncdc.noaa.gov/thredds/dodsC/oceanwinds6hr')
#print reader_oceanwind

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(
                    llcrnrlon=-94, llcrnrlat=20,
                    urcrnrlon=-80, urcrnrlat=32, resolution='i')

# Add readers
o.add_reader([reader_basemap, reader_hycom, reader_oceanwind])
#o.add_reader([reader_basemap, reader_globcurrent, reader_oceanwind])

# Seed some particles
lon = -88.387161; lat = 28.736669  # Macondo location
starttime = datetime(2010, 4, 21, 6, 0, 0)  # 4 hours after explosion
time = [starttime, starttime + timedelta(hours=24*40)]
o.seed_elements(lon, lat, radius=0, number=5000, time=time)
Esempio n. 23
0
 def setUp(self):
     self.o = OpenOil()
     self.fake_eddy = reader_ArtificialOceanEddy.Reader(2, 62)
     self.fake_eddy.start_time = datetime(2015, 1, 1)
     self.o.add_reader([self.fake_eddy])
Esempio n. 24
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')
#reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')
#reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=3,
                                                llcrnrlat=59.5,
                                                urcrnrlon=7,
                                                urcrnrlat=62,
                                                resolution='h',
                                                projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
Esempio n. 25
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

reader_hycom = reader_netCDF_CF_generic.Reader(
    'http://tds.hycom.org/thredds/dodsC/GLBu0.08/expt_19.1/2010/3hrly')
#print reader_hycom0
#reader_globcurrent = reader_netCDF_CF_generic.Reader('http://tds0.ifremer.fr/thredds/dodsC/CLS-L4-CUREUL_HS-ALT_SUM-V01.0_FULL_TIME_SERIE')  # Total

reader_oceanwind = reader_netCDF_CF_generic.Reader(
    'http://www.ncdc.noaa.gov/thredds/dodsC/oceanwinds6hr')
#print reader_oceanwind

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=-94,
                                                llcrnrlat=20,
                                                urcrnrlon=-80,
                                                urcrnrlat=32,
                                                resolution='i')

# Add readers
o.add_reader([reader_basemap, reader_hycom, reader_oceanwind])
#o.add_reader([reader_basemap, reader_globcurrent, reader_oceanwind])

# Seed some particles
Esempio n. 26
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')
#reader_arome = reader_netCDF_CF_generic.Reader('/disk1/data/opendrift_testdata/arome.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')
#reader_norkyst = reader_netCDF_CF_generic.Reader('/disk1/data/opendrift_testdata/norkyst800.nc')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(
                    llcrnrlon=15.4, llcrnrlat=68.6,
                    urcrnrlon=20.0, urcrnrlat=70.5,
                    resolution='h', projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles

latstart = 68.988911 
lonstart = 16.040701
#latstart = 69.477754
Esempio n. 27
0
 def setUp(self):
     self.o = OpenOil()
     self.fake_eddy = reader_ArtificialOceanEddy.Reader(2, 62)
     self.fake_eddy.start_time = datetime(2015, 1, 1)
     self.o.add_reader([self.fake_eddy])
Esempio n. 28
0
#!/usr/bin/env python

from datetime import datetime, timedelta

from readers import reader_basemap_landmask
from readers import reader_netCDF_CF_generic
from models.openoil import OpenOil

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(
    'http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc'
)

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(
    'http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

# Landmask (Basemap)
reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=4,
                                                llcrnrlat=59.8,
                                                urcrnrlon=6,
                                                urcrnrlat=61,
                                                resolution='h',
                                                projection='merc')

o.add_reader([reader_basemap, reader_norkyst, reader_arome])

# Seeding some particles
lon = 4.8
Esempio n. 29
0
# You should have received a copy of the GNU General Public License
# along with OpenDrift.  If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2015, Knut-Frode Dagestad, MET Norway

import sys
import argparse
import numpy as np

sys.path.append("..")

from models.openoil import OpenOil

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('filename',
                        help='<OpenDriftaoutput filename (netCDF)>')
    parser.add_argument('-b',
                        dest='buffer',
                        default=1.0,
                        help='Buffer around plot in degrees lon/lat.')

    args = parser.parse_args()

    o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information

    print o
    print type(np.array(args.buffer))
    o.io_import_file(args.filename)
    o.plot(buffer=np.float(args.buffer))