Particlefile#

parcels.particlefile module#

Module controlling the writing of ParticleSets to Zarr file.

class parcels.particlefile.ParticleFile(name, particleset, outputdt, chunks=None, create_new_zarrfile=True)[source]#

Bases: object

Initialise trajectory output.

Parameters:
  • name (str) – Basename of the output file. This can also be a Zarr store object.

  • particleset – ParticleSet to output

  • outputdt – Interval which dictates the update frequency of file output while ParticleFile is given as an argument of ParticleSet.execute() It is either a timedelta object or a positive double.

  • chunks – Tuple (trajs, obs) to control the size of chunks in the zarr output.

  • create_new_zarrfile (bool) – Whether to create a new file. Default is True

Returns:

ParticleFile object that can be used to write particle data to file

Return type:

ParticleFile

Attributes:
analytical

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at OceanParcels/Parcels#1695.

chunks
create_new_zarrfile
fill_value_map

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at OceanParcels/Parcels#1695.

fname
maxids

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at OceanParcels/Parcels#1695.

mpi_rank

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at OceanParcels/Parcels#1695.

outputdt
parcels_mesh

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at OceanParcels/Parcels#1695.

particleset
pids_written

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at OceanParcels/Parcels#1695.

time_origin
vars_to_write

Methods

add_metadata(name, message)

Add metadata to parcels.particleset.ParticleSet.

write(pset, time[, indices])

Write all data from one time step to the zarr file, before the particle locations are updated.

write_latest_locations(pset, time)

Write the current (latest) particle locations to zarr file.

write_once(*args, **kwargs)

add_metadata(name, message)[source]#

Add metadata to parcels.particleset.ParticleSet.

Parameters:
  • name (str) – Name of the metadata variable

  • message (str) – message to be written

Deprecated since version ParticleFile.metadata: is a dictionary. Use ParticleFile.metadata[‘key’] = … or other dictionary methods instead.

property analytical[source]#

//github.com/OceanParcels/Parcels/issues/1695.

Type:

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at https

property fill_value_map[source]#

//github.com/OceanParcels/Parcels/issues/1695.

Type:

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at https

property maxids[source]#

//github.com/OceanParcels/Parcels/issues/1695.

Type:

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at https

property mpi_rank[source]#

//github.com/OceanParcels/Parcels/issues/1695.

Type:

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at https

property parcels_mesh[source]#

//github.com/OceanParcels/Parcels/issues/1695.

Type:

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at https

property pids_written[source]#

//github.com/OceanParcels/Parcels/issues/1695.

Type:

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at https

write(pset, time: float | timedelta | timedelta64 | None, indices=None)[source]#

Write all data from one time step to the zarr file, before the particle locations are updated.

Parameters:
  • pset – ParticleSet object to write

  • time – Time at which to write ParticleSet

write_latest_locations(pset, time)[source]#

Write the current (latest) particle locations to zarr file. This can be useful at the end of a pset.execute(), when the last locations are not written yet. Note that this only updates the locations, not any of the other Variables. Therefore, use with care.

Parameters:
  • pset – ParticleSet object to write

  • time – Time at which to write ParticleSet. Note that typically this would be pset.time_nextloop

write_once(*args, **kwargs)[source]#

Deprecated since version It: has moved to the internal API as it is not expected to be directly used by the end-user. If you feel that you use this code directly in your scripts, please comment on our tracking issue at OceanParcels/Parcels#1695.