stilt.errors#

Functions

calculate_particle_concentrations(...)

Calculates the concentration of dCH4 for particles in a given trajectory file.

calculate_particle_variance(trajectory_path, ...)

Calculates the variance of dCH4 for particles in a given trajectory file.

calculate_transport_error(sim_dir, fluxes)

Calculates the transport error for a given STILT simulation ID.

extract_flux(fluxes, particles)

Extracts flux values from a flux dataset for given particle locations.

plot_particle_variances(sim_dir, fluxes)

Plots the variances of dCH4 for regular and error particles.

stilt.errors.extract_flux(fluxes, particles)[source]#

Extracts flux values from a flux dataset for given particle locations.

Parameters:
  • fluxes (xarray.DataArray) – The flux dataset with ‘lat’ and ‘lon’ dimensions.

  • particles (pandas.DataFrame) – DataFrame containing particle trajectory data with ‘lati’ and ‘long’ columns.

Returns:

Numpy array of flux values corresponding to particle locations.

Return type:

np.ndarray

stilt.errors.calculate_particle_concentrations(trajectory_path, fluxes)[source]#

Calculates the concentration of dCH4 for particles in a given trajectory file.

Parameters:
  • trajectory_path (Path) – Path to the trajectory parquet file.

  • fluxes (xarray.DataArray) – The flux dataset with ‘lat’ and ‘lon’ dimensions.

Returns:

Concentration of dCH4 for the particles.

Return type:

pd.DataFrame

stilt.errors.calculate_particle_variance(trajectory_path, fluxes)[source]#

Calculates the variance of dCH4 for particles in a given trajectory file.

Parameters:
  • trajectory_path (Path) – Path to the trajectory parquet file.

  • fluxes (xarray.DataArray) – The flux dataset with ‘lat’ and ‘lon’ dimensions.

Returns:

Variance of dCH4 for the particles.

Return type:

float

stilt.errors.plot_particle_variances(sim_dir, fluxes)[source]#

Plots the variances of dCH4 for regular and error particles.

Parameters:
  • sim_dir (Path | str) – Directory containing the simulation data.

  • fluxes (xarray.DataArray) – The flux dataset with ‘lat’ and ‘lon’ dimensions.

Returns:

Matplotlib Axes object with the plot.

Return type:

plt.Axes

stilt.errors.calculate_transport_error(sim_dir, fluxes)[source]#

Calculates the transport error for a given STILT simulation ID.

Parameters:
  • sim_dir (Path | str) – Directory containing the simulation data.

  • fluxes (xarray.DataArray) – The flux dataset with ‘lat’ and ‘lon’ dimensions.

Returns:

The calculated transport error.

Return type:

float