.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_larvae.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_larvae.py: Fish Eggs and Larvae ==================== .. GENERATED FROM PYTHON SOURCE LINES 6-13 .. code-block:: Python from datetime import datetime, timedelta from opendrift.readers.reader_constant import Reader as ConstantReader from opendrift.models.larvalfish import LarvalFish o = LarvalFish(loglevel=50) .. GENERATED FROM PYTHON SOURCE LINES 14-15 No horizontal movement, here only investigating vertical mixing and swimming .. GENERATED FROM PYTHON SOURCE LINES 15-22 .. code-block:: Python r = ConstantReader( {'x_sea_water_velocity': 0, 'y_sea_water_velocity': 0, 'x_wind': 0, 'y_wind': 0, 'sea_water_temperature': 10, 'land_binary_mask': 0, 'ocean_vertical_diffusivity': .02}) o.add_reader(r) o.set_config('general:use_auto_landmask', False) .. GENERATED FROM PYTHON SOURCE LINES 23-24 Seeding 20 fish eggs, which will hatch as larvae after some time, depending om temperature .. GENERATED FROM PYTHON SOURCE LINES 24-29 .. code-block:: Python time = datetime(2020, 7, 1, 12) o.seed_elements(lon=4, lat=60, time=[time, time+timedelta(hours=24)], number=20) o.run(duration=timedelta(days=40)) .. raw:: html
<xarray.Dataset> Size: 2MB
    Dimensions:                                   (trajectory: 20, time: 961)
    Coordinates:
      * trajectory                                (trajectory) int64 160B 0 1 ... 19
      * time                                      (time) datetime64[ns] 8kB 2020-...
    Data variables: (12/31)
        status                                    (trajectory, time) float32 77kB ...
        moving                                    (trajectory, time) float32 77kB ...
        age_seconds                               (trajectory, time) float32 77kB ...
        origin_marker                             (trajectory, time) float32 77kB ...
        lon                                       (trajectory, time) float32 77kB ...
        lat                                       (trajectory, time) float32 77kB ...
        ...                                        ...
        ocean_vertical_diffusivity                (trajectory, time) float32 77kB ...
        ocean_mixed_layer_thickness               (trajectory, time) float32 77kB ...
        sea_water_temperature                     (trajectory, time) float32 77kB ...
        sea_water_salinity                        (trajectory, time) float32 77kB ...
        sea_surface_wave_stokes_drift_x_velocity  (trajectory, time) float32 77kB ...
        sea_surface_wave_stokes_drift_y_velocity  (trajectory, time) float32 77kB ...
    Attributes: (12/132)
        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 After 20 days eggs are hatched as Larvae, and starting to grow .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: Python o.plot_property('weight') o.plot_property('length') .. rst-class:: sphx-glr-horizontal * .. image-sg:: /gallery/images/sphx_glr_example_larvae_001.png :alt: weight :srcset: /gallery/images/sphx_glr_example_larvae_001.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/images/sphx_glr_example_larvae_002.png :alt: length :srcset: /gallery/images/sphx_glr_example_larvae_002.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 35-37 We see that larvae (after hatching) avoid the upper meters at daytime, to avoid predators. Vertical motion is a combination of vertical mixing, buoyancy and swimming. .. GENERATED FROM PYTHON SOURCE LINES 37-39 .. code-block:: Python o.plot_property('z') .. image-sg:: /gallery/images/sphx_glr_example_larvae_003.png :alt: z :srcset: /gallery/images/sphx_glr_example_larvae_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 40-41 Mean daily depth shows more clearly the diurnal migration of larvae .. GENERATED FROM PYTHON SOURCE LINES 41-42 .. code-block:: Python o.plot_property('z', mean=True) .. image-sg:: /gallery/images/sphx_glr_example_larvae_004.png :alt: z :srcset: /gallery/images/sphx_glr_example_larvae_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 43.904 seconds) .. _sphx_glr_download_gallery_example_larvae.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_larvae.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_larvae.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_larvae.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_