Beispiel #1
0
####################################################################################################################
# CONFIG
# Adjusting some configuration
o.set_config('general:coastline_action', 'previous')
o.set_config('drift:vertical_advection', True)
o.set_config('drift:vertical_mixing', True)
o.set_config('drift:min_settlement_age_seconds',
             3600)  # minimum age before settling can occur

o.set_config(
    'vertical_mixing:diffusivitymodel',
    'constant')  # use eddy diffusivity from ocean model, or fallback value
o.set_config(
    'vertical_mixing:timestep', 900.
)  # seconds - # Vertical mixing requires fast time step  (but for constant diffusivity, use same as model step)
####################################################################################################################

# Running model
o.run(end_time=nordic_native.start_time + timedelta(days=4.0), time_step=900)

# Print and plot results.
# At the end the wind vanishes, and eggs come to surface
print(o)

o.plot(fast=True)

o.animation(fast=True, color='z')

# Interactive slider (not working in browser)
o.plot_vertical_distribution()
Beispiel #2
0
# Vertical swimming
###############################
# Need a null terminal_velocity
o.set_config('drift:active_vertical_swimming', False) # Correlated random walk across the water column when advected away from coastal habitats
#o.set_config('drift:vertical_velocity', (0.001/10)) # Vertical swimming speed of the larvae: in meter/seconds
o.set_config('drift:maximum_depth', -50) # Maximum depth of larvae: negative in meters
#o.set_config('drift:persistence', 50) # Control the persistence (memory) of the vertical movement to create a correlated random walk and sample the water column


o.list_config()
# o.list_configspec()

###############################
# RUN 
###############################
# Running model (until end of driver data)
o.run(stop_on_error=False,
      time_step=timedelta(seconds = 900), 
      end_time = finish_time,
      time_step_output=timedelta(minutes = 60*24),
      outfile= 'test_development_Opendrift_using_moana.nc')

print("--- %s seconds ---" % (time.time() - start_time))
print(process.memory_info().rss)  # in bytes 


print(o)
o.plot(fast=True, color='z', corners=[163, 180, -52, -31])
o.animation(fast=True, color='z', corners=[163, 180, -52, -31])
o.animation_profile()
#SEED PARTICLES
##############################
#There's a bunch of different ways to seed particles, here's my go-to method
#give corners of a polygon to seed within
minlon = 173.2
maxlon = 173.3
minlat = -35.6
maxlat = -35.5
lons = [minlon, maxlon, maxlon, minlon]
lats = [maxlat, maxlat, minlat, minlat]

time0 = reader0.start_time
z = -5
number = 100

o.seed_within_polygon(lons, lats, number=number, z=z, time=time0)

##############################
#RUN
##############################
#a bunch of tricks you can do here to save only exactly what you want, but here's the basics

o.run(stop_on_error=False,
      end_time=reader1.end_time,
      time_step=3600,
      time_step_output=3600.0,
      outfile='path/outfile_name.nc')

o.plot(filename='path/figure_name.jpg')
o.animation(filename='path/anim_name.mp4')