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

Get the centre of the track #1082

Closed Dovelet1 closed 1 year ago

Dovelet1 commented 1 year ago

Dear all,

Is there some way to get a central drift track as shown below when using the Leeway model?

image

Thanks!

knutfrode commented 1 year ago

Hi,

Yes, there is a method center_of_gravity which will provide the center positions as well as the spatial variance: https://opendrift.github.io/_modules/opendrift/models/basemodel.html#OpenDriftSimulation.center_of_gravity

Note that we have recently created a new package TrajAn for the analysis of output from OpenDrift, as well as any other model or measurements that follow the netCDF convention on trajectories. With TrajAn, you can do this more easily and transparently using Xarray syntax: https://opendrift.github.io/trajan/gallery/example_opendrift.html#sphx-glr-gallery-example-opendrift-py

TrajAn does not have very much funtionality yet, but may still be worth testing out.

Dovelet1 commented 1 year ago

Thanks for the fast reply.As you suggested, I have solved the problem using the method center_of_gravity. Next I will use TrajAnd to analyse my results. Thanks again for your help! image