Closed sirjoecabz closed 7 months ago
![Uploading Plastic_2023_Rainy.gif…]()
If you change loglevel to 0, the log will tell you what is wrong.
I believe the Hycom source you are using is only covering the last few days, and not your seed times.
Instead you should use
https://tds.hycom.org/thredds/dodsC/GLBy0.08/expt_93.0/uv3z
it works
I have no problem in my code but the plastic is not drifting in the results. Anyone please help me. I attached my code and some of the images.
from datetime import datetime, timedelta from opendrift.readers import reader_netCDF_CF_generic from opendrift.models.plastdrift import PlastDrift import cmocean import xarray as xr from opendrift.models.leeway import Leeway import os import numpy as np import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter import opendrift from opendrift.models.oceandrift import OceanDrift from opendrift.readers import reader_oscillating
o = PlastDrift(loglevel=20) o.list_configspec() # to see available configuration options
Arome atmospheric model
reader_arome = reader_netCDF_CF_generic.Reader('https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd')
Norkyst ocean model
reader_norkyst = reader_netCDF_CF_generic.Reader('https://tds.hycom.org/thredds/dodsC/GLBy0.08/latest')
o.add_reader([reader_norkyst, reader_arome])
Try different options: 'previous', 'stranding', 'none'
o.set_config('general:coastline_action', 'previous')
Seed some particles
LAOAG
o.seed_elements(lon=120.7678819, lat=18.5461263, radius=1000, number=500, time=datetime(2023, 1, 1,12))
ABRA
o.seed_elements(lon=120.4221706, lat=17.4949406, radius=1000, number=500, time=datetime(2023, 2, 1,12))
bueD
o.seed_elements(lon=120.3275912, lat=16.0767306, radius=1000, number=500, time=datetime(2023, 3, 1,12))
pasig
o.seed_elements(lon=120.9477045, lat=14.5918907, radius=1000, number=500, time=datetime(2023, 4, 1,12))
UMIRAY 1
o.seed_elements(lon=121.4221901, lat=15.2204139, radius=1000, number=500, time=datetime(2023, 5, 1,12))
MAYGNGAWAY
o.seed_elements(lon=124.0571810, lat=13.6859078, radius=1000, number=500, time=datetime(2023, 1, 1,12))
AKLAN
o.seed_elements(lon=122.3656083, lat=12.7330507, radius=1000, number=500, time=datetime(2023, 6, 1,12))
MINDORO
o.seed_elements(lon=120.7834560, lat=11.7408336, radius=1000, number=500, time=datetime(2023, 2, 1,12))
ILOILO
o.seed_elements(lon=122.5860438, lat=10.6922134, radius=1000, number=500, time=datetime(2023, 4, 1,12))
ULOT
o.seed_elements(lon=125.4329273, lat=11.9003105, radius=1000, number=500, time=datetime(2023, 10, 1,12))
BUTUANO
o.seed_elements(lon=123.9267137, lat=10.3101152, radius=1000, number=500, time=datetime(2023, 11, 1,12))
BANAHAW
o.seed_elements(lon=125.4623576, lat=9.8028744, radius=1000, number=500, time=datetime(2023,8, 1,12))
CAGAYAN
o.seed_elements(lon=124.6613198, lat=8.5118660, radius=1000, number=500, time=datetime(2023, 5, 1,12))
TAMONTAKA
o.seed_elements(lon=124.1565025, lat=7.1961077, radius=1000, number=500,
time=datetime(2023, 6, 1,12))
MALUNGON
o.seed_elements(lon=125.1668077, lat=6.1036941, radius=1000, number=500, time=datetime(2023, 7, 1,12))
DON ENRIGUE
o.seed_elements(lon=126.3109089, lat=6.9597442, radius=1000, number=500,
time=datetime(2023, 6, 1,12))
DAVAO
o.seed_elements(lon=125.6103510, lat=7.0426378, radius=1000, number=500, time=datetime(2023, 9, 1,12))
CATEEL
o.seed_elements(lon=126.4579419, lat=7.7953458, radius=1000, number=500, time=datetime(2023, 3, 1,12))
BANAHAW
o.seed_elements(lon=125.4623576, lat=9.8028744, radius=1000, number=500,
time=datetime(2023, 6, 1,12))
Running model
o.run(time_step=timedelta(minutes=15), time_step_output=timedelta(hours=3), end_time=datetime(2023, 12, 30, 12), outfile='Plastic_2023_1YEAR.nc')
%%
Print and plot results
print(o) o.plot(linecolor='z', buffer=.1, show_elements=False, fast=False) o.animation(fast=True,color='z', buffer=.1, ocean_color='skyblue', filename='Plastic_2023_IYEAR.gif') o.animation(skip=5, # show every 5th vector cmap=cmocean.cm.speed, vmin=0, vmax=.8, bgalpha=.7, land_color='#666666', fast=True,filename='Philippine2023_IYR.mp4')
d, dsub, dstr, lon, lat = o.get_density_array(pixelsize_m=3000) strand_density = xr.DataArray(dstr[-1,:,:], coords={'lon_bin': lon[0:-1], 'lat_bin': lat[0:-1]}) o.plot(fast=True, background=strand_density.where(strand_density>0), vmin=0, vmax=20, clabel='Density of stranded elements', show_elements=False, linewidth=0)