pixcdust.readers.base_reader

Interface used by all Pixcdust Readers.

Attributes

PIXC_DATE_RE

Regex patern used to extract the date (daystartThourstart_dayxendThoursend)

Classes

BaseReader

Abstract class parent of pixcdust database readers.

Functions

sorted_by_date(→ List[Union[str, pathlib.Path]])

Sort the filenames by date as some converters need monotonic dates.

Module Contents

pixcdust.readers.base_reader.PIXC_DATE_RE[source]

Regex patern used to extract the date (daystartThourstart_dayxendThoursend) from a pixc file name.

pixcdust.readers.base_reader.sorted_by_date(file_list: Iterable[str | pathlib.Path]) List[str | pathlib.Path][source]

Sort the filenames by date as some converters need monotonic dates. The date is parsed from the filename according to PIXC_DATE_RE. Args:

file_list: List or iterable of pixc filenames.

Returns:

Sorted file_list.

class pixcdust.readers.base_reader.BaseReader(path: 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 database readers.

They read a database from a folder, file or list of files. You can then request a xr.Dataset, pd.DataFrame or gpd.GeoDataFrame view of the database.

Attributes:

path: Path or list of path to read. variables: Optionally only read these variables. area_of_interest: Optionally only read points in area_of_interest. MULTI_FILE_SUPPORT: Static variable describing if the class support opening a list of path. conditions: Optionally pass conditions to filter variables. Example: { “sig0”:{‘operator’: “ge”, ‘threshold’: 20}, “classification”:{‘operator’: “ge”, ‘threshold’: 3}, }

MULTI_FILE_SUPPORT = False[source]
area_of_interest = None[source]
_data: xarray.Dataset | None = None[source]
variables = None[source]
conditions = None[source]
property data: xarray.Dataset[source]

Return an xarray.Dataset view from the database loaded.

Equivalent to to_xarray.

Returns:

Dataset read

to_xarray() xarray.Dataset[source]

Return an xarray.Dataset view from the database loaded.

Returns:

Dataset read.

to_dataframe() pandas.DataFrame[source]

Return a pandas.DataFrame view from the database loaded.

Returns:

DataFrame read.

to_geodataframe() geopandas.GeoDataFrame[source]

Convert the database read to a gpd.GeoDataFrame. Only points in self.area_of_interest are included.

Returns:

GeoDataFrame read.