Coverage for src/efts_io/helpers.py: 0.00%
7 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-07-24 10:14 +1000
« prev ^ index » next coverage.py v7.6.1, created at 2025-07-24 10:14 +1000
1"""Helper functions for netcdf file."""
4# Initial Intent: port https://bitbucket.csiro.au/projects/SF/repos/matlab_functions/browse/Import_export/create_empty_stfnc.m
5# may be an superseded feature as of July 2025
7# from typing import Optional, Union
9# from .wrapper import EftsDataSet
11# def create_empty_stfnc(
12# ncfile: str,
13# n_stations: int,
14# var_type: Union[str, int],
15# data_type: int,
16# catchment: str = "", # String specifying catchment name.
17# ens_no: int = 1, # Integer specifying number of ensemble members. If you
18# fill_value: float = -9999.0, # Fill value for the variable being created. Defaults to
19# lead_time: int = 1, # Integer specifying forecast lead time. Only operates
20# quality: bool = False, # Boolean. Set to true if you want to create a data quality
21# stf_nc_vers: str = "1.0", # Double version number of STF netCDF convention. Defaults to
22# title: str = "", # String specifying title of .nc file
23# institution: Optional[str] = None, # String specifying institution that made the data.
24# warnings: int = 0, # integer specifying if you wish to turn off warning
25# data_class: type = float, # Data class for variable in .nc file. Defaults to
26# owr: bool = True, # Bolean. Indicates whether you wish to overwrite the
27# ):
28# d = EftsDataSet()
30import importlib.resources
33def get_sample_data_path(file_name: str) -> str:
34 """Retrieve the path to a sample data file included in the package.
36 Args:
37 file_name (str): The name of the sample data file.
39 Returns:
40 str: The path to the sample data file.
41 """
42 with importlib.resources.path("efts_io.data", file_name) as data_path:
43 return str(data_path)
45def derived_rainfall_tas() -> str:
46 """Sample rainfall from Tasmania."""
47 sample_data_file = "derived_rainfall_tas.nc"
48 return get_sample_data_path(sample_data_file)