.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_fvcom.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_fvcom.py: FVCOM: Using model input from unstructured grid =============================================== .. GENERATED FROM PYTHON SOURCE LINES 6-46 .. code-block:: Python from datetime import timedelta import urllib.request as urllib_request import numpy as np from opendrift.readers import reader_netCDF_CF_unstructured 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: proj = "+proj=utm +zone=33 +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs" fvcom = reader_netCDF_CF_unstructured.Reader(filename = 'https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/AkvaplanNiva_sample_lonlat_fixed.nc', proj4 = proj) o.add_reader(fvcom) print(fvcom) except: print('Thredds server not available, cannot run example') fvcom = None if fvcom is not None: # Seed elements at defined positions, depth and time N = 1000 z = -10*np.random.uniform(0, 1, N) o.seed_elements(lon=18.0, lat=69.8, radius=2000, number=N, z=z, time=fvcom.start_time) #%% # Running model o.run(time_step=1800, duration=timedelta(hours=12)) #%% # Print and plot results print(o) #%% # Animation (current as background not yet working). o.animation(color='z') o.plot(fast=True, buffer = 1.) .. image-sg:: /gallery/images/sphx_glr_example_fvcom_001.png :alt: OpenDrift - OceanDrift 2018-04-30 01:01 to 2018-04-30 13:01 UTC (25 steps) :srcset: /gallery/images/sphx_glr_example_fvcom_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 11:06:42 INFO opendrift:569: OpenDriftSimulation initialised (version 1.14.4 / v1.14.4-13-g6c46a55) 11:06:42 INFO opendrift.readers.reader_netCDF_CF_unstructured:98: Opening dataset: https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/AkvaplanNiva_sample_lonlat_fixed.nc 11:06:42 INFO opendrift.readers.reader_netCDF_CF_unstructured:103: Opening file with Dataset 11:06:43 INFO opendrift.readers.reader_netCDF_CF_unstructured:107: Using custom projection: +proj=utm +zone=33 +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs.. 11:06:43 INFO opendrift.readers.reader_netCDF_CF_unstructured:117: Reading grid and coordinate variables.. =========================== Reader: https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/AkvaplanNiva_sample_lonlat_fixed.nc Projection: +proj=utm +zone=33 +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs Coverage: [degrees] xmin: 523286.781250 xmax: 724075.187500 ymin: 7685101.000000 ymax: 7873698.000000 Corners (lon, lat): ( 15.64, 70.97) ( 21.13, 70.87) ( 15.59, 69.27) ( 20.66, 69.18) Vertical levels [m]: Not specified Available time range: start: 2018-04-30 01:01:52 end: 2018-05-01 00:00:00 step: None Variables: sea_floor_depth_below_geoid sea_surface_height_above_geoid x_sea_water_velocity y_sea_water_velocity sea_water_temperature sea_water_salinity sea_water_speed - derived from ['x_sea_water_velocity', 'y_sea_water_velocity'] =========================== 0:00:02.0 open dataset 0:00:00.1 build index 11:06:44 INFO opendrift.models.basemodel.environment:203: Adding a global landmask from GSHHG 11:06:49 INFO opendrift.models.basemodel.environment:227: Fallback values will be used for the following variables which have no readers: 11:06:49 INFO opendrift.models.basemodel.environment:230: sea_surface_height: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: x_wind: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: y_wind: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: upward_sea_water_velocity: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: ocean_vertical_diffusivity: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_significant_height: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_x_velocity: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_y_velocity: 0.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: ocean_mixed_layer_thickness: 50.000000 11:06:49 INFO opendrift.models.basemodel.environment:230: sea_floor_depth_below_sea_level: 10000.000000 11:06:49 INFO opendrift:1787: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False] 11:06:49 INFO opendrift:1787: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False] 11:06:49 INFO opendrift:1798: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 11:06:49 INFO opendrift:1798: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 11:06:49 INFO opendrift:1806: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True] 11:06:49 INFO opendrift:945: Using existing reader for land_binary_mask to move elements to ocean 11:06:50 INFO opendrift:977: Moving 2 out of 1000 points from land to water 11:06:50 INFO opendrift:2094: 2018-04-30 01:01:52 - step 1 of 24 - 1000 active elements (0 deactivated) 11:06:50 INFO opendrift.readers.reader_netCDF_CF_unstructured:388: Reading siglay_centers into memory... 11:06:53 INFO opendrift.readers.reader_netCDF_CF_unstructured:392: Reading siglev_centers into memory... 11:06:56 INFO opendrift.readers.reader_netCDF_CF_unstructured:401: Reading ocean depth center into memory... 11:06:58 INFO opendrift:2094: 2018-04-30 01:31:52 - step 2 of 24 - 1000 active elements (0 deactivated) 11:07:01 INFO opendrift:2094: 2018-04-30 02:01:52 - step 3 of 24 - 998 active elements (2 deactivated) 11:07:02 INFO opendrift:2094: 2018-04-30 02:31:52 - step 4 of 24 - 998 active elements (2 deactivated) 11:07:04 INFO opendrift:2094: 2018-04-30 03:01:52 - step 5 of 24 - 998 active elements (2 deactivated) 11:07:13 INFO opendrift:2094: 2018-04-30 03:31:52 - step 6 of 24 - 998 active elements (2 deactivated) 11:07:19 INFO opendrift:2094: 2018-04-30 04:01:52 - step 7 of 24 - 998 active elements (2 deactivated) 11:07:22 INFO opendrift:2094: 2018-04-30 04:31:52 - step 8 of 24 - 997 active elements (3 deactivated) 11:07:26 INFO opendrift:2094: 2018-04-30 05:01:52 - step 9 of 24 - 997 active elements (3 deactivated) 11:07:27 INFO opendrift:2094: 2018-04-30 05:31:52 - step 10 of 24 - 997 active elements (3 deactivated) 11:07:29 INFO opendrift:2094: 2018-04-30 06:01:52 - step 11 of 24 - 997 active elements (3 deactivated) 11:07:31 INFO opendrift:2094: 2018-04-30 06:31:52 - step 12 of 24 - 997 active elements (3 deactivated) 11:07:34 INFO opendrift:2094: 2018-04-30 07:01:52 - step 13 of 24 - 997 active elements (3 deactivated) 11:07:37 INFO opendrift:2094: 2018-04-30 07:31:52 - step 14 of 24 - 997 active elements (3 deactivated) 11:07:40 INFO opendrift:2094: 2018-04-30 08:01:52 - step 15 of 24 - 997 active elements (3 deactivated) 11:07:42 INFO opendrift:2094: 2018-04-30 08:31:52 - step 16 of 24 - 997 active elements (3 deactivated) 11:07:45 INFO opendrift:2094: 2018-04-30 09:01:52 - step 17 of 24 - 997 active elements (3 deactivated) 11:07:48 INFO opendrift:2094: 2018-04-30 09:31:52 - step 18 of 24 - 993 active elements (7 deactivated) 11:07:52 INFO opendrift:2094: 2018-04-30 10:01:52 - step 19 of 24 - 991 active elements (9 deactivated) 11:07:56 INFO opendrift:2094: 2018-04-30 10:31:52 - step 20 of 24 - 989 active elements (11 deactivated) 11:08:03 INFO opendrift:2094: 2018-04-30 11:01:52 - step 21 of 24 - 988 active elements (12 deactivated) 11:08:21 INFO opendrift:2094: 2018-04-30 11:31:52 - step 22 of 24 - 988 active elements (12 deactivated) 11:08:33 INFO opendrift:2094: 2018-04-30 12:01:52 - step 23 of 24 - 988 active elements (12 deactivated) 11:08:36 INFO opendrift:2094: 2018-04-30 12:31:52 - step 24 of 24 - 988 active elements (12 deactivated) =========================== -------------------- Reader performance: -------------------- https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/AkvaplanNiva_sample_lonlat_fixed.nc 0:00:02.0 open dataset 0:00:00.1 build index 0:01:46.2 total 0:00:00.0 preparing 0:01:46.2 reading 0:00:00.0 rotating vectors 0:00:00.0 masking -------------------- global_landmask 0:00:01.5 total 0:00:00.0 preparing 0:00:01.5 reading 0:00:00.0 masking -------------------- Performance: 1:56.3 total time 6.3 configuration 1.5 preparing main loop 1.5 moving elements to ocean 1:48.4 main loop 0.0 updating elements 0.0 cleaning up -------------------- =========================== Model: OceanDrift (OpenDrift version 1.14.4) 983 active Lagrangian3DArray particles (17 deactivated, 0 scheduled) ------------------- Environment variables: ----- x_sea_water_velocity y_sea_water_velocity 1) https://thredds.met.no/thredds/dodsC/metusers/knutfd/thredds/netcdf_unstructured_samples/AkvaplanNiva_sample_lonlat_fixed.nc ----- land_binary_mask 1) global_landmask ----- Readers not added for the following variables: sea_floor_depth_below_sea_level 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: 2018-04-30 01:01:52 UTC Present: 2018-04-30 13:01:52 UTC Calculation steps: 24 * 0:30:00 - total time: 12:00:00 Output steps: 25 * 0:30:00 =========================== 11:08:49 INFO opendrift:4623: Saving animation to /root/project/docs/source/gallery/animations/example_fvcom_0.gif... 11:09:04 INFO opendrift:3064: Time to make animation: 0:00:24.929802 11:09:04 WARNING opendrift:2453: Plotting fast. This will make your plots less accurate. .. GENERATED FROM PYTHON SOURCE LINES 47-48 .. image:: /gallery/animations/example_fvcom_0.gif .. rst-class:: sphx-glr-timing **Total running time of the script:** (2 minutes 33.538 seconds) .. _sphx_glr_download_gallery_example_fvcom.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_fvcom.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_fvcom.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_fvcom.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_