Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/parcels/_core/fieldset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}


Expand Down
30 changes: 15 additions & 15 deletions src/parcels/_core/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,32 +127,32 @@ 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",
dtype=spatial_dtype,
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,
Expand Down
16 changes: 8 additions & 8 deletions src/parcels/_core/particleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ def __init__(
self,
fieldset,
pclass=Particle,
lon=None,
lat=None,
z=None,
time=None,
z=None,
lat=None,
lon=None,
particle_ids=None,
**kwargs,
):
self._data = None
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()
Comment thread
erikvansebille marked this conversation as resolved.

if particle_ids is None:
particle_ids = np.arange(lon.size)
Expand Down Expand Up @@ -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,
),
)
Expand Down
Loading