Esempio n. 1
0
o.max_speed = 3#
###############################
# READERS
###############################
thredds_path_1 = 'http://thredds.moanaproject.org:8080/thredds/dodsC/moana/ocean/NZB/v1.9/monthly_avg/nz5km_avg_201603.nc'
reader_moana_v19 = reader_ROMS_native_MOANA.Reader(thredds_path_1) # load data for that year
reader_moana_v19.multiprocessing_fail = True # bypass the use of multi core for coordinates conversion and seems to make the model run much faster.

# # Making customised landmask - not required here, using ROMS landmask 
# reader_landmask = reader_global_landmask.Reader(
#                     llcrnrlon=171.0, llcrnrlat=184.5,
#                     urcrnrlon=-42.0, urcrnrlat=-34.0)
# max is 185deg

# use native landmask of ROMS files
o.add_reader([reader_moana_v19]) # [reader_landmask,reader_moana_v19]
o.set_config('general:use_auto_landmask', False) # prevent opendrift from making a new dynamical landmask

###############################
# PARTICLE SEEDING
###############################
# generic point release location for test

# Define the starting position of the particles within the buffer of intertidal rocky shore on the West Coast of the North Island (NZ)
nb_parts = 100
points = np.loadtxt('./Release_centroid_nat_dist_paua.xyz', delimiter='\t', dtype=str)
plon = points[:,0].astype(np.float)
plat = points[:,1].astype(np.float)
tot_parts = nb_parts * len(plon) # total number of particles released
plon = np.tile(plon, nb_parts)
plat = np.tile(plat, nb_parts)
Esempio n. 2
0

reader_moana_0 = reader_ROMS_native_MOANA.Reader(paths[start_month]) # load data for that year
reader_moana_1 = reader_ROMS_native_MOANA.Reader(paths[start_month+1]) # load data for that year
reader_moana_2 = reader_ROMS_native_MOANA.Reader(paths[start_month+2]) # load data for that year
reader_moana_0.multiprocessing_fail = True # bypass the use of multi core for coordinates conversion and seems to make the model run much faster.
reader_moana_1.multiprocessing_fail = True # bypass the use of multi core for coordinates conversion and seems to make the model run much faster.
reader_moana_2.multiprocessing_fail = True # bypass the use of multi core for coordinates conversion and seems to make the model run much faster.

# # Making customised landmask - not required here, we are using the ROMS landmask i.e. included in netcdf files
# reader_landmask = reader_global_landmask.Reader(
#                     llcrnrlon=171.0, llcrnrlat=184.5,
#                     urcrnrlon=-42.0, urcrnrlat=-34.0)

# use native landmask of ROMS files
o.add_reader([reader_moana_0, reader_moana_1, reader_moana_2]) # 
o.set_config('general:use_auto_landmask', False) # prevent opendrift from making a new dynamical landmask

###############################
# PARTICLE SEEDING
###############################
#Reinga
lons = [172.75, 172.8, 172.8, 172.75]
lats = [-34.3, -34.3, -34.35, -34.35]

def create_seed_times(start, end, delta):
  """
  crate times at given interval to seed particles
  """
  out = []
  start_t = start
Esempio n. 3
0
import os
import sys
import time
import numpy as np
import matplotlib
from datetime import datetime, timedelta
from opendrift.readers import reader_ROMS_native_MOANA
from opendrift.models.bivalvelarvae import BivalveLarvae


r = reader_ROMS_native_MOANA.Reader('input/nz5km_avg_200601.nc')
o = BivalveLarvae(loglevel=30)
o.add_reader([r])

###############################
#Set Configs
###############################
o.set_config('general:use_auto_landmask', True)
o.set_config('environment:fallback:x_wind', 0.0)
o.set_config('environment:fallback:y_wind', 0.0)
o.set_config('environment:fallback:x_sea_water_velocity', 0.0)
o.set_config('environment:fallback:y_sea_water_velocity', 0.0)
o.set_config('environment:fallback:sea_floor_depth_below_sea_level', 100000.0)

Kxy = 0.1176  #m2/s-1
Kz = 0.01 #m2/s-1

o.set_config('drift:horizontal_diffusivity',Kxy) 
o.set_config('environment:fallback:ocean_vertical_diffusivity', Kz) 
o.set_config('seed:ocean_only',True)
o.set_config('drift:advection_scheme','runge-kutta4')
o = BivalveLarvae(loglevel=100)  # Set loglevel to 0 for debug information
o.max_speed = 5.0  #

###############################
# READERS
###############################

reader_moana_v19_1 = reader_ROMS_native_MOANA.Reader(
    '/nesi/nobackup/mocean02574/NZB_N50/nz5km_his_201706.nc')
reader_moana_v19_2 = reader_ROMS_native_MOANA.Reader(
    '/nesi/nobackup/mocean02574/NZB_N50/nz5km_his_201707.nc')
reader_moana_v19_3 = reader_ROMS_native_MOANA.Reader(
    '/nesi/nobackup/mocean02574/NZB_N50/nz5km_his_201708.nc')

o.add_reader([reader_moana_v19_1, reader_moana_v19_2, reader_moana_v19_3])
o.set_config('general:use_auto_landmask', False)  # dynamical landmask if true

###############################
# PARTICLE SEEDING
###############################

# Define the starting position of the particles within the buffer of intertidal rocky shore on the West Coast of the North Island (NZ)
nb_parts = 250  # number of particles released per point during the release interval
points = np.loadtxt(
    '/nesi/project/vuw03295/Regional_projects/Ninety_miles_beach/First_foreward_input_files/Release_points_rocky_shore_005deg_Moana_all_poly.xyz',
    delimiter='\t',
    dtype=str)
plon = points[:, 0].astype(np.float)
plat = points[:, 1].astype(np.float)
tot_parts = nb_parts * len(plon)  # total number of particles released
Esempio n. 5
0
####################################################################################################################
# READERS
#
# Atmospheric model for wind
# reader_arome = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
#     '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')

# Ocean model for current
# reader_norkyst = reader_netCDF_pytCF_generic.Reader(o.test_data_folder() +
#     '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')
# # Creating and adding reader for Nordic 4km current dataset
nordic_native = reader_ROMS_native.Reader(
    o.test_data_folder() +
    '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc')
o.add_reader(nordic_native)

# default values for forcing variables
o.set_config('environment:fallback:ocean_vertical_diffusivity', 0.001)  # m2/s
####################################################################################################################

####################################################################################################################
# SEEDING
# time = datetime.utcnow()
o.seed_elements(lon=12.0,
                lat=68.3,
                z=-3.0,
                radius=100,
                number=100,
                time=nordic_native.start_time,
                neutral_buoyancy_salinity=31.25)
Esempio n. 6
0
reader0 = reader_ROMS_native_MOANA.Reader(path0)
reader1 = reader_ROMS_native_MOANA.Reader(path1)
reader2 = reader_ROMS_native_MOANA.Reader(path2)

reader0.multiprocessing_fail = True 
reader1.multiprocessing_fail = True 
reader2.multiprocessing_fail = True 


###############################
#Create Simulation Object
###############################

o = BivalveLarvae(loglevel=0)
o.add_reader([reader0, reader1, reader2])

###############################
#Seed Particles
###############################

ullon = args.upperleftlon 
ullat = args.upperleftlat

lons = [ullon, ullon+.05, ullon+.05, ullon]
lats = [ullat, ullat, ullat-.05, ullat-.05]


def create_seed_times(start, end, delta):
  """
  crate times at given interval to seed particles
    loglevel=0
)  #loglevel = 0 will print out what the model is doing at every step, so helpful when getting started, but creates huge output files. When you are running larger quantities of runs, you'll want to change to loglevel = 30

#provide paths to the data for the months you want
data_path0 = '/nesi/nobackup/mocean02574/NZB_N50/nz5km_his_201606.nc'
data_path1 = '/nesi/nobackup/mocean02574/NZB_N50/nz5km_his_201607.nc'

#create readers for the backbone files
reader0 = reader_ROMS_native_MOANA.Reader(data_path0)
reader1 = reader_ROMS_native_MOANA.Reader(data_path1)

reader0.multiprocessing_fail = True  #No idea what these lines do, but Simon told me that they make the model ruun faster so I've always included them
reader1.multiprocessing_fail = True

#add readers to the simulation
o.add_reader([reader0, reader1])

##############################
#SET CONFIGURATIONS
##############################

#There are a bunch of configs you can set, I'll just explain the ones I've used

o.set_config(
    'general:use_auto_landmask', False
)  #If you use True, opendrift will automatically create a higher-res landmask and project data to try and fill in the gaps. False runs using the backbone's block, 5km landmask.
# setting fallback values
o.set_config('environment:fallback:x_wind', 0.0)
o.set_config('environment:fallback:y_wind', 0.0)
o.set_config('environment:fallback:x_sea_water_velocity', 0.0)
o.set_config('environment:fallback:y_sea_water_velocity', 0.0)