.. 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 21:45:15 INFO opendrift.models.basemodel:529: OpenDriftSimulation initialised (version 1.11.1 / v1.11.1-74-g4504ea0) 21:45:15 INFO opendrift.readers.unstructured.shyfem:67: Opening dataset: https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc 21:45:15 INFO opendrift.readers.unstructured.shyfem:72: Opening file with Dataset 21:45:16 INFO opendrift.readers.unstructured.shyfem:77: Reading grid and coordinate variables.. =========================== Reader: https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc 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.2 open dataset 0:00:00.0 build index 21:45:16 INFO opendrift.models.basemodel.environment:220: Adding a dynamical landmask with max. priority based on assumed maximum speed of 1.0 m/s. Adding a customised landmask may be faster... 21:45:22 INFO opendrift.models.basemodel.environment:247: Fallback values will be used for the following variables which have no readers: 21:45:22 INFO opendrift.models.basemodel.environment:250: x_wind: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: y_wind: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: upward_sea_water_velocity: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: ocean_vertical_diffusivity: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_significant_height: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_stokes_drift_x_velocity: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_stokes_drift_y_velocity: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_swell_wave_to_direction: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_swell_wave_peak_period_from_variance_spectral_density: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_swell_wave_significant_height: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wind_wave_to_direction: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wind_wave_mean_period: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: sea_surface_wind_wave_significant_height: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: surface_downward_x_stress: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: surface_downward_y_stress: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: turbulent_kinetic_energy: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: turbulent_generic_length_scale: 0.000000 21:45:22 INFO opendrift.models.basemodel.environment:250: 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 21:45:22 INFO opendrift.models.basemodel:892: Using existing reader for land_binary_mask 21:45:22 INFO opendrift.models.basemodel:904: All points are in ocean 21:45:23 INFO opendrift.models.basemodel:1995: 2021-04-08 00:00:00 - step 1 of 24 - 1000 active elements (0 deactivated) 21:45:23 INFO opendrift.models.basemodel:1995: 2021-04-08 00:30:00 - step 2 of 24 - 1000 active elements (0 deactivated) 21:45:23 INFO opendrift.models.basemodel:1995: 2021-04-08 01:00:00 - step 3 of 24 - 1000 active elements (0 deactivated) 21:45:24 INFO opendrift.models.basemodel:1995: 2021-04-08 01:30:00 - step 4 of 24 - 1000 active elements (0 deactivated) 21:45:24 INFO opendrift.models.basemodel:1995: 2021-04-08 02:00:00 - step 5 of 24 - 1000 active elements (0 deactivated) 21:45:24 INFO opendrift.models.basemodel:1995: 2021-04-08 02:30:00 - step 6 of 24 - 1000 active elements (0 deactivated) 21:45:25 INFO opendrift.models.basemodel:1995: 2021-04-08 03:00:00 - step 7 of 24 - 1000 active elements (0 deactivated) 21:45:25 INFO opendrift.models.basemodel:1995: 2021-04-08 03:30:00 - step 8 of 24 - 1000 active elements (0 deactivated) 21:45:25 INFO opendrift.models.basemodel:1995: 2021-04-08 04:00:00 - step 9 of 24 - 1000 active elements (0 deactivated) 21:45:26 INFO opendrift.models.basemodel:1995: 2021-04-08 04:30:00 - step 10 of 24 - 1000 active elements (0 deactivated) 21:45:26 INFO opendrift.models.basemodel:1995: 2021-04-08 05:00:00 - step 11 of 24 - 1000 active elements (0 deactivated) 21:45:26 INFO opendrift.models.basemodel:1995: 2021-04-08 05:30:00 - step 12 of 24 - 1000 active elements (0 deactivated) 21:45:27 INFO opendrift.models.basemodel:1995: 2021-04-08 06:00:00 - step 13 of 24 - 1000 active elements (0 deactivated) 21:45:27 INFO opendrift.models.basemodel:1995: 2021-04-08 06:30:00 - step 14 of 24 - 1000 active elements (0 deactivated) 21:45:28 INFO opendrift.models.basemodel:1995: 2021-04-08 07:00:00 - step 15 of 24 - 1000 active elements (0 deactivated) 21:45:28 INFO opendrift.models.basemodel:1995: 2021-04-08 07:30:00 - step 16 of 24 - 1000 active elements (0 deactivated) 21:45:28 INFO opendrift.models.basemodel:1995: 2021-04-08 08:00:00 - step 17 of 24 - 1000 active elements (0 deactivated) 21:45:29 INFO opendrift.models.basemodel:1995: 2021-04-08 08:30:00 - step 18 of 24 - 1000 active elements (0 deactivated) 21:45:29 INFO opendrift.models.basemodel:1995: 2021-04-08 09:00:00 - step 19 of 24 - 1000 active elements (0 deactivated) 21:45:29 INFO opendrift.models.basemodel:1995: 2021-04-08 09:30:00 - step 20 of 24 - 1000 active elements (0 deactivated) 21:45:30 INFO opendrift.models.basemodel:1995: 2021-04-08 10:00:00 - step 21 of 24 - 1000 active elements (0 deactivated) 21:45:30 INFO opendrift.models.basemodel:1995: 2021-04-08 10:30:00 - step 22 of 24 - 1000 active elements (0 deactivated) 21:45:30 INFO opendrift.models.basemodel:1995: 2021-04-08 11:00:00 - step 23 of 24 - 1000 active elements (0 deactivated) 21:45:31 INFO opendrift.models.basemodel:1995: 2021-04-08 11:30:00 - step 24 of 24 - 1000 active elements (0 deactivated) .. 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.2 open dataset 0:00:00.0 build index 0:00:08.4 total 0:00:00.0 preparing 0:00:08.4 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: 16.1 total time 7.1 configuration 0.0 preparing main loop 0.0 moving elements to ocean 8.9 main loop 0.0 updating elements 0.0 cleaning up -------------------- =========================== Model: OceanDrift (OpenDrift version 1.11.1) 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: 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: 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 21:47:08 INFO opendrift.models.basemodel:4546: Saving animation to /root/project/docs/source/gallery/animations/example_shyfem_0.gif... 21:48:42 INFO opendrift.models.basemodel:2986: Time to make animation: 0:03:11.070967 21:48:42 INFO opendrift.models.basemodel:4546: Saving animation to /root/project/docs/source/gallery/animations/example_shyfem_1.gif... 21:48:45 INFO opendrift.models.basemodel:3200: Time to make animation: 0:00:02.708040 .. 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 21:48:45 WARNING opendrift.models.basemodel:2362: Plotting fast. This will make your plots less accurate. (,
) .. rst-class:: sphx-glr-timing **Total running time of the script:** (3 minutes 35.382 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 ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_