ROMS native reader

import numpy as np
from opendrift.readers import reader_ROMS_native
from opendrift.models.oceandrift import OceanDrift

o = OceanDrift(loglevel=20)  # Set loglevel to 0 for debug information
08:40:53 INFO    opendrift.models.basemodel:533: OpenDriftSimulation initialised (version 1.11.2 / v1.11.2-45-g6369924)

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)
08:40:53 INFO    opendrift.readers.reader_ROMS_native:150: Opening dataset: /root/project/tests/test_data/2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc
08:40:53 INFO    opendrift.readers.reader_ROMS_native:167: Opening file with Dataset
08:40:53 INFO    opendrift.readers.reader_ROMS_native:248: Read GLS parameters from file.
08:40:53 WARNING opendrift.readers.basereader.structured:50: No proj string or projection could be derived, using 'fakeproj'. This assumes that the variables are structured and gridded approximately equidistantly on the surface (i.e. in meters). This must be guaranteed by the user. You can get rid of this warning by supplying a valid projection to the reader.
08:40:53 INFO    opendrift.readers.basereader.structured:90: Making interpolator for lon,lat to x,y conversion...

Seed elements at defined positions, depth and time

o.seed_elements(lon=12.0, lat=68.3, radius=0, number=10,
                z=np.linspace(0, -150, 10), time=nordic_native.start_time)
08:40:53 INFO    opendrift.models.basemodel.environment:218: Adding a dynamical landmask with max. priority based on assumed maximum speed of 2.0 m/s. Adding a customised landmask may be faster...
08:40:59 INFO    opendrift.models.basemodel.environment:245: Fallback values will be used for the following variables which have no readers:
08:40:59 INFO    opendrift.models.basemodel.environment:248:    x_wind: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    y_wind: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    upward_sea_water_velocity: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    ocean_vertical_diffusivity: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_significant_height: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_to_direction: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_peak_period_from_variance_spectral_density: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_significant_height: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_to_direction: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_mean_period: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_significant_height: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    surface_downward_x_stress: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    surface_downward_y_stress: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    turbulent_kinetic_energy: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    turbulent_generic_length_scale: 0.000000
08:40:59 INFO    opendrift.models.basemodel.environment:248:    ocean_mixed_layer_thickness: 50.000000

Running model

o.run(time_step=3600)
08:40:59 INFO    opendrift.models.basemodel:1836: Duration, steps or end time not specified, running until end of first reader: 2016-02-04 12:00:00
08:40:59 INFO    opendrift.models.basemodel:1836: Duration, steps or end time not specified, running until end of first reader: 2016-02-04 12:00:00
08:40:59 INFO    opendrift.models.basemodel:911: Using existing reader for land_binary_mask
08:40:59 INFO    opendrift.models.basemodel:922: All points are in ocean
08:40:59 WARNING opendrift.models.basemodel:705: Seafloor check not being run because environment is missing. This will happen the first time the function is run but if it happens subsequently there is probably a problem.
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 12:00:00 - step 1 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.readers.reader_ROMS_native:320: Using mask_rho for mask_rho
08:40:59 INFO    opendrift.readers.reader_ROMS_native:371: Using zeta for sea surface height
08:40:59 INFO    opendrift.readers.reader_ROMS_native:341: Using mask_u for mask_u
08:40:59 INFO    opendrift.readers.reader_ROMS_native:598: Time: 0:00:00.146483
08:40:59 INFO    opendrift.readers.reader_ROMS_native:362: Using mask_v for mask_v
08:40:59 INFO    opendrift.readers.reader_ROMS_native:385: Using angle from Dataset.
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 13:00:00 - step 2 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 14:00:00 - step 3 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 15:00:00 - step 4 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 16:00:00 - step 5 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 17:00:00 - step 6 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 18:00:00 - step 7 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 19:00:00 - step 8 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 20:00:00 - step 9 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 21:00:00 - step 10 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 22:00:00 - step 11 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-02 23:00:00 - step 12 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 00:00:00 - step 13 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 01:00:00 - step 14 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 02:00:00 - step 15 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 03:00:00 - step 16 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 04:00:00 - step 17 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 05:00:00 - step 18 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 06:00:00 - step 19 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 07:00:00 - step 20 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 08:00:00 - step 21 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 09:00:00 - step 22 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 10:00:00 - step 23 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 11:00:00 - step 24 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 12:00:00 - step 25 of 48 - 10 active elements (0 deactivated)
08:40:59 INFO    opendrift.models.basemodel:2011: 2016-02-03 13:00:00 - step 26 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 14:00:00 - step 27 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 15:00:00 - step 28 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 16:00:00 - step 29 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 17:00:00 - step 30 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 18:00:00 - step 31 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 19:00:00 - step 32 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 20:00:00 - step 33 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 21:00:00 - step 34 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 22:00:00 - step 35 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-03 23:00:00 - step 36 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 00:00:00 - step 37 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 01:00:00 - step 38 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 02:00:00 - step 39 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 03:00:00 - step 40 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 04:00:00 - step 41 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 05:00:00 - step 42 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 06:00:00 - step 43 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 07:00:00 - step 44 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 08:00:00 - step 45 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 09:00:00 - step 46 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 10:00:00 - step 47 of 48 - 10 active elements (0 deactivated)
08:41:00 INFO    opendrift.models.basemodel:2011: 2016-02-04 11:00:00 - step 48 of 48 - 10 active elements (0 deactivated)

Print and plot results, with lines colored by particle depth

print(o)
o.plot(linecolor='z', fast=True)
#o.animation()
OpenDrift - OceanDrift 2016-02-02 12:00 to 2016-02-04 12:00 UTC (49 steps)
===========================
--------------------
Reader performance:
--------------------
roms native
 0:00:00.6  total
 0:00:00.0  preparing
 0:00:00.4  reading
 0:00:00.1  interpolation
 0:00:00.0  interpolation_time
 0:00:00.1  rotating vectors
 0:00:00.0  masking
--------------------
global_landmask
 0:00:00.0  total
 0:00:00.0  preparing
 0:00:00.0  reading
 0:00:00.0  masking
--------------------
Performance:
    7.5 total time
    6.2 configuration
    0.0 preparing main loop
      0.0 moving elements to ocean
    1.2 main loop
      0.0 updating elements
    0.0 cleaning up
--------------------
===========================
Model:  OceanDrift     (OpenDrift version 1.11.2)
        10 active Lagrangian3DArray particles  (0 deactivated, 0 scheduled)
-------------------
Environment variables:
  -----
  sea_floor_depth_below_sea_level
  sea_surface_height
  x_sea_water_velocity
  y_sea_water_velocity
     1) roms native
  -----
  land_binary_mask
     1) global_landmask
  -----
Readers not added for the following variables:
  ocean_mixed_layer_thickness
  ocean_vertical_diffusivity
  sea_surface_swell_wave_peak_period_from_variance_spectral_density
  sea_surface_swell_wave_significant_height
  sea_surface_swell_wave_to_direction
  sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment
  sea_surface_wave_period_at_variance_spectral_density_maximum
  sea_surface_wave_significant_height
  sea_surface_wave_stokes_drift_x_velocity
  sea_surface_wave_stokes_drift_y_velocity
  sea_surface_wind_wave_mean_period
  sea_surface_wind_wave_significant_height
  sea_surface_wind_wave_to_direction
  surface_downward_x_stress
  surface_downward_y_stress
  turbulent_generic_length_scale
  turbulent_kinetic_energy
  upward_sea_water_velocity
  x_wind
  y_wind

Discarded readers:

Time:
        Start: 2016-02-02 12:00:00 UTC
        Present: 2016-02-04 12:00:00 UTC
        Calculation steps: 48 * 1:00:00 - total time: 2 days, 0:00:00
        Output steps: 49 * 1:00:00
===========================

08:41:00 WARNING opendrift.models.basemodel:2379: Plotting fast. This will make your plots less accurate.

(<GeoAxes: title={'center': 'OpenDrift - OceanDrift\n2016-02-02 12:00 to 2016-02-04 12:00 UTC (49 steps)'}>, <Figure size 1017.46x1100 with 2 Axes>)

Total running time of the script: (0 minutes 10.708 seconds)

Gallery generated by Sphinx-Gallery