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
11:39:23 INFO    opendrift.models.basemodel:515: OpenDriftSimulation initialised (version 1.12.0 / v1.12.0-21-gd92d07a)

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)
11:39:23 INFO    opendrift.readers.reader_ROMS_native:148: Opening dataset: /root/project/tests/test_data/2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc
11:39:23 INFO    opendrift.readers.reader_ROMS_native:165: Opening file with Dataset
11:39:23 INFO    opendrift.readers.reader_ROMS_native:246: Read GLS parameters from file.
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for latitude, selecting lat_psi, and discarding lat_rho
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for latitude, selecting lat_psi, and discarding lat_u
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for latitude, selecting lat_psi, and discarding lat_v
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for longitude, selecting lon_psi, and discarding lon_rho
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for longitude, selecting lon_psi, and discarding lon_u
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for longitude, selecting lon_psi, and discarding lon_v
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for land_binary_mask, selecting mask_psi, and discarding mask_rho
11:39:23 WARNING opendrift.readers.reader_ROMS_native:297: Duplicate variables for ocean_s_coordinate_g2, selecting s_rho, and discarding s_w
11:39:23 INFO    opendrift.readers.reader_ROMS_native:304: The following variables without standard_name are discarded: ['AICEnudass', 'Akk_bak', 'Akp_bak', 'Akt_bak', 'Akv_bak', 'Charnok_alpha', 'CrgBan_cw', 'Cs_r', 'Cs_w', 'FSobc_in', 'FSobc_out', 'Falpha', 'Fbeta', 'Fgamma', 'LtracerSrc', 'M2nudg', 'M2obc_in', 'M2obc_out', 'M3nudg', 'M3obc_in', 'M3obc_out', 'Tcline', 'Tnudg', 'Tobc_in', 'Tobc_out', 'Vstretching', 'Vtransform', 'Znudg', 'Zob', 'Zos', 'Zos_hsig_alpha', 'angle', 'dstart', 'dt', 'dtfast', 'el', 'f', 'gamma2', 'gls_Kmin', 'gls_Pmin', 'gls_c1', 'gls_c2', 'gls_c3m', 'gls_c3p', 'gls_cmu0', 'gls_m', 'gls_n', 'gls_p', 'gls_sigk', 'gls_sigp', 'hc', 'mask_u', 'mask_v', 'nAVG', 'nHIS', 'nRST', 'nSTA', 'ndefAVG', 'ndefHIS', 'ndtfast', 'ntimes', 'ntsAVG', 'ocean_time', 'pm', 'pn', 'rdrg', 'rdrg2', 'rho0', 'spherical', 'swrad', 'sz_alpha', 'theta_b', 'theta_s', 'ubar', 'vbar', 'xl', 'zeta_detided']
11:39:23 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.
11:39:23 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)
11:39:23 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...
11:39:27 INFO    opendrift.models.basemodel.environment:245: Fallback values will be used for the following variables which have no readers:
11:39:27 INFO    opendrift.models.basemodel.environment:248:    x_wind: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    y_wind: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    upward_sea_water_velocity: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    ocean_vertical_diffusivity: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_significant_height: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_to_direction: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_peak_period_from_variance_spectral_density: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_swell_wave_significant_height: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_to_direction: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_mean_period: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wind_wave_significant_height: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    surface_downward_x_stress: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    surface_downward_y_stress: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    turbulent_kinetic_energy: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    turbulent_generic_length_scale: 0.000000
11:39:27 INFO    opendrift.models.basemodel.environment:248:    ocean_mixed_layer_thickness: 50.000000

Running model

o.run(time_step=3600)
11:39:28 INFO    opendrift.models.basemodel:1862: Duration, steps or end time not specified, running until end of first reader: 2016-02-04 12:00:00
11:39:28 INFO    opendrift.models.basemodel:1862: Duration, steps or end time not specified, running until end of first reader: 2016-02-04 12:00:00
11:39:28 INFO    opendrift.models.basemodel:935: Using existing reader for land_binary_mask
11:39:28 INFO    opendrift.models.basemodel:946: All points are in ocean
11:39:28 WARNING opendrift.models.basemodel:729: 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.
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 12:00:00 - step 1 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.readers.reader_ROMS_native:354: Using mask_rho for mask_rho
11:39:28 INFO    opendrift.readers.reader_ROMS_native:405: Using zeta for sea surface height
11:39:28 INFO    opendrift.readers.reader_ROMS_native:375: Using mask_u for mask_u
11:39:28 INFO    opendrift.readers.reader_ROMS_native:626: Time: 0:00:00.058250
11:39:28 INFO    opendrift.readers.reader_ROMS_native:396: Using mask_v for mask_v
11:39:28 INFO    opendrift.readers.reader_ROMS_native:419: Using angle from Dataset.
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 13:00:00 - step 2 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 14:00:00 - step 3 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 15:00:00 - step 4 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 16:00:00 - step 5 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 17:00:00 - step 6 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 18:00:00 - step 7 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 19:00:00 - step 8 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 20:00:00 - step 9 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 21:00:00 - step 10 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 22:00:00 - step 11 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-02 23:00:00 - step 12 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-03 00:00:00 - step 13 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-03 01:00:00 - step 14 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-03 02:00:00 - step 15 of 48 - 10 active elements (0 deactivated)
11:39:28 INFO    opendrift.models.basemodel:2035: 2016-02-03 03:00:00 - step 16 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 04:00:00 - step 17 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 05:00:00 - step 18 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 06:00:00 - step 19 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 07:00:00 - step 20 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 08:00:00 - step 21 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 09:00:00 - step 22 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 10:00:00 - step 23 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 11:00:00 - step 24 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 12:00:00 - step 25 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 13:00:00 - step 26 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 14:00:00 - step 27 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 15:00:00 - step 28 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 16:00:00 - step 29 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 17:00:00 - step 30 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 18:00:00 - step 31 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 19:00:00 - step 32 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 20:00:00 - step 33 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 21:00:00 - step 34 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 22:00:00 - step 35 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-03 23:00:00 - step 36 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 00:00:00 - step 37 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 01:00:00 - step 38 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 02:00:00 - step 39 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 03:00:00 - step 40 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 04:00:00 - step 41 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 05:00:00 - step 42 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 06:00:00 - step 43 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 07:00:00 - step 44 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 08:00:00 - step 45 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 09:00:00 - step 46 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 2016-02-04 10:00:00 - step 47 of 48 - 10 active elements (0 deactivated)
11:39:29 INFO    opendrift.models.basemodel:2035: 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.5  total
 0:00:00.0  preparing
 0:00:00.3  reading
 0:00:00.1  interpolation
 0:00:00.0  interpolation_time
 0:00:00.2  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:
    6.8 total time
    5.5 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.12.0)
        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
===========================

11:39:29 WARNING opendrift.models.basemodel:2410: 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 15.565 seconds)

Gallery generated by Sphinx-Gallery