.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_shyfem.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_shyfem.py: SHYFEM: Using model input from unstructured grid ================================================ .. GENERATED FROM PYTHON SOURCE LINES 6-26 .. code-block:: Python from datetime import timedelta import numpy as np from opendrift.readers.unstructured import shyfem from opendrift.models.oceandrift import OceanDrift o = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information o.set_config('general:coastline_action', 'previous') shyfem = shyfem.Reader('https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc') o.add_reader(shyfem) print(shyfem) # Seed elements at defined positions, depth and time N = 1000 z = -15*np.random.uniform(0, 1, N) o.seed_elements(lon=12.4, lat=45.25, radius=1000, number=N, z=z, time=shyfem.start_time) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:23:04 INFO opendrift:569: OpenDriftSimulation initialised (version 1.14.10 / v1.14.10-27-gff3ada1) 13:23:04 INFO opendrift.readers.unstructured.shyfem:67: Opening dataset: https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc 13:23:04 INFO opendrift.readers.unstructured.shyfem:72: Opening file with Dataset 13:23:04 INFO opendrift.readers.unstructured.shyfem:77: Reading grid and coordinate variables.. =========================== Reader: https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc Reader type: opendrift.readers.unstructured.shyfem Projection: +proj=lonlat Coverage: [degrees] xmin: 12.240470 xmax: 19.917908 ymin: 39.957329 ymax: 45.799709 Corners (lon, lat): ( 12.24, 45.80) ( 19.92, 45.80) ( 12.24, 39.96) ( 19.92, 39.96) Vertical levels [m]: [-0.6000000238418579 -1.600000023841858 -2.5 -3.5 -4.5 -5.5 -7.0 -9.0 -11.0 -13.0 -16.0 -21.0 -27.0 -34.0 -41.5 -50.0 -60.0 -72.5 -90.0 -110.0 -135.0 -175.0 -225.0 -275.0 -350.0 -450.0 -550.0 -650.0 -750.0 -850.0 -950.0 -1050.0 -1155.0] Available time range: start: 2021-04-08 00:00:00 end: 2021-04-08 23:00:00 step: None Variables: depth sea_water_salinity sea_water_temperature sea_floor_depth_below_sea_level x_sea_water_velocity y_sea_water_velocity water_surface_height_above_reference_datum sea_water_speed - derived from ['x_sea_water_velocity', 'y_sea_water_velocity'] =========================== 0:00:01.3 open dataset 0:00:00.0 build index 13:23:05 INFO opendrift.models.basemodel.environment:203: Adding a global landmask from GSHHG 13:23:09 INFO opendrift.models.basemodel.environment:227: Fallback values will be used for the following variables which have no readers: 13:23:09 INFO opendrift.models.basemodel.environment:230: sea_surface_height: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: x_wind: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: y_wind: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: upward_sea_water_velocity: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: ocean_vertical_diffusivity: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: horizontal_diffusivity: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_significant_height: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_x_velocity: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_y_velocity: 0.000000 13:23:09 INFO opendrift.models.basemodel.environment:230: ocean_mixed_layer_thickness: 50.000000 .. GENERATED FROM PYTHON SOURCE LINES 27-28 Running model .. GENERATED FROM PYTHON SOURCE LINES 28-30 .. code-block:: Python o.run(time_step=1800, duration=timedelta(hours=12)) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:23:09 INFO opendrift:1903: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False] 13:23:09 INFO opendrift:1903: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False] 13:23:09 INFO opendrift:1914: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 13:23:09 INFO opendrift:1914: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 13:23:09 INFO opendrift:1922: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True] 13:23:09 INFO opendrift:955: Using existing reader for land_binary_mask to move elements to ocean 13:23:09 INFO opendrift:986: All points are in ocean 13:23:09 INFO opendrift:2211: 2021-04-08 00:00:00 - step 1 of 24 - 1000 active elements (0 deactivated) 13:23:10 INFO opendrift:2211: 2021-04-08 00:30:00 - step 2 of 24 - 1000 active elements (0 deactivated) 13:23:10 INFO opendrift:2211: 2021-04-08 01:00:00 - step 3 of 24 - 1000 active elements (0 deactivated) 13:23:11 INFO opendrift:2211: 2021-04-08 01:30:00 - step 4 of 24 - 1000 active elements (0 deactivated) 13:23:11 INFO opendrift:2211: 2021-04-08 02:00:00 - step 5 of 24 - 1000 active elements (0 deactivated) 13:23:11 INFO opendrift:2211: 2021-04-08 02:30:00 - step 6 of 24 - 1000 active elements (0 deactivated) 13:23:12 INFO opendrift:2211: 2021-04-08 03:00:00 - step 7 of 24 - 1000 active elements (0 deactivated) 13:23:12 INFO opendrift:2211: 2021-04-08 03:30:00 - step 8 of 24 - 1000 active elements (0 deactivated) 13:23:12 INFO opendrift:2211: 2021-04-08 04:00:00 - step 9 of 24 - 1000 active elements (0 deactivated) 13:23:13 INFO opendrift:2211: 2021-04-08 04:30:00 - step 10 of 24 - 1000 active elements (0 deactivated) 13:23:13 INFO opendrift:2211: 2021-04-08 05:00:00 - step 11 of 24 - 1000 active elements (0 deactivated) 13:23:14 INFO opendrift:2211: 2021-04-08 05:30:00 - step 12 of 24 - 1000 active elements (0 deactivated) 13:23:14 INFO opendrift:2211: 2021-04-08 06:00:00 - step 13 of 24 - 1000 active elements (0 deactivated) 13:23:14 INFO opendrift:2211: 2021-04-08 06:30:00 - step 14 of 24 - 1000 active elements (0 deactivated) 13:23:15 INFO opendrift:2211: 2021-04-08 07:00:00 - step 15 of 24 - 1000 active elements (0 deactivated) 13:23:15 INFO opendrift:2211: 2021-04-08 07:30:00 - step 16 of 24 - 1000 active elements (0 deactivated) 13:23:15 INFO opendrift:2211: 2021-04-08 08:00:00 - step 17 of 24 - 1000 active elements (0 deactivated) 13:23:16 INFO opendrift:2211: 2021-04-08 08:30:00 - step 18 of 24 - 1000 active elements (0 deactivated) 13:23:16 INFO opendrift:2211: 2021-04-08 09:00:00 - step 19 of 24 - 1000 active elements (0 deactivated) 13:23:16 INFO opendrift:2211: 2021-04-08 09:30:00 - step 20 of 24 - 1000 active elements (0 deactivated) 13:23:17 INFO opendrift:2211: 2021-04-08 10:00:00 - step 21 of 24 - 1000 active elements (0 deactivated) 13:23:17 INFO opendrift:2211: 2021-04-08 10:30:00 - step 22 of 24 - 1000 active elements (0 deactivated) 13:23:17 INFO opendrift:2211: 2021-04-08 11:00:00 - step 23 of 24 - 1000 active elements (0 deactivated) 13:23:18 INFO opendrift:2211: 2021-04-08 11:30:00 - step 24 of 24 - 1000 active elements (0 deactivated) .. raw:: html
<xarray.Dataset> Size: 2MB
    Dimensions:                                   (trajectory: 1000, time: 25)
    Coordinates:
      * trajectory                                (trajectory) int64 8kB 0 1 ... 999
      * time                                      (time) datetime64[ns] 200B 2021...
    Data variables: (12/22)
        status                                    (trajectory, time) float32 100kB ...
        moving                                    (trajectory, time) float32 100kB ...
        age_seconds                               (trajectory, time) float32 100kB ...
        origin_marker                             (trajectory, time) float32 100kB ...
        lon                                       (trajectory, time) float32 100kB ...
        lat                                       (trajectory, time) float32 100kB ...
        ...                                        ...
        horizontal_diffusivity                    (trajectory, time) float32 100kB ...
        sea_surface_wave_significant_height       (trajectory, time) float32 100kB ...
        sea_surface_wave_stokes_drift_x_velocity  (trajectory, time) float32 100kB ...
        sea_surface_wave_stokes_drift_y_velocity  (trajectory, time) float32 100kB ...
        sea_floor_depth_below_sea_level           (trajectory, time) float32 100kB ...
        land_binary_mask                          (trajectory, time) float32 100kB ...
    Attributes: (12/121)
        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...
        geospatial_vertical_positive:                                          up


.. GENERATED FROM PYTHON SOURCE LINES 31-32 Print and plot results .. GENERATED FROM PYTHON SOURCE LINES 32-34 .. code-block:: Python print(o) .. rst-class:: sphx-glr-script-out .. code-block:: none =========================== -------------------- Reader performance: -------------------- https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc 0:00:01.3 open dataset 0:00:00.0 build index 0:00:08.1 total 0:00:00.0 preparing 0:00:08.1 reading 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: 14.6 total time 5.7 configuration 0.1 preparing main loop 0.0 moving elements to ocean 8.7 main loop 0.0 updating elements 0.0 cleaning up -------------------- =========================== Model: OceanDrift (OpenDrift version 1.14.10) 1000 active Lagrangian3DArray particles (0 deactivated, 0 scheduled) ------------------- Environment variables: ----- sea_floor_depth_below_sea_level x_sea_water_velocity y_sea_water_velocity 1) https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc ----- land_binary_mask 1) global_landmask ----- Readers not added for the following variables: horizontal_diffusivity sea_surface_height 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: 2021-04-08 00:00:00 UTC Present: 2021-04-08 12:00:00 UTC Calculation steps: 24 * 0:30:00 - total time: 12:00:00 Output steps: 25 * 0:30:00 =========================== .. GENERATED FROM PYTHON SOURCE LINES 35-36 Animations .. GENERATED FROM PYTHON SOURCE LINES 36-41 .. code-block:: Python o.animation(color='z', markersize=5, corners=[12.2, 12.6, 45.1, 45.5]) o.animation_profile(color='z', markersize=5) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:23:27 INFO opendrift:4795: Saving animation to /root/project/docs/source/gallery/animations/example_shyfem_0.gif... 13:23:36 INFO opendrift:3215: Time to make animation: 0:00:17.598163 13:23:36 INFO opendrift:4795: Saving animation to /root/project/docs/source/gallery/animations/example_shyfem_1.gif... 13:23:40 INFO opendrift:3433: Time to make animation: 0:00:03.676960 .. GENERATED FROM PYTHON SOURCE LINES 42-44 .. image:: /gallery/animations/example_shyfem_0.gif .. image:: /gallery/animations/example_shyfem_1.gif .. GENERATED FROM PYTHON SOURCE LINES 44-45 .. code-block:: Python o.plot(fast=True, buffer = 1., corners=[12.2, 12.6, 45.1, 45.5]) .. image-sg:: /gallery/images/sphx_glr_example_shyfem_001.png :alt: OpenDrift - OceanDrift 2021-04-08 00:00 to 2021-04-08 12:00 UTC (25 steps) :srcset: /gallery/images/sphx_glr_example_shyfem_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 13:23:40 WARNING opendrift:2587: Plotting fast. This will make your plots less accurate. (,
) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 47.393 seconds) .. _sphx_glr_download_gallery_example_shyfem.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_shyfem.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_shyfem.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_shyfem.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_