Rename particle position attributes from "lon" and "lat" to "x" and "y"#2719
Conversation
|
Also note that I haven't updated the docs as these are currently broken due to the last refactoring. We should fix them in a separate PR. |
erikvansebille
left a comment
There was a problem hiding this comment.
Code changes look good; see below a few minor comments
Two more important ones
- Should we also change
particles.timetoparticles.t, for symmetry with the other one-letter attributes? - Would it be helpful to users to provide some informative error message if they create a ParticleSet or Kernel with
lon, informing them that this has changed in v4? Or do we expect them to just read the migration guide? I guess that this will be one of the most impactful changes for users wanting to port over their code (along with the vectorization of the particleset).
| - Users need to explicitly use `convert_z_to_sigma_croco` in sampling kernels (such as the `AdvectionRK4_3D_CROCO` or `SampleOMegaCroco` kernels) when working with CROCO data, as the automatic conversion from depth to sigma grids under the hood has been removed. | ||
| - We added a new AdvectionRK2 Kernel. The AdvectionRK4 kernel is still available, but RK2 is now the recommended default advection scheme as it is faster while the accuracy is comparable for most applications. See also the Choosing an integration method tutorial. | ||
| - Functions shouldn't be converted to Kernels before adding to a pset.execute() call. Instead, simply pass the function(s) as a list to pset.execute(). | ||
| - Kernel variables `lon` and `lat` have been renamed to `x` and `y`, and `dlon` and `dlat` have been renamed to `dx` and `dy`. These changes are also reflected on the ParticleSet as well as the particlefile output. |
There was a problem hiding this comment.
Should we also update time to t?
Because a user would now sample by fieldset.field[particles.time, particles.z, particles.y, particles.x]. This could be more 'symmetric' with
fieldset.field[particles.t, particles.z, particles.y, particles.x]
That's a good idea. Added to #2109 |
OK, let's do that. Tracking in a separate issue to be done in another PR. |
Update particle definition and all related code - particle.py particle variables - ParticleSet args - all internal mentions of .lon and .lat - test suite code
Co-authored-by: Erik van Sebille <e.vansebille@uu.nl>
62bdac2 to
98422b4
Compare
|
@erikvansebille merged now! |
Description
Kernel variables
lonandlathave been renamed toxandy, anddlonanddlathave been renamed todxanddy. These changes are also reflected on the ParticleSet as well as the particlefile output.Changes:
This now means that users will need to use
xandywhen refering to particle positions. This includes in kernels, when defining the particlesets themselves, and when working with output after the face.Note that I haven't gone about updating local variable names in tests. I don't think it provides any benefit to do so (and for those tests using "lon" might be more informative than using "x" as it hints at the mesh type used).
Checklist
mainfor normal development,v3-supportfor v3 support)AI Disclosure
None used.