pycif.plugins.datastreams.fluxes.point_sources — API reference

pycif.plugins.datastreams.fluxes.point_sources — API reference#

Configuration reference: point_sources plugin

pycif.plugins.datastreams.fluxes.point_sources.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None, **kwargs)[source]#

Fetch the point-source CSV file and build the hourly date intervals it covers.

The same CSV file (holding all point sources and their validity periods) is linked once into target_dir and reused for every hourly sub-interval of input_interval; per-source filtering by validity period is done later in read.

Parameters:
  • ref_dir (str) – Directory containing the reference CSV file.

  • ref_file (str) – Name of the CSV file.

  • input_interval (list[datetime.datetime]) – [date_i, date_f] simulation interval to cover.

  • target_dir (str) – Directory where the CSV file is linked.

  • tracer – Unused directly, kept for interface consistency with other flux plugins.

  • component – Unused, kept for interface consistency with other fetch functions.

Returns:

(list_files, list_dates), each keyed by the start of a day within input_interval, mapping to the (repeated) CSV file path and the list of hourly [start, end] date-interval pairs within that day.

Return type:

tuple[dict, dict]

pycif.plugins.datastreams.fluxes.point_sources.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#

Build an unstructured, per-point domain from the point-source CSV file.

Reads the CSV’s lon/lat/alt columns and builds a Domain with one “cell” per point source (no shared grid; cell centers and corners coincide), with vertical extent equal to the number of sources (one level per source, positioned at its altitude).

Parameters:
  • ref_dir (str) – Unused directly, kept for interface consistency; the reference file is instead taken from tracer.input_files.

  • ref_file (str) – Unused directly, kept for interface consistency.

  • input_interval (list) – Unused directly, kept for interface consistency.

  • target_dir (str) – Unused directly, kept for interface consistency.

  • tracer – The flux tracer plugin, providing input_files (as populated by fetch).

Returns:

an unstructured domain with one cell per point source.

Return type:

Domain

Raises:

CifError – If the reference CSV file is not found.

pycif.plugins.datastreams.fluxes.point_sources.read.read(self, name, varnames, dates, files, interpol_flx=False, tracer=None, model=None, ddi=None, **kwargs)[source]#

Get point-source fluxes from the CSV file and load them into a pyCIF variable.

For each requested date interval, re-reads the CSV file and splits its rows into active sources (whose [datei, datef] validity period overlaps the requested interval) and inactive ones. Builds a two-level column pandas.DataFrame (metadata: lon, lat, alt, date, duration, tstep, dtstep; maindata: spec) with the emission value for active sources and 0 for inactive ones, and concatenates the result across all requested dates.

Parameters:
  • name (str) – name of the component

  • varnames (list[str]) – Unused directly, kept for interface consistency with other flux plugins.

  • dates (list) – list of the [start, end] date intervals to extract

  • files (list) – list of the (repeated) CSV file path matching dates

  • interpol_flx (bool) – Unused, kept for interface consistency.

  • tracer – The flux tracer plugin, providing domain (used only to read nlon/nlat/nlev, currently unused in the loop).

  • model – Unused, kept for interface consistency.

  • ddi – Unused, kept for interface consistency.

Returns:

A MultiIndex-columned DataFrame (metadata and maindata groups) with one row per point source and per requested date, holding the source’s location/timing metadata and its emission value (0 for sources inactive at that date).

Return type:

pandas.DataFrame

pycif.plugins.datastreams.fluxes.point_sources.write.write(self, name, flx_file, flx, mode='a', **kwargs)[source]#

Not implemented; always raises, since writing point-source fluxes is not supported.