diff --git a/src/parcels/_core/fieldset.py b/src/parcels/_core/fieldset.py index 4844ff210..98700edd9 100644 --- a/src/parcels/_core/fieldset.py +++ b/src/parcels/_core/fieldset.py @@ -354,10 +354,10 @@ def _format_calendar_error_message(field: Field | VectorField, reference_datetim _COPERNICUS_MARINE_AXIS_VARNAMES = { - "X": "lon", - "Y": "lat", - "Z": "depth", "T": "time", + "Z": "depth", + "Y": "lat", + "X": "lon", } diff --git a/src/parcels/_core/particle.py b/src/parcels/_core/particle.py index cb2a441cf..322d313bb 100644 --- a/src/parcels/_core/particle.py +++ b/src/parcels/_core/particle.py @@ -127,9 +127,18 @@ def get_default_particle(spatial_dtype: type[np.float32] | type[np.float64]) -> return ParticleClass( variables=[ Variable( - "lon", + "time", + dtype=np.float64, + attrs={ + "standard_name": "time", + "units": "seconds", + "axis": "T", + }, # "units" and "calendar" gets updated/set if working with cftime time domain + ), + Variable( + "z", dtype=spatial_dtype, - attrs={"standard_name": "longitude", "units": "degrees_east", "axis": "X"}, + attrs={"standard_name": "vertical coordinate", "units": "m", "positive": "down"}, ), Variable( "lat", @@ -137,22 +146,13 @@ def get_default_particle(spatial_dtype: type[np.float32] | type[np.float64]) -> attrs={"standard_name": "latitude", "units": "degrees_north", "axis": "Y"}, ), Variable( - "z", + "lon", dtype=spatial_dtype, - attrs={"standard_name": "vertical coordinate", "units": "m", "positive": "down"}, + attrs={"standard_name": "longitude", "units": "degrees_east", "axis": "X"}, ), - Variable("dlon", dtype=spatial_dtype, to_write=False), - Variable("dlat", dtype=spatial_dtype, to_write=False), Variable("dz", dtype=spatial_dtype, to_write=False), - Variable( - "time", - dtype=np.float64, - attrs={ - "standard_name": "time", - "units": "seconds", - "axis": "T", - }, # "units" and "calendar" gets updated/set if working with cftime time domain - ), + Variable("dlat", dtype=spatial_dtype, to_write=False), + Variable("dlon", dtype=spatial_dtype, to_write=False), Variable( "particle_id", dtype=np.int64, diff --git a/src/parcels/_core/particleset.py b/src/parcels/_core/particleset.py index 947c3b62d..96501b0c9 100644 --- a/src/parcels/_core/particleset.py +++ b/src/parcels/_core/particleset.py @@ -59,10 +59,10 @@ def __init__( self, fieldset, pclass=Particle, - lon=None, - lat=None, - z=None, time=None, + z=None, + lat=None, + lon=None, particle_ids=None, **kwargs, ): @@ -70,9 +70,9 @@ def __init__( self._kernel = None self.fieldset = fieldset - lon = np.empty(shape=0) if lon is None else np.array(lon).flatten() - lat = np.empty(shape=0) if lat is None else np.array(lat).flatten() time = np.empty(shape=0) if time is None else np.array(time).flatten() + lat = np.empty(shape=0) if lat is None else np.array(lat).flatten() + lon = np.empty(shape=0) if lon is None else np.array(lon).flatten() if particle_ids is None: particle_ids = np.arange(lon.size) @@ -112,10 +112,10 @@ def __init__( nparticles=lon.size, ngrids=len(fieldset.gridset), initial=dict( - lon=lon, - lat=lat, - z=z, time=time, + z=z, + lat=lat, + lon=lon, particle_id=particle_ids, ), )