pixcdust.converters.core

Interface used by all Pixcdust Converters.

Classes

Converter

Abstract class parent of pixcdust converters.

ConverterWSE

Abstract class parent of pixcdust converters supporting water surface elevation computation.

GeoLayerH3Projecter

Class for adding H3 projections to databases

Module Contents

class pixcdust.converters.core.Converter(path_in: str | Iterable[str] | pathlib.Path | Iterable[pathlib.Path], variables: list[str] | None = None, area_of_interest: geopandas.GeoDataFrame | None = None, conditions: dict[str, dict[str, str | float]] | None = None)[source]

Abstract class parent of pixcdust converters.

They convert from official SWOT Pixel Cloud Netcdf to the supported format.

Attributes:

path_in: List of path of files to convert. variables: Optionally only read these variables. area_of_interest: Optionally only read points in area_of_interest. conditions: Optionally pass conditions to filter variables. Example: { “sig0”:{‘operator’: “ge”, ‘threshold’: 20}, “classification”:{‘operator’: “ge”, ‘threshold’: 3}, }

variables[source]
area_of_interest = None[source]
conditions = None[source]
abstract database_from_nc(path_out: str | pathlib.Path, mode: str = 'w') None[source]

Convert the path_in files to path_out. Args:

path_out: Output path of the convertion. mode: Writing mode of the output. Must be ‘w’(write/append) or ‘o’(overwrite).

class pixcdust.converters.core.ConverterWSE(path_in: str | Iterable[str] | pathlib.Path | Iterable[pathlib.Path], variables: list[str] | None = None, area_of_interest: geopandas.GeoDataFrame | None = None, conditions: dict[str, dict[str, str | float]] | None = None)[source]

Bases: Converter

Abstract class parent of pixcdust converters supporting water surface elevation computation.

They convert from official SWOT Pixel Cloud Netcdf to the supported format.

Attributes:

path_in: List of path of files to convert. variables: Optionally only read these variables. area_of_interest: Optionally only read points in area_of_interest.

abstract database_from_nc(path_out: str | pathlib.Path, mode: str = 'w', compute_wse: bool = True) None[source]

Convert the path_in files to path_out. Args:

path_out: Output path of the convertion. mode: Writing mode of the outpout. Must be ‘w’(write/append) or ‘o’(overwrite). compute_wse: toggle water surface elevation computation.

_append_wse_vars()[source]

Need some vars to compute wse.

_compute_wse(gdf)[source]
static _get_vars_wse_computation() list[str][source]

Names of fields used to compute wse.

static _get_name_wse_var() str[source]

Output name for wse.

class pixcdust.converters.core.GeoLayerH3Projecter[source]

Class for adding H3 projections to databases

Attributes:

data: data getting projected resolution: Resolution

data: geopandas.GeoDataFrame[source]
resolution: int[source]
filter_variable(conditions: dict[str, dict[str, str | float]]) None[source]

filters from xarray dataset based on operator and threshold on specific variables

Args:

conditions (dict): specifies the filters. Example: { “sig0”:{‘operator’: “ge”, ‘threshold’: 20}, “classification”:{‘operator’: “ge”, ‘threshold’: 3}, }

Raises:

IOError: if variable provided in conditions are not in self.data.columns ValueError: if ‘operator’ and ‘to’ keys are not in conditions AttributeError: if operator is not the function name of the operator module

compute_h3_layer() None[source]

Project data to h3.

compute_healpix_layer() None[source]

Project data to Healpix.