Skip to content

Commit 8bcab35

Browse files
author
ci-build
committed
[skip ci] Updates
1 parent 3816a2f commit 8bcab35

File tree

431 files changed

+479084
-488210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

431 files changed

+479084
-488210
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

_downloads/849b51a02e8ee7bce2932982bb58260e/example_wind_drift_coefficient_from_trajectory.ipynb

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"from datetime import datetime, timedelta\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport cmocean\nfrom opendrift.models.oceandrift import OceanDrift\nfrom opendrift.models.physics_methods import wind_drift_factor_from_trajectory, distance_between_trajectories, skillscore_liu_weissberg"
18+
"import trajan as _\nfrom datetime import datetime, timedelta\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport cmocean\nfrom opendrift.models.oceandrift import OceanDrift\nfrom opendrift.models.physics_methods import wind_drift_factor_from_trajectory, distance_between_trajectories, skillscore_liu_weissberg"
1919
]
2020
},
2121
{
@@ -105,7 +105,7 @@
105105
},
106106
"outputs": [],
107107
"source": [
108-
"drifter_lons = ot.result.lon.squeeze()\ndrifter_lats = ot.result.lat.squeeze()\ndrifter_times = pd.to_datetime(ot.result.time).to_pydatetime()\ndrifter={'lon': drifter_lons, 'lat': drifter_lats,\n 'time': drifter_times, 'linewidth': 2, 'color': 'b', 'label': 'Synthetic drifter'}\n\no = OceanDrift(loglevel=50)\no.add_readers_from_list([o.test_data_folder() +\n '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc',\n o.test_data_folder() + '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc'], lazy=False)\nt = o.env.get_variables_along_trajectory(variables=['x_sea_water_velocity', 'y_sea_water_velocity', 'x_wind', 'y_wind'],\n lons=drifter_lons, lats=drifter_lats, times=drifter_times)\n\nwind_drift_factor, azimuth = wind_drift_factor_from_trajectory(t)\n\no.seed_elements(lon=4, lat=60, number=1, time=ot.env.readers[list(ot.env.readers)[0]].start_time,\n wind_drift_factor=0.033)"
108+
"drifter_lons = ot.result.lon.squeeze()\ndrifter_lats = ot.result.lat.squeeze()\ndrifter_times = pd.to_datetime(ot.result.time).to_pydatetime()\ndrifter={'lon': drifter_lons, 'lat': drifter_lats,\n 'time': drifter_times, 'linewidth': 2, 'color': 'b', 'label': 'Synthetic drifter'}\n\no = OceanDrift(loglevel=50)\no.add_readers_from_list([o.test_data_folder() +\n '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc',\n o.test_data_folder() + '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc'], lazy=False)\nt = o.env.get_variables_along_trajectory(variables=['x_sea_water_velocity', 'y_sea_water_velocity', 'x_wind', 'y_wind'],\n lons=drifter_lons, lats=drifter_lats, times=drifter_times)\n\nwind_drift_factor, azimuth = wind_drift_factor_from_trajectory(t)\n\no.seed_elements(lon=4, lat=60, number=1, time=ot.start_time,\n wind_drift_factor=0.033)"
109109
]
110110
},
111111
{
@@ -195,7 +195,25 @@
195195
},
196196
"outputs": [],
197197
"source": [
198-
"wdf = np.linspace(0.0, 0.05, 100)\no.seed_elements(lon=4, lat=60, time=ot.env.readers[list(ot.env.readers)[0]].start_time,\n wind_drift_factor=wdf, number=len(wdf))\no.run(duration=timedelta(hours=12), time_step=600)\no.plot(linecolor='wind_drift_factor', drifter=drifter)"
198+
"wdf = np.linspace(0.0, 0.05, 100)\no.seed_elements(lon=4, lat=60, time=ot.start_time,\n wind_drift_factor=wdf, number=len(wdf))\no.run(duration=timedelta(hours=12), time_step=600)\no.plot(linecolor='wind_drift_factor', drifter=drifter)"
199+
]
200+
},
201+
{
202+
"cell_type": "markdown",
203+
"metadata": {},
204+
"source": [
205+
"Using TrajAn to calculate skillscore\n\n"
206+
]
207+
},
208+
{
209+
"cell_type": "code",
210+
"execution_count": null,
211+
"metadata": {
212+
"collapsed": false
213+
},
214+
"outputs": [],
215+
"source": [
216+
"skillscore = o.result.traj.skill(ot.result, tolerance_threshold=1)"
199217
]
200218
},
201219
{
@@ -213,7 +231,7 @@
213231
},
214232
"outputs": [],
215233
"source": [
216-
"skillscore = o.skillscore_trajectory(drifter_lons, drifter_lats, drifter_times, tolerance_threshold=1)\nind = np.argmax(skillscore)\nplt.plot(wdf, skillscore)\nplt.xlabel('Wind drift factor [fraction]')\nplt.ylabel('Liu-Weissberg skillscore')\nplt.title('Maximum skillscore %.3f for wdf=%.3f' % (skillscore[ind], wdf[ind]))\nplt.show()"
234+
"ind = skillscore.argmax()\nplt.plot(wdf, skillscore)\nplt.xlabel('Wind drift factor [fraction]')\nplt.ylabel('Liu-Weissberg skillscore')\nplt.title('Maximum skillscore %.3f for wdf=%.3f' % (skillscore[ind], wdf[ind]))\nplt.show()"
217235
]
218236
},
219237
{
Binary file not shown.
Binary file not shown.

_downloads/88e407aefe00a8e42f7b6bc12d926652/example_wind_drift_coefficient_from_trajectory.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
===========================================
55
"""
66

7+
import trajan as _
78
from datetime import datetime, timedelta
89
import pandas as pd
910
import numpy as np
@@ -55,7 +56,7 @@
5556

5657
wind_drift_factor, azimuth = wind_drift_factor_from_trajectory(t)
5758

58-
o.seed_elements(lon=4, lat=60, number=1, time=ot.env.readers[list(ot.env.readers)[0]].start_time,
59+
o.seed_elements(lon=4, lat=60, number=1, time=ot.start_time,
5960
wind_drift_factor=0.033)
6061

6162
#%%
@@ -114,15 +115,18 @@
114115
#%%
115116
# Calulating trajectories for 100 different wind_drift_factors between 0 and 0.05
116117
wdf = np.linspace(0.0, 0.05, 100)
117-
o.seed_elements(lon=4, lat=60, time=ot.env.readers[list(ot.env.readers)[0]].start_time,
118+
o.seed_elements(lon=4, lat=60, time=ot.start_time,
118119
wind_drift_factor=wdf, number=len(wdf))
119120
o.run(duration=timedelta(hours=12), time_step=600)
120121
o.plot(linecolor='wind_drift_factor', drifter=drifter)
121122

123+
#%%
124+
# Using TrajAn to calculate skillscore
125+
skillscore = o.result.traj.skill(ot.result, tolerance_threshold=1)
126+
122127
#%%
123128
# Plotting and finding the wind_drift_factor which maximises the skillscore
124-
skillscore = o.skillscore_trajectory(drifter_lons, drifter_lats, drifter_times, tolerance_threshold=1)
125-
ind = np.argmax(skillscore)
129+
ind = skillscore.argmax()
126130
plt.plot(wdf, skillscore)
127131
plt.xlabel('Wind drift factor [fraction]')
128132
plt.ylabel('Liu-Weissberg skillscore')
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

_images/example_2d_0.gif

6.69 KB

_images/example_biodegradation_0.gif

44.1 KB

_images/example_chemicaldrift_0.gif

132 KB

_images/example_chemicaldrift_1.gif

-209 KB
1.6 KB
-38.6 KB
38.3 KB
-219 KB

_images/example_codegg_0.gif

4.92 KB

_images/example_codegg_1.gif

52.1 KB

_images/example_cone_0.gif

-60.7 KB

_images/example_depth_0.gif

194 KB

_images/example_dominating_0.gif

120 KB

_images/example_ensemble_0.gif

-199 KB
266 Bytes
14.8 KB

_images/example_fvcom_0.gif

-770 KB

_images/example_huge_output_0.gif

-31.5 KB

_images/example_huge_output_1.gif

-218 KB
225 KB
-23.1 KB
14.2 KB
-4.8 KB

_images/example_oil_ice_0.gif

145 KB

_images/example_oil_thickness_0.gif

95.2 KB

_images/example_oil_thickness_1.gif

-92.5 KB
106 KB
38.8 KB

_images/example_plot_0.gif

193 KB

_images/example_river_runoff_0.gif

-11.8 KB

_images/example_sediments_0.gif

-1.52 MB
259 KB
479 Bytes

_images/example_shipdrift_0.gif

34.3 KB
11.9 KB
-245 Bytes

_images/sphx_glr_example_2d_001.png

40 Bytes

_images/sphx_glr_example_2d_thumb.png

-66 Bytes
577 Bytes
29 Bytes
-18 Bytes
221 Bytes
28.8 KB
2.25 KB

_images/sphx_glr_example_cone_001.png

-7.23 KB
-2.85 KB
14.8 KB
2.96 KB
-15 KB
-7.41 KB
-3.22 KB
75 Bytes
708 Bytes
-57 Bytes
1.89 KB
2.39 KB
217 Bytes
-35 Bytes
66 Bytes
850 Bytes
3.65 KB
585 Bytes
272 Bytes
-634 Bytes
391 Bytes
-625 Bytes
-128 KB
-36 KB
3.31 KB
522 Bytes
-161 Bytes

0 commit comments

Comments
 (0)