o.set_config('vertical_mixing:diffusivitymodel', 'constant') # constant >> use fall back values o.set_config('environment:fallback:ocean_vertical_diffusivity'] = Kz for all profile # can be environment (i.e. from reader), or windspeed_Large1994 ,windspeed_Sundby1983, o.set_config('drift:horizontal_diffusivity',Kxy) # using new config rather than current uncertainty # seed o.set_config('seed:ocean_only', True) # keep only particles from the "frame" that are on the ocean # drift o.set_config('drift:advection_scheme','runge-kutta4') # or 'runge-kutta' o.set_config('drift:current_uncertainty', 0.0 ) # note current_uncertainty can be used to replicate an horizontal diffusion spd_uncertain = sqrt(Kxy*2/dt) o.set_config('drift:vertical_advection', True) o.set_config('vertical_mixing:timestep', 90.0) # if some ocean_vertical_diffusivity!=0, turbulentmixing:timestep should be << 900 seconds o.set_config('drift:vertical_mixing', True) ############################### # Type of settlement ############################### o.habitat('./habitat/National_distribution_paua.shp') # Location of the shapefile with the habitat o.set_config('drift:settlement_in_habitat', True) o.set_config('drift:max_age_seconds', 9*24*3600) # o.set_config('drift:min_settlement_age_seconds', 5*24*3600) o.set_config('general:seafloor_action', 'lift_to_seafloor') o.set_config('drift:Haliotis_iris', True) ############################### # 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
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', True) # prevent opendrift from making a new dynamical landmask ############################### # Define habitat ############################### shp, bins = o.habitat('./habitat/Test_habitat.shp') # Location of the shapefile with the habitat ############################### # 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 = 1 points = np.loadtxt('./Release_test.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)