opendrift icon indicating copy to clipboard operation
opendrift copied to clipboard

Computation of total oil mass

Open knutfrode opened this issue 3 years ago • 1 comments

Discussed in https://github.com/OpenDrift/opendrift/discussions/839

Originally posted by FrancoisDuquesne January 21, 2022 Hello,

I was able to release on multiple times and locations using vectors as input. However, I have an issue with the computation of the total oil mass when using a list as time release.

Digging into your code I found that the total duration is computed in openoil.py l1562 as (time[1] - time[0]). This does not work if you give more than two dates in the release time list. Is this an expected behavior? Should the list only count two dates? If not then the l1562 should read (time[-1] - time[0])

Kind regards.

knutfrode avatar Jan 21 '22 12:01 knutfrode

Hi,

It is not well documented, but time must be either a single time, or a two-element list [start_time, end_time] For your case of multiple points, seeding has to be done in a loop:

for lon,lat,time in zip(lons, lats, times):
    o.seed_elements(lon=lon, lat=lat, time=time, <additional arguments such as number and m3_per_hour>)

knutfrode avatar Jan 21 '22 12:01 knutfrode