pixcdust.tests.test_converters

Attributes

LIM_AREA_POL

LIM_AREA_GEOM

Geometry used as area of interest of limited area tests.

Functions

test_nc_simple_reader_conditions(input_files)

Test NcSimpleReader with conditions on variables.

validate_conversion_to_nc(→ None)

Compare the start of a converted database to the first original netcdf file.

validate_conversion(→ None)

Compare the read data to the expected data.

test_convert_zarr_full_area(input_files, first_file, ...)

Test zarr conversion without area_of_interest.

converted_lim_gpkg(input_files, tmp_folder)

test_convert_gpkg_and_zarr_limited_area(input_files, ...)

Test geopackage and zarr conversion with area_of_interest.

test_convert_shape_limited_area(input_files, ...)

Test shapefile conversion with area_of_interest.

test_gpkg_dggs_projecter(converted_lim_gpkg, tmp_folder)

Test the GpkgDGGSProjecter class by converting a sample Gpkg to a DGGS projection.

Module Contents

pixcdust.tests.test_converters.LIM_AREA_POL[source]
pixcdust.tests.test_converters.LIM_AREA_GEOM[source]

Geometry used as area of interest of limited area tests.

pixcdust.tests.test_converters.test_nc_simple_reader_conditions(input_files)[source]

Test NcSimpleReader with conditions on variables.

pixcdust.tests.test_converters.validate_conversion_to_nc(read_data: xarray.Dataset, converted_vars: List[str], first_file: str | pathlib.Path) None[source]

Compare the start of a converted database to the first original netcdf file.

Args:

read_data: Data to validate. converted_vars: Names of variables to compare. first_file: Netcdf file containing the expected data.

Raises:

AssertionError: If the data are too different.

pixcdust.tests.test_converters.validate_conversion(read_data: xarray.Dataset, converted_vars: List[str], expected_data: xarray.Dataset, is_longer: bool, len_tol: int = 0, sort_var: bool = False) None[source]

Compare the read data to the expected data.

Args:

read_data: Data to validate. converted_vars: Names of variables to compare. expected_data: Expected data. is_longer: Os the expected_data expected to only contain the start of the read_data. len_tol: Tolerance for len_tol missing point because of numeric error on lon/lat. sort_var: Is the data ordering different and do we neer to sort them.

Raises:

AssertionError: If the data are too different.

pixcdust.tests.test_converters.test_convert_zarr_full_area(input_files, first_file, tmp_folder)[source]

Test zarr conversion without area_of_interest.

It is compared to the input data.

pixcdust.tests.test_converters.converted_lim_gpkg(input_files, tmp_folder)[source]
pixcdust.tests.test_converters.test_convert_gpkg_and_zarr_limited_area(input_files, first_file, tmp_folder, converted_lim_gpkg)[source]

Test geopackage and zarr conversion with area_of_interest.

They are compared to each other. Note that they are ordered differently with some missing points due tu lon/lat casting.

pixcdust.tests.test_converters.test_convert_shape_limited_area(input_files, first_file, tmp_folder)[source]

Test shapefile conversion with area_of_interest.

pixcdust.tests.test_converters.test_gpkg_dggs_projecter(converted_lim_gpkg, tmp_folder)[source]

Test the GpkgDGGSProjecter class by converting a sample Gpkg to a DGGS projection.