OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
249 stars 120 forks source link

Oil Spill Drifts #481

Closed lhuasheng closed 3 years ago

lhuasheng commented 3 years ago

Thank you so much for the awesome work! This is a really cool library. I have tried opendrift and wanted to simulate the movement of oil spills. However, I encountered this error message 'ValueError: Simulation stopped within first timestep. "Missing variables: ['x_sea_water_velocity', 'y_sea_water_velocity', 'x_wind', 'y_wind', 'sea_surface_wave_significant_height']", 'The simulation stopped before requested end time was reached.')

How should I add the correct data into the readers to resolve this problem? Thank you!!!

`from datetime import datetime, timedelta

from opendrift.models.oceandrift import OceanDrift

from opendrift.models.openoil import OpenOil

o = OpenOil() o.add_readers_from_list([

'https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc',

'https://thredds.met.no/thredds/catalog/meps25epsarchive/2020/11/15/catalog.html?dataset=meps25epsarchive/2020/11/15/meps_lagged_6_h_vc_2_5km_20201115T18Z.nc',
'https://thredds.met.no/thredds/catalog/meps25epsarchive/2020/11/16/catalog.html?dataset=meps25epsarchive/2020/11/16/meps_lagged_6_h_vc_2_5km_20201115T18Z.nc',
'https://oceanwatch.pifsc.noaa.gov/thredds/dodsC/ccmp/v2_0/NRT'
])

o.disable_vertical_motion()

o.seed_elements(lon=103.7, lat=1.189, time=datetime(2020,11,15,22,48), number=1000, radius=1000)

o.run(duration=timedelta(hours=24)) o.animation(filename='animationOil.mp4')`

knutfrode commented 3 years ago

Hi,

The first thredds-sources in your list only cover the North Atlantic. The last (OceanWatch) is global, but only covers time period 1 Jan 2019 to 4 Oct 2020. Thus you need to add some data sources containing wind and currents and covering your actual time and location.

In the following list, the sources at the bottom are global, and might be useful: https://github.com/OpenDrift/opendrift/blob/master/opendrift/scripts/data_sources.txt For the very last line/source (global currents), you will need an account at marine.copernicus.eu, and add this to a local .netrc file:

machine cmems
    login <your username>
    password <your password>
knutfrode commented 3 years ago

Closing this issue. Please re-open if still relevant.