Exemplo n.º 1
0
#time = reader_arome.start_time

# Seed oil elements at defined position and time
o.seed_elements(lon, lat, radius=50, number=3000, time=time,
                wind_drift_factor=.02)

print o
print o.list_configspec()  # Show configuration values and options

# Adjusting some configuration
o.set_config('processes:diffusion', True)
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', True)
o.set_config('processes:emulsification', True)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 1)

# Running model (until end of driver data)
o.run(end_time=reader_norkyst.end_time, time_step=1800,
      time_step_output=3600, outfile='openoil.nc',
      export_variables=['mass_oil'])

# Print and plot results
print o
#o.plot(background=['x_sea_water_velocity', 'y_sea_water_velocity'], buffer=.5)
o.animation()
#o.animation(filename='openoil_time_seed.gif')
o.plot()
#o.plot_property('mass_oil')
#o.plot_property('x_sea_water_velocity')
Exemplo n.º 2
0
)  # Total

reader_oceanwind = reader_netCDF_CF_generic.Reader(
    'https://tds0.ifremer.fr/thredds/dodsC/CERSAT-GLO-CLIM_WIND_L4-OBS_FULL_TIME_SERIE'
)
#print(reader_oceanwind)

# Add readers
o.add_reader([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)

# Run model
print(o)
o.run(duration=timedelta(days=40),
      time_step=timedelta(hours=3),
      time_step_output=timedelta(days=1))

# Print and plot results
print(o)
o.plot(fast=True)
o.animation(filename='macondo.gif', fast=True)

#%%
# .. image:: /gallery/animations/example_macondo_0.gif
Exemplo n.º 3
0
o.seed_from_gml(
    o.test_data_folder() +
    'radarsat_oil_satellite_observation/RS2_20151116_002619_0127_SCNB_HH_SGF_433012_9730_12182143_Oil.gml',
    num_elements=2000)
############################################################
# Additional continous point release, lasting 24 hours
############################################################
o.seed_elements(3.8,
                60.9,
                radius=0,
                number=1000,
                time=[datetime(2015, 11, 16, 8),
                      datetime(2015, 11, 17, 8)])
############################################################
# Additional cone release (e.g. from moving ship)
############################################################
o.seed_elements([3.6, 4.4], [61.5, 61.2],
                radius=[1000, 10000],
                number=1000,
                cone=True,
                time=[datetime(2015, 11, 16, 1),
                      datetime(2015, 11, 16, 8)])

# Running model (until end of driver data)
o.run(steps=50 * 4, time_step=900)

# Print and plot results
print(o)
o.plot()
o.animation()
    raise ValueError('Please install GDAL (www.gdal.org) with Python'
                     ' support to run this example')

o = OpenOil(loglevel=0)  # Set loglevel to 0 for debug information
o.max_speed = .5  # To minimise plotting boundaries

#####################################################
# Seed oil particles within contours from shapefile
#####################################################
o.seed_from_shapefile(o.test_data_folder() +
                      'shapefile_spawning_areas/Torsk.shp',
                      number=2000,
                      layername=None,
                      featurenum=[2, 4],
                      time=datetime.now())

o.fallback_values['x_wind'] = -4  # Constant wind drift
o.fallback_values['y_wind'] = 8
o.set_config('drift:wind_uncertainty', 4)  # Adding some diffusion

# Running model
o.run(steps=50, time_step=3600)

# Print and plot results
print(o)
o.plot()
o.animation(filename='seed_from_shapefile.gif')

#%%
# .. image:: /gallery/animations/seed_from_shapefile.gif
Exemplo n.º 5
0
                number=3000,
                time=datetime.utcnow() - timedelta(hours=12))

#%%
# Adjusting some configuration
o.set_config('processes:dispersion', False)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)

#%%
# Running model
o.run(duration=timedelta(hours=48), time_step=1800, time_step_output=3600)

#%%
# Print and plot results
print(o)
o.animation(background='sea_ice_area_fraction',
            cmap='Greys_r',
            vmin=0,
            vmax=1,
            fast=False)

#%%
# .. image:: /gallery/animations/example_oil_ice_0.gif

o.plot(background='sea_ice_area_fraction',
       cmap='Greys_r',
       vmin=0,
       vmax=1,
       fast=False)
Exemplo n.º 6
0
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 1)

#%%
# Running model

# Running model
o.run(end_time=reader_norkyst.end_time,
      time_step=1800,
      time_step_output=3600,
      outfile='openoil.nc',
      export_variables=['mass_oil'])

# Print and plot results
# print(o)
#o.plot(background=['x_sea_water_velocity', 'y_sea_water_velocity'], buffer=.5)
# o.animation(fast=True)
# o.animation(density=True, show_elements=False, fast=True)
o.plot(fast=True)

#%%
# Or an animation can be done with:

o.animation(fast=True, filename='openoil_time_seed.gif')

#%%
# .. image:: /gallery/animations/openoil_time_seed.gif

#o.plot_property('mass_oil')
#o.plot_property('x_sea_water_velocity')
Exemplo n.º 7
0
# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
    '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')

o.add_reader([reader_norkyst, reader_arome])

# Seed oil particles within contour detected from satellite
o.seed_from_gml(o.test_data_folder() + 'radarsat_oil_satellite_observation/RS2_20151116_002619_0127_SCNB_HH_SGF_433012_9730_12182143_Oil.gml',
    num_elements=2000)

# Adjusting some configuration
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', True)
o.set_config('drift:current_uncertainty', .1)  # Diffusion
o.set_config('drift:wind_uncertainty', 1)

# Running model for 48 hours
o.run(steps=6*4, time_step=900)

# Print and plot results
print(o)
if len(argv) > 1:
    o.animation(filename=argv[1])

if len(argv) > 2:
    try:
        o.plot(filename=argv[2])
    except:
        pass
Exemplo n.º 8
0
o.set_config('drift:wind_uncertainty',  2)
o.set_config('drift:relative_wind',  False)

for r in o.readers:
    o.readers[r].interpolation = 'ndimage'

# Running model
o.run(steps=66*2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_basemap, reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time)
o2.set_config('processes:diffusion',  True)
o2.set_config('processes:dispersion',  False)
o2.set_config('processes:evaporation',  False)
o2.set_config('processes:emulsification',  False)
o2.set_config('drift:current_uncertainty',  .1)
o2.set_config('drift:wind_uncertainty',  2)
o2.set_config('drift:relative_wind',  False)

for r in o.readers:
    o.readers[r].interpolation = 'linearND'

o2.run(steps=66*2, time_step=1800)


# Animate and compare the two runs
o.animation(compare=o2, legend=['ndimage', 'linearND'])
            
Exemplo n.º 9
0
# XXX: not-relevant
# For longer simulations, it is better to pre-generate a landmask:
# Landmask
reader_landmask = reader_global_landmask.Reader(
                    llcrnrlon=-94, llcrnrlat=20,
                    urcrnrlon=-80, urcrnrlat=32)

# Add readers
o.add_reader([reader_landmask, 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)

# Run model
print(o)
o.run(duration=timedelta(days=40),
      time_step=timedelta(hours=3),
      time_step_output=timedelta(days=1))

# Print and plot results
print(o)
o.plot()
o.animation(filename='macondo.gif')

#%%
# .. image:: /gallery/animations/macondo.gif
Exemplo n.º 10
0
#time = [reader_nordic4.start_time,
#        reader_nordic4.start_time + timedelta(hours=30)]
time = reader_arctic.start_time

#%%
# Seed oil elements at defined position and time
o.seed_elements(lon=24.4, lat=77.3, radius=7000, number=3000, time=time)
o.fallback_values['y_wind'] = 4  # Adding some northwards wind

#%%
# Adjusting some configuration
o.set_config('processes:dispersion', False)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)
o.set_config('drift:current_uncertainty', .5)
o.set_config('drift:wind_uncertainty', 5)

#%%
# Running model (until end of driver data)
o.run(duration=timedelta(days=4), time_step=3600, time_step_output=3600 * 3)

#%%
# Print and plot results
print(o)
o.animation(background='sea_ice_area_fraction', fast=True)

#%%
# .. image:: /gallery/animations/example_oil_ice_0.gif

o.plot(background='sea_ice_area_fraction', fast=True)
Exemplo n.º 11
0
# Seed oil elements at defined position and time
o.seed_elements(lon, lat, radius=50, number=5000, time=time)

# Adjusting some configuration
o.set_config('processes:diffusion', True)
o.set_config('processes:dispersion', False)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 2)
o.set_config('drift:relative_wind', False)

# Running model
o.run(steps=66 * 2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_basemap, reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time)
o2.set_config('processes:diffusion', True)
o2.set_config('processes:dispersion', False)
o2.set_config('processes:evaporation', False)
o2.set_config('processes:emulsification', False)
o2.set_config('drift:current_uncertainty', .1)
o2.set_config('drift:wind_uncertainty', 2)
o2.set_config('drift:relative_wind', True)
o2.run(steps=66 * 2, time_step=1800)

# Animate and compare the two runs
o.animation(compare=o2, legend=['Absolute wind', 'Relative wind'])
Exemplo n.º 12
0
o.add_reader([reader_norkyst, reader_arome])
o.set_config('processes:evaporation', False)

############################################################
# Seed oil particles within contour detected from satellite
############################################################
o.seed_from_gml(o.test_data_folder() + 'radarsat_oil_satellite_observation/RS2_20151116_002619_0127_SCNB_HH_SGF_433012_9730_12182143_Oil.gml', num_elements=2000)
############################################################
# Additional continous point release, lasting 24 hours
############################################################
o.seed_elements(3.8, 60.9, radius=0, number=1000,
                time=[datetime(2015,11,16,8), datetime(2015,11,17,8)])
############################################################
# Additional cone release (e.g. from moving ship)
############################################################
o.seed_elements([3.6, 4.4], [61.5, 61.2], radius=[1000, 10000],
                number=1000, cone=True,
                time=[datetime(2015,11,16,1), datetime(2015,11,16,8)])

# Running model (until end of driver data)
o.run(steps=50*4, time_step=900)

# Print and plot results
print(o)
o.plot()
o.animation(filename='multi_seed.gif')

#%%
# .. image:: /gallery/animations/multi_seed.gif
Exemplo n.º 13
0
# Adjusting some configuration
o.set_config('processes:diffusion',  True)
o.set_config('processes:dispersion',  False)
o.set_config('processes:evaporation',  False)
o.set_config('processes:emulsification',  False)
o.set_config('drift:current_uncertainty',  .1)
o.set_config('drift:wind_uncertainty',  2)
o.set_config('drift:relative_wind',  False)

# Running model
o.run(steps=66*2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_basemap, reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time)
o2.set_config('processes:diffusion',  True)
o2.set_config('processes:dispersion',  False)
o2.set_config('processes:evaporation',  False)
o2.set_config('processes:emulsification',  False)
o2.set_config('drift:current_uncertainty',  .1)
o2.set_config('drift:wind_uncertainty',  2)
o2.set_config('drift:relative_wind',  True)
o2.run(steps=66*2, time_step=1800)


# Animate and compare the two runs
o.animation(compare=o2, legend=['Absolute wind', 'Relative wind'])
            
Exemplo n.º 14
0
#latstart = 69.477754
#lonstart = 16.441702
latend = 69.991446
lonend = 17.760061
lon = [lonstart, lonend]; lat = [latstart, latend]; # Outside Tromso

time = [reader_arome.start_time,
        reader_arome.start_time + timedelta(hours=30)]
o.seed_elements(lon, lat, radius=[100, 500], number=10000,
                time=time, cone=True)

print(o)

# Adjusting some configuration
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', True)

# Running model (until end of driver data)
o.run(steps=66*2, time_step=1800)

# Print and plot results
print(o)
o.plot()
o.animation(filename="cone_tromso.gif")

#%%
# .. image:: https://camo.githubusercontent.com/af4b84eeee83afd94bc60169834b272b1f064537/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f747936646d7166306f6f6865776b792f6f696c7370696c6c5f74726f6d736f652e6769663f646c3d30

# .. image:: /gallery/animations/cone_tromso.gif
Exemplo n.º 15
0
print('\n' + '=' * 70)
print(
    'If specifying time as a two element list (start and end,\n here +5 hours), elements are seeded linearly in time:'
)
print(
    'o.seed_elements(lon=[4, 4.8], lat=[60, 61], number=1000, radius=[0, 5000], cone=True, time=[time, time+timedelta(hours=5)])'
)
print('=' * 70)
o.seed_elements(lon=[4, 4.8],
                lat=[60, 61],
                number=1000,
                radius=[0, 5000],
                cone=True,
                time=[time, time + timedelta(hours=5)])
o.run(steps=5 * 4, time_step=900)
o.animation(filename='seed_demonstration.gif')

#%%
# .. image:: /gallery/animations/seed_demonstration.gif

print('\n' + '=' * 70)
print(
    'Any model/module may provide specialised seeding-functions, such as \n seeding oil within contours read from a GML file:'
)
print(
    'o.seed_from_gml(o.test_data_folder() + "radarsat_oil_satellite_observation/RS2_20151116_002619_0127_SCNB_HH_SGF_433012_9730_12182143_Oil.gml", num_elements=2000)'
)
print('=' * 70)
o.reset()
o.seed_from_gml(
    o.test_data_folder() +
Exemplo n.º 16
0
oil_type = 'IFO 300'
oil_type = 'IFO-180NS 2014'
oil_type = 'GENERIC LIGHT CRUDE'
oil_type = 'GENERIC HEAVY CRUDE'
o.seed_elements(lon=4.8,
                lat=60.0,
                z=0,
                radius=3000,
                number=1000,
                time=reader_arome.start_time,
                oil_type=oil_type)

#%%
# Adjusting some configuration
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', True)
o.set_config('processes:emulsification', True)
o.set_config('drift:vertical_mixing', True)
o.set_config('vertical_mixing:timestep', 20.)  # seconds

#%%
# Running model
o.run(duration=timedelta(hours=24), time_step=1800)

o.plot_oil_budget(show_density_viscosity=True, show_wind_and_current=True)

o.animation(color='viscosity')

#%%
# .. image:: /gallery/animations/example_oil_budget_0.gif
Exemplo n.º 17
0
#%%
# Seed oil particles within contour detected from satellite
o.seed_from_gml(
    o.test_data_folder() +
    'radarsat_oil_satellite_observation/RS2_20151116_002619_0127_SCNB_HH_SGF_433012_9730_12182143_Oil.gml',
    num_elements=2000)

#%%
# Adjusting some configuration
o.set_config('drift:vertical_mixing', False)
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', True)
o.set_config('drift:current_uncertainty', .1)  # Diffusion
o.set_config('drift:wind_uncertainty', 1)

#%%
# Running model for 6 hours
o.run(steps=6 * 4, time_step=900)

#%%
# Print and plot results
print(o)
o.animation(fast=True, buffer=0.1)

#%%
# .. image:: /gallery/animations/example_satellite_0.gif

o.plot(fast=True, buffer=0.1)
Exemplo n.º 18
0
# Seed oil elements at defined position and time
o.seed_elements(lon, lat, radius=50, number=5000, time=time, wind_drift_factor=0.03) # 3% wind drift

# Adjusting some configuration
o.set_config('processes:diffusion', True)
o.set_config('processes:dispersion', False)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 2)

# Running model
o.run(steps=66*2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_basemap, reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time, wind_drift_factor=0.0) # No wind drift
o2.set_config('processes:diffusion', True)
o2.set_config('processes:dispersion', False)
o2.set_config('processes:evaporation', False)
o2.set_config('processes:emulsification', False)
o2.set_config('drift:current_uncertainty', .1)
o2.set_config('drift:wind_uncertainty', 2)
o2.run(steps=66*2, time_step=1800)


# Animate and compare the two runs
o.animation(compare=o2, legend=['Current + 3 % wind drift', 'Current only'])
                 number=1000,
                 radius=100,
                 z=0,
                 oiltype='TIA JUANA LIGHT, OIL & GAS'
                 )  #'EKOFISK BLEND, STATOIL' similar ent.
o3.run(duration=timedelta(hours=12), time_step=900, time_step_output=3600)

#%%
# Plotting and comparing
print('#######################')
print('Entrainment rate (heavy)', np.mean(o2.oil_wave_entrainment_rate()))
print('Entrainment rate (light)', np.mean(o3.oil_wave_entrainment_rate()))
print('Viscosity (heavy)', np.mean(o2.elements.viscosity))
print('Viscosity (light)', np.mean(o3.elements.viscosity))
print('Density (heavy)', np.mean(o2.elements.density))
print('Density (light)', np.mean(o3.elements.density))
print('#######################')

o2.plot_oil_budget()
o3.plot_oil_budget()
legend = ['TIA JUANA HEAVY', 'TIA JUANA LIGHT']
o2.animation_profile(compare=o3, legend=legend)

#%%
# .. image:: /gallery/animations/example_entrainment_rate_oil_types_0.gif

o2.animation(compare=o3, legend=legend, fast=True)

#%%
# .. image:: /gallery/animations/example_entrainment_rate_oil_types_1.gif
Exemplo n.º 20
0
#%%
# Adjusting some configuration
o.set_config('processes:dispersion', False)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)
o.set_config('drift:truncate_ocean_model_below_m', 3)

#%%
# Running model
o.run(duration=timedelta(hours=48), time_step=1800, time_step_output=3600)

#%%
# Print and plot results
print(o)
o.animation(background='sea_ice_area_fraction',
            cmap=cmocean.cm.ice,
            vmin=0,
            vmax=1,
            bgalpha=1,
            fast=False)

#%%
# .. image:: /gallery/animations/example_oil_ice_0.gif

o.plot(background='sea_ice_area_fraction',
       cmap=cmocean.cm.ice,
       vmin=0,
       vmax=1,
       bgalpha=1,
       fast=False)
Exemplo n.º 21
0
# Adjusting some configuration
o.set_config('processes:dispersion', False)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 1)
o.set_config('drift:relative_wind', False)

# Running model
o.run(steps=66 * 2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_landmask, reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time)
o2.set_config('processes:dispersion', False)
o2.set_config('processes:evaporation', False)
o2.set_config('processes:emulsification', False)
o2.set_config('drift:current_uncertainty', .1)
o2.set_config('drift:wind_uncertainty', 1)
o2.set_config('drift:relative_wind', True)
o2.run(steps=66 * 2, time_step=1800)

# Animate and compare the two runs
o.animation(compare=o2,
            legend=['Absolute wind', 'Relative wind'],
            filename='relative.gif')

#%%
# .. image:: /gallery/animations/relative.gif
Exemplo n.º 22
0
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 2)
o.set_config('drift:relative_wind', False)

for r in o.readers:
    o.readers[r].interpolation = 'ndimage'

# Running model
o.run(steps=66 * 2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time)
o2.set_config('processes:dispersion', False)
o2.set_config('processes:evaporation', False)
o2.set_config('processes:emulsification', False)
o2.set_config('drift:current_uncertainty', .1)
o2.set_config('drift:wind_uncertainty', 2)
o2.set_config('drift:relative_wind', False)

for r in o.readers:
    o.readers[r].interpolation = 'linearND'

o2.run(steps=66 * 2, time_step=1800)

# Animate and compare the two runs
o.animation(compare=o2, legend=['ndimage', 'linearND'])
Exemplo n.º 23
0
o1.seed_elements(lon=4.5,
                 lat=60,
                 number=number,
                 mass_oil=mass_oil,
                 radius=1000,
                 oiltype=oiltype,
                 time=datetime.utcnow())
o1.run(time_step=timestep, time_step_output=timestep_output, duration=duration)

#%%
# Animation shows how oil thickness evolves,
# and decreases due to evaporation and spreading
unitfactor = 1e6  # show film thickness in micrometers
o1.animation(color='oil_film_thickness',
             fast=True,
             vmin=1e-7 * unitfactor,
             vmax=1e-4 * unitfactor,
             unitfactor=unitfactor,
             surface_only=True)

#%%
# .. image:: /gallery/animations/example_oil_thickness_0.gif

#%%
# Second run, identical but without updating surface oil thickness
o2 = OpenOil(loglevel=20, weathering_model='noaa')
o2.set_config('environment:fallback:land_binary_mask', 0)
o2.set_config('environment:fallback:x_wind', 0)
o2.set_config('environment:fallback:y_wind', 7)
o2.set_config('environment:fallback:sea_surface_wave_stokes_drift_x_velocity',
              0)
o2.set_config('environment:fallback:sea_surface_wave_stokes_drift_y_velocity',
Exemplo n.º 24
0
o.seed_elements(lon,
                lat,
                radius=50,
                number=3000,
                time=time,
                wind_drift_factor=.02)

# Adjusting some configuration
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', True)
o.set_config('processes:emulsification', True)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 1)

# Running model
o.run(end_time=reader_norkyst.end_time,
      time_step=1800,
      time_step_output=3600,
      outfile='openoil.nc',
      export_variables=['mass_oil'])

# Print and plot results
print(o)
#o.plot(background=['x_sea_water_velocity', 'y_sea_water_velocity'], buffer=.5)
o.animation(fast=True)
o.animation(density=True, show_elements=False, fast=True)
#o.animation(filename='openoil_time_seed.gif')
o.plot(fast=True)
#o.plot_property('mass_oil')
#o.plot_property('x_sea_water_velocity')
Exemplo n.º 25
0
o.set_config('processes:dispersion', False)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', False)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 2)

# Running model
o.run(steps=66*2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time,
                 wind_drift_factor=0.0) # No wind drift
o2.set_config('processes:dispersion', False)
o2.set_config('processes:evaporation', False)
o2.set_config('processes:emulsification', False)
o2.set_config('drift:current_uncertainty', .1)
o2.set_config('drift:wind_uncertainty', 2)
o2.run(steps=66*2, time_step=1800)


# Animate and compare the two runs
o.animation(fast=True, compare=o2,
            legend=['Current + 3 % wind drift', 'Current only'],
            filename='compare.gif')


#%%
# .. image:: /gallery/animations/compare.gif
Exemplo n.º 26
0
o.seed_elements(lon,
                lat,
                radius=50,
                number=3000,
                time=time,
                wind_drift_factor=.02)

# Adjusting some configuration
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', True)
o.set_config('processes:emulsification', True)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 1)

# Running model
o.run(end_time=reader_norkyst.end_time,
      time_step=1800,
      time_step_output=3600,
      outfile='openoil.nc',
      export_variables=['mass_oil'])

# Print and plot results
print o
#o.plot(background=['x_sea_water_velocity', 'y_sea_water_velocity'], buffer=.5)
o.animation()
o.animation(density=True, show_elements=False)
#o.animation(filename='openoil_time_seed.gif')
o.plot()
#o.plot_property('mass_oil')
#o.plot_property('x_sea_water_velocity')
for r in o.readers:
    o.readers[r].interpolation = 'ndimage'

# Running model
o.run(steps=66 * 2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_norkyst, reader_arome])
o2.seed_elements(lon, lat, radius=50, number=5000, time=time)
o2.set_config('processes:dispersion', False)
o2.set_config('processes:evaporation', False)
o2.set_config('processes:emulsification', False)
o2.set_config('drift:current_uncertainty', .1)
o2.set_config('drift:wind_uncertainty', 2)
o2.set_config('drift:relative_wind', False)

for r in o.readers:
    o.readers[r].interpolation = 'linearND'

o2.run(steps=66 * 2, time_step=1800)

# Animate and compare the two runs
o.animation(compare=o2,
            legend=['ndimage', 'linearND'],
            filename='interpolation.gif')

#%%
# .. image:: /gallery/animations/interpolation.gif
                60.9,
                radius=0,
                number=1000,
                origin_marker=1,
                time=[datetime(2015, 11, 16, 8),
                      datetime(2015, 11, 17, 8)])
#%%
# Additional cone release (e.g. from moving ship)
o.seed_cone([3.6, 4.4], [61.5, 61.2],
            radius=[1000, 10000],
            origin_marker=2,
            number=1000,
            time=[datetime(2015, 11, 16, 1),
                  datetime(2015, 11, 16, 8)])

#%%
# Running model
o.run(steps=50 * 4, time_step=900, time_step_output=3600)

#%%
# Print and plot results
print(o)
o.plot(fast=True)
o.animation(fast=True,
            color='origin_marker',
            legend=['satellite slick', 'continuous point', 'cone'],
            colorbar=False)

#%%
# .. image:: /gallery/animations/example_multi_seed_0.gif
Exemplo n.º 29
0
#%%
# Running model for 24 hours
o.run(steps=24 * 2, time_step=1800, time_step_output=3600)

#%%
# Print and plot results
print(o)

#%%
# Add text label on the map
text = [{
    's': 'Senja',
    'x': 17.3,
    'y': 69.3,
    'fontsize': 20,
    'color': 'g',
    'backgroundcolor': 'white',
    'bbox': dict(facecolor='white', alpha=0.8),
    'zorder': 1000
}]

o.animation(fast=False,
            ocean_color='skyblue',
            land_color='burlywood',
            text=text)

#%%
# .. image:: /gallery/animations/example_cone_0.gif

o.plot(fast=True, ocean_color='skyblue', land_color='dimgray', text=text)
Exemplo n.º 30
0
o.run(steps=66 * 2, time_step=1800)

# Second run, for comparison
o2 = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information
o2.add_reader([reader_norkyst, reader_arome])
o2.seed_elements(lon,
                 lat,
                 radius=50,
                 number=5000,
                 time=time,
                 wind_drift_factor=0.0)  # No wind drift
o2.set_config('processes:dispersion', False)
o2.set_config('processes:evaporation', False)
o2.set_config('processes:emulsification', False)
o2.set_config('drift:current_uncertainty', .1)
o2.set_config('drift:wind_uncertainty', 2)
o2.run(steps=66 * 2, time_step=1800)

#%%
# Animate and compare the two runs
o.animation(fast=True,
            compare=o2,
            legend=['Current + 3 % wind drift', 'Current only'])

#%%
# .. image:: /gallery/animations/example_compare_0.gif

o.plot(fast=True,
       compare=o2,
       legend=['Current + 3 % wind drift', 'Current only'])
Exemplo n.º 31
0
o.seed_elements(lon=4.9, lat=60.1, radius=3000, number=2000,
                time=time, z=0, oil_type=oil_type)

#%%
# Adjusting some configuration
o.set_config('processes:evaporation',  True)
o.set_config('processes:emulsification',  True)
o.set_config('drift:vertical_mixing',  True)
o.set_config('vertical_mixing:timestep',  5)

#%%
# Running model
o.run(steps=4*40, time_step=900, time_step_output=3600)

#%%
# Print and plot results
print(o)
o.plot(fast=True)
o.plot_oil_budget()
#o.plot(filename='openoil_drift')
o.plot_vertical_distribution(maxnum=100,bins=50)
o.plot_property('water_fraction', mean=True)
o.plot_property('z')
#o.plot_property('mass_evaporated')
#o.plot_property('water_fraction')
#o.plot_property('interfacial_area')
o.animation(fast=True)

#%%
# .. image:: /gallery/animations/example_openoil_0.gif
Exemplo n.º 32
0
# Seed elements along cone, e.g. ship track with
# increasing uncertainty in position
time = [reader_arome.start_time, reader_arome.start_time + timedelta(hours=30)]
#time = reader_arome.start_time

# Seed oil elements at defined position and time
o.seed_elements(lon,
                lat,
                radius=[1000, 10000],
                number=5000,
                time=time,
                cone=True)

# Adjusting some configuration
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', True)
o.set_config('processes:emulsification', True)
o.set_config('drift:current_uncertainty', .1)
o.set_config('drift:wind_uncertainty', 1)

# Running model (until end of driver data)
o.run(steps=66 * 2, time_step=1800)

# Print and plot results
print(o)
o.plot()
o.animation(filename='cone.gif')

#%%
# .. image:: /gallery/animations/cone.gif