.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_schism_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_schism_native.py: SCHISM native reader ================================== .. GENERATED FROM PYTHON SOURCE LINES 6-53 .. image-sg:: /gallery/images/sphx_glr_example_schism_native_001.png :alt: OpenDrift - OceanDrift 2008-01-01 00:30 to 2008-01-01 03:00 UTC (11 steps) :srcset: /gallery/images/sphx_glr_example_schism_native_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 13:52:50 INFO opendrift:576: OpenDriftSimulation initialised (version 1.14.7 / v1.14.7-15-g2988cd4) 13:52:50 INFO opendrift.readers.reader_schism_native:109: Opening dataset: https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/schism_marl20080101_00z_3D.nc 13:52:50 INFO opendrift.readers.reader_schism_native:115: Opening file with dataset 13:52:52 INFO opendrift.models.basemodel.environment:203: Adding a global landmask from GSHHG 13:52:56 INFO opendrift.models.basemodel.environment:227: Fallback values will be used for the following variables which have no readers: 13:52:56 INFO opendrift.models.basemodel.environment:230: x_wind: 0.000000 13:52:56 INFO opendrift.models.basemodel.environment:230: y_wind: 0.000000 13:52:56 INFO opendrift.models.basemodel.environment:230: ocean_vertical_diffusivity: 0.000000 13:52:56 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_significant_height: 0.000000 13:52:56 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_x_velocity: 0.000000 13:52:56 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_y_velocity: 0.000000 13:52:56 INFO opendrift.models.basemodel.environment:230: ocean_mixed_layer_thickness: 50.000000 13:52:56 INFO opendrift:1803: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False] 13:52:56 INFO opendrift:1803: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False] 13:52:56 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:52:56 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:52:56 INFO opendrift:1822: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True] 13:52:56 WARNING opendrift:1902: Simulation end is not at an output time step. Extending duration from 2:24:00 to 2:30:00 13:52:56 INFO opendrift:952: Using existing reader for land_binary_mask to move elements to ocean 13:52:56 INFO opendrift:982: All points are in ocean 13:52:56 INFO opendrift:2111: 2008-01-01 00:30:00 - step 1 of 10 - 300 active elements (0 deactivated) 13:52:56 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:08 INFO opendrift:2111: 2008-01-01 00:45:00 - step 2 of 10 - 300 active elements (0 deactivated) 13:53:08 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:20 INFO opendrift:2111: 2008-01-01 01:00:00 - step 3 of 10 - 300 active elements (0 deactivated) 13:53:20 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:20 INFO opendrift:2111: 2008-01-01 01:15:00 - step 4 of 10 - 300 active elements (0 deactivated) 13:53:20 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:32 INFO opendrift:2111: 2008-01-01 01:30:00 - step 5 of 10 - 300 active elements (0 deactivated) 13:53:32 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:32 INFO opendrift:2111: 2008-01-01 01:45:00 - step 6 of 10 - 300 active elements (0 deactivated) 13:53:32 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:46 INFO opendrift:2111: 2008-01-01 02:00:00 - step 7 of 10 - 300 active elements (0 deactivated) 13:53:46 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:46 INFO opendrift:2111: 2008-01-01 02:15:00 - step 8 of 10 - 300 active elements (0 deactivated) 13:53:46 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:59 INFO opendrift:2111: 2008-01-01 02:30:00 - step 9 of 10 - 300 active elements (0 deactivated) 13:53:59 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked 13:53:59 INFO opendrift:2111: 2008-01-01 02:45:00 - step 10 of 10 - 300 active elements (0 deactivated) 13:53:59 WARNING opendrift.readers.basereader.unstructured:141: z-coordinates are not bounds-checked =========================== -------------------- Reader performance: -------------------- https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/schism_marl20080101_00z_3D.nc 0:01:15.7 total 0:00:15.7 preparing 0:01:15.7 reading 0:00:00.3 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: 1:22.0 total time 6.1 configuration 0.0 preparing main loop 0.0 moving elements to ocean 1:15.9 main loop 0.0 updating elements 0.0 cleaning up -------------------- =========================== Model: OceanDrift (OpenDrift version 1.14.7) 300 active Lagrangian3DArray particles (0 deactivated, 0 scheduled) ------------------- Environment variables: ----- sea_floor_depth_below_sea_level sea_surface_height upward_sea_water_velocity x_sea_water_velocity y_sea_water_velocity 1) https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/schism_marl20080101_00z_3D.nc ----- 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 x_wind y_wind Discarded readers: Time: Start: 2008-01-01 00:30:00 UTC Present: 2008-01-01 03:00:00 UTC Calculation steps: 10 * 0:15:00 - total time: 2:30:00 Output steps: 11 * 0:15:00 =========================== 13:54:12 WARNING opendrift:2473: Plotting fast. This will make your plots less accurate. 13:54:21 INFO opendrift:4660: Saving animation to /root/project/docs/source/gallery/animations/example_schism_native_0.gif... 13:54:27 INFO opendrift:3094: Time to make animation: 0:00:14.362176 13:54:27 INFO opendrift:4660: Saving animation to /root/project/docs/source/gallery/animations/example_schism_native_1.gif... 13:54:29 INFO opendrift:3310: Time to make animation: 0:00:01.678312 | .. code-block:: Python import numpy as np from datetime import timedelta, datetime from opendrift.readers import reader_schism_native from opendrift.readers import reader_global_landmask from opendrift.models.oceandrift import OceanDrift o = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information try: # NZTM proj4 string found at https://spatialreference.org/ref/epsg/nzgd2000-new-zealand-transverse-mercator-2000/ proj4str_nztm = '+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs' schism_native = reader_schism_native.Reader( filename = 'https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/schism_marl20080101_00z_3D.nc', proj4 = proj4str_nztm, use_3d = True) except: print('Thredds server not available, cannot run example') schism_native = None if schism_native is not None: o.add_reader([schism_native]) # Seed elements at defined positions, depth and time o.seed_elements(lon=174.046669, lat=-40.928116, radius=20, number=100, z=np.linspace(0,-10, 100), time=schism_native.start_time) o.seed_elements(lon= 173.8839, lat=-40.9160, radius=20, number=100, z=np.linspace(0,-10, 100), time=schism_native.start_time) o.seed_elements(lon=174.2940, lat=-41.0888, radius=20, number=100, z=np.linspace(0,-10, 100), time=schism_native.start_time) #%% # Running model o.run(time_step=900, end_time = schism_native.start_time+timedelta(days=0.1)) # outfile='schism_native_output.nc') # Print and plot results print(o) o.plot(fast=True) o.animation() o.animation_profile() .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 45.191 seconds) .. _sphx_glr_download_gallery_example_schism_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_schism_native.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_schism_native.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_schism_native.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_