.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_roms_native.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_example_roms_native.py: ROMS native reader ================================== .. GENERATED FROM PYTHON SOURCE LINES 6-14 .. code-block:: Python import numpy as np from opendrift import test_data_folder from opendrift.readers import reader_ROMS_native from opendrift.models.oceandrift import OceanDrift o = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information .. rst-class:: sphx-glr-script-out .. code-block:: none 13:49:58 INFO opendrift:576: OpenDriftSimulation initialised (version 1.14.7 / v1.14.7-15-g2988cd4) .. GENERATED FROM PYTHON SOURCE LINES 15-16 Creating and adding reader for Nordic 4km current dataset .. GENERATED FROM PYTHON SOURCE LINES 16-20 .. code-block:: Python nordic_native = reader_ROMS_native.Reader(test_data_folder + '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc') o.add_reader(nordic_native) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:49:58 INFO opendrift.readers:63: Opening file with xr.open_dataset 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for land_binary_mask, selecting mask_psi, and discarding mask_rho 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for latitude, selecting lat_psi, and discarding lat_rho 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for latitude, selecting lat_psi, and discarding lat_u 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for latitude, selecting lat_psi, and discarding lat_v 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for longitude, selecting lon_psi, and discarding lon_rho 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for longitude, selecting lon_psi, and discarding lon_u 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for longitude, selecting lon_psi, and discarding lon_v 13:49:58 WARNING opendrift.readers.reader_ROMS_native:310: Duplicate variables for ocean_s_coordinate_g2, selecting s_rho, and discarding s_w 13:49:58 INFO opendrift.readers.reader_ROMS_native:317: 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', 'pm', 'pn', 'rdrg', 'rdrg2', 'rho0', 'spherical', 'swrad', 'sz_alpha', 'theta_b', 'theta_s', 'ubar', 'vbar', 'xl', 'zeta_detided', 'ocean_time'] 13:49:58 WARNING opendrift.readers.basereader.structured:50: No proj string or projection could be derived for reader roms native, using 'fakeproj'. 13:49:58 INFO opendrift.readers.basereader.structured:88: Making interpolator for lon,lat to x,y conversion... .. GENERATED FROM PYTHON SOURCE LINES 21-22 Seed elements at defined positions, depth and time .. GENERATED FROM PYTHON SOURCE LINES 22-25 .. code-block:: Python o.seed_elements(lon=12.0, lat=68.3, radius=0, number=10, z=np.linspace(0, -150, 10), time=nordic_native.start_time) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:49:59 INFO opendrift.models.basemodel.environment:203: Adding a global landmask from GSHHG 13:50:04 INFO opendrift.models.basemodel.environment:227: Fallback values will be used for the following variables which have no readers: 13:50:04 INFO opendrift.models.basemodel.environment:230: x_wind: 0.000000 13:50:04 INFO opendrift.models.basemodel.environment:230: y_wind: 0.000000 13:50:04 INFO opendrift.models.basemodel.environment:230: upward_sea_water_velocity: 0.000000 13:50:04 INFO opendrift.models.basemodel.environment:230: ocean_vertical_diffusivity: 0.000000 13:50:04 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_significant_height: 0.000000 13:50:04 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_x_velocity: 0.000000 13:50:04 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_y_velocity: 0.000000 13:50:04 INFO opendrift.models.basemodel.environment:230: ocean_mixed_layer_thickness: 50.000000 .. GENERATED FROM PYTHON SOURCE LINES 26-27 Running model .. GENERATED FROM PYTHON SOURCE LINES 27-29 .. code-block:: Python o.run(time_step=3600) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:50:04 INFO opendrift:1803: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False] 13:50:04 INFO opendrift:1803: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False] 13:50:04 INFO opendrift:1814: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 13:50:04 INFO opendrift:1814: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 13:50:04 INFO opendrift:1822: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True] 13:50:04 INFO opendrift:1883: Duration, steps or end time not specified, running until end of first reader: 2016-02-04 12:00:00 13:50:04 INFO opendrift:1883: Duration, steps or end time not specified, running until end of first reader: 2016-02-04 12:00:00 13:50:04 INFO opendrift:952: Using existing reader for land_binary_mask to move elements to ocean 13:50:04 INFO opendrift:982: All points are in ocean 13:50:04 INFO opendrift:2111: 2016-02-02 12:00:00 - step 1 of 48 - 10 active elements (0 deactivated) 13:50:04 INFO opendrift.readers.reader_ROMS_native:367: Using mask_rho for mask_rho 13:50:04 INFO opendrift.readers.reader_ROMS_native:418: Using zeta for sea surface height 13:50:04 INFO opendrift.readers.reader_ROMS_native:388: Using mask_u for mask_u 13:50:04 INFO opendrift.readers.reader_ROMS_native:639: Time: 0:00:00.692506 13:50:04 INFO opendrift.readers.reader_ROMS_native:409: Using mask_v for mask_v 13:50:04 INFO opendrift.readers.reader_ROMS_native:432: Using angle from Dataset. 13:50:04 INFO opendrift:2111: 2016-02-02 13:00:00 - step 2 of 48 - 10 active elements (0 deactivated) 13:50:04 INFO opendrift:2111: 2016-02-02 14:00:00 - step 3 of 48 - 10 active elements (0 deactivated) 13:50:04 INFO opendrift:2111: 2016-02-02 15:00:00 - step 4 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 16:00:00 - step 5 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 17:00:00 - step 6 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 18:00:00 - step 7 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 19:00:00 - step 8 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 20:00:00 - step 9 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 21:00:00 - step 10 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 22:00:00 - step 11 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-02 23:00:00 - step 12 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 00:00:00 - step 13 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 01:00:00 - step 14 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 02:00:00 - step 15 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 03:00:00 - step 16 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 04:00:00 - step 17 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 05:00:00 - step 18 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 06:00:00 - step 19 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 07:00:00 - step 20 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 08:00:00 - step 21 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 09:00:00 - step 22 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 10:00:00 - step 23 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 11:00:00 - step 24 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 12:00:00 - step 25 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 13:00:00 - step 26 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 14:00:00 - step 27 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 15:00:00 - step 28 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 16:00:00 - step 29 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 17:00:00 - step 30 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 18:00:00 - step 31 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 19:00:00 - step 32 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 20:00:00 - step 33 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 21:00:00 - step 34 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 22:00:00 - step 35 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-03 23:00:00 - step 36 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-04 00:00:00 - step 37 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-04 01:00:00 - step 38 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-04 02:00:00 - step 39 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-04 03:00:00 - step 40 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-04 04:00:00 - step 41 of 48 - 10 active elements (0 deactivated) 13:50:05 INFO opendrift:2111: 2016-02-04 05:00:00 - step 42 of 48 - 10 active elements (0 deactivated) 13:50:06 INFO opendrift:2111: 2016-02-04 06:00:00 - step 43 of 48 - 10 active elements (0 deactivated) 13:50:06 INFO opendrift:2111: 2016-02-04 07:00:00 - step 44 of 48 - 10 active elements (0 deactivated) 13:50:06 INFO opendrift:2111: 2016-02-04 08:00:00 - step 45 of 48 - 10 active elements (0 deactivated) 13:50:06 INFO opendrift:2111: 2016-02-04 09:00:00 - step 46 of 48 - 10 active elements (0 deactivated) 13:50:06 INFO opendrift:2111: 2016-02-04 10:00:00 - step 47 of 48 - 10 active elements (0 deactivated) 13:50:06 INFO opendrift:2111: 2016-02-04 11:00:00 - step 48 of 48 - 10 active elements (0 deactivated) .. raw:: html
<xarray.Dataset> Size: 42kB
    Dimensions:                                   (trajectory: 10, time: 49)
    Coordinates:
      * trajectory                                (trajectory) int64 80B 0 1 ... 8 9
      * time                                      (time) datetime64[ns] 392B 2016...
    Data variables: (12/21)
        status                                    (trajectory, time) float32 2kB ...
        moving                                    (trajectory, time) float32 2kB ...
        age_seconds                               (trajectory, time) float32 2kB ...
        origin_marker                             (trajectory, time) float32 2kB ...
        lon                                       (trajectory, time) float32 2kB ...
        lat                                       (trajectory, time) float32 2kB ...
        ...                                        ...
        upward_sea_water_velocity                 (trajectory, time) float32 2kB ...
        sea_surface_wave_significant_height       (trajectory, time) float32 2kB ...
        sea_surface_wave_stokes_drift_x_velocity  (trajectory, time) float32 2kB ...
        sea_surface_wave_stokes_drift_y_velocity  (trajectory, time) float32 2kB ...
        sea_floor_depth_below_sea_level           (trajectory, time) float32 2kB ...
        land_binary_mask                          (trajectory, time) float32 2kB ...
    Attributes: (12/119)
        Conventions:                                                           CF...
        standard_name_vocabulary:                                              CF...
        featureType:                                                           tr...
        title:                                                                 Op...
        summary:                                                               Ou...
        keywords:                                                              tr...
        ...                                                                    ...
        geospatial_lon_units:                                                  de...
        geospatial_lon_resolution:                                             point
        runtime:                                                               0:...
        geospatial_vertical_min:                                               -1...
        geospatial_vertical_max:                                               0.0
        geospatial_vertical_positive:                                          up


.. GENERATED FROM PYTHON SOURCE LINES 30-31 Print and plot results, with lines colored by particle depth .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: Python print(o) o.plot(linecolor='z', fast=True) #o.animation() .. image-sg:: /gallery/images/sphx_glr_example_roms_native_001.png :alt: OpenDrift - OceanDrift 2016-02-02 12:00 to 2016-02-04 12:00 UTC (49 steps) :srcset: /gallery/images/sphx_glr_example_roms_native_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none =========================== -------------------- Reader performance: -------------------- roms native 0:00:01.0 total 0:00:00.0 preparing 0:00:00.9 reading 0:00:00.1 interpolation 0:00:00.0 interpolation_time 0:00:00.0 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.8 total time 5.7 configuration 0.0 preparing main loop 0.0 moving elements to ocean 2.0 main loop 0.0 updating elements 0.0 cleaning up -------------------- =========================== Model: OceanDrift (OpenDrift version 1.14.7) 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: sea_surface_wave_significant_height sea_surface_wave_stokes_drift_x_velocity sea_surface_wave_stokes_drift_y_velocity 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 =========================== 13:50:06 WARNING opendrift:2473: Plotting fast. This will make your plots less accurate. (,
) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 16.772 seconds) .. _sphx_glr_download_gallery_example_roms_native.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_roms_native.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_roms_native.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_roms_native.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_