MaceKuailv / seaduck

A python package that interpolates data from ocean dataset from both Eulerian and Lagrangian perspective.
Apache License 2.0
15 stars 6 forks source link

Output times are uneven #6

Closed ThomasHaine closed 1 year ago

ThomasHaine commented 1 year ago

How are the output times for Lagrangian particles selected. stops are unevenly spaced in:

stops,[S,lats,lons,heights] = oi.OceInterp(od._ds,
                                 ['SALT','__particle.lat','__particle.lon','__particle.dep'],
                                 x,y,z,t,
                                 lagrangian = True
                                    )

although t are evenly spaced. How does the user get output at times t? What are the stops times?

MaceKuailv commented 1 year ago

This is because the time you set for output does not match that of the output steps (timestep's end). The particle needs to stop at those times anyway, so by default, the return will include those steps. You can set return_in_between = False to make those steps go away.

ThomasHaine commented 1 year ago

This doesn't seem to be working right: image

MaceKuailv commented 1 year ago

This is as expected. There are two steps in this process. The first step is to make the trajectory, which is what you are seeing now. It just have to stop at the update steps or else it would be wrong. The second step is to select the returns and do the interpolation for other variables, that's where we throughout the update steps. You can take a look at the stops returned after this is done. It should be the same as the input t. Otherwise, there might be a bug some where

ThomasHaine commented 1 year ago

OK, but np.size(lons,0) = np.size(t,0) - 1, which is confusing. I expect there to be a particle position corresponding to every element of t.

MaceKuailv commented 1 year ago

This is more of a issue with documentation than anything else.