wolfhece.hydrology.climate_data =============================== .. py:module:: wolfhece.hydrology.climate_data Module Contents --------------- .. py:data:: DATADIR .. py:function:: transform_latlon_to_lambert72_list(lat_list: list[float], lon_list: list[float]) -> list[tuple[float, float]] Transform lists of EPSG:4258 coordinates to Lambert 72 coordinates. Coordinates from IRM are in EPSG:4258, and we want to convert them to Lambert 72 (EPSG:31370). .. py:function:: read_pixel_positions(data_dir: pathlib.Path = DATADIR) -> tuple[list[int], list[tuple[float, float]]] Read pixel positions from the metadata file. .. py:function:: convert_pixels_to_squares(pixels: list[tuple[float, float]]) -> tuple[list[tuple[tuple[float, float], Ellipsis]], scipy.spatial.KDTree] From pixels coordinates, define squares around each pixel center. Corners are defined as the average of the pixel center and its neighbors. .. py:function:: read_historical_year_month(year: int, month: int, data_dir: pathlib.Path = DATADIR) -> pandas.DataFrame Read a specific year and month from the climate data. Available variables are : - day - temp_max - temp_min - temp_avg - precip_quantity - humidity_relative - pressure - sun_duration - short_wave_from_sky - evapotrans_ref From IRM's Metadata description: - TEMP_MAX °C daily maximum temperature from 08:00LT on DATE_BEGIN to 08:00LT on DATE_END+1 - TEMP_MIN °C daily minimum temperature from 08:00LT on DATE_BEGIN-1 to 08:00LT on DATE_END - TEMP_AVG °C average temperature (average of TEMP_MAX and TEMP_MIN) - PRECIP_QUANTITY mm precipitation quantity from 08:00LT on DATE_BEGIN to 08:00LT on DATE_END+1 - HUMIDITY_RELATIVE percentage average relative humidity - PRESSURE hPa sea level pressure - SUN_DURATION average daily sunshine duration (hours/day) - SHORT_WAVE_FROM_SKY average daily global solar radiation (kWh/m2/day) - EVAPOTRANS_REF mm reference evapotranspiration ET0 :param year: Year to read :type year: int :param month: Month to read :type month: int :param variable: Variable to read (e.g., 'temperature', 'precipitation') :type variable: str :param data_dir: Directory where the data is stored :type data_dir: Path :return: DataFrame containing the data for the specified year and month .. py:function:: scan_climate_files(data_dir: pathlib.Path = DATADIR) -> list[pathlib.Path] Scan the directory for climate data files. :param data_dir: Directory where the data is stored :type data_dir: Path :return: List of paths to climate data files .. py:function:: find_first_available_year_month(data_dir: pathlib.Path = DATADIR) -> int Find the first available year in the climate data files. :param data_dir: Directory where the data is stored :type data_dir: Path :return: First available year as an integer .. py:function:: find_last_available_year_month(data_dir: pathlib.Path = DATADIR) -> int Find the last available year in the climate data files. :param data_dir: Directory where the data is stored :type data_dir: Path :return: Last available year as an integer .. py:function:: read_between(data_dir: pathlib.Path = DATADIR, start_year: int = 1961, start_month: int = 1, end_year: int = 2025, end_month: int = 6) -> pandas.DataFrame Read climate data files into a single DataFrame. :param data_dir: Directory where the data is stored :type data_dir: Path :return: DataFrame containing all climate data .. py:function:: read_all_data(data_dir: pathlib.Path = DATADIR) -> pandas.DataFrame Read all climate data files into a single DataFrame. :param data_dir: Directory where the data is stored :type data_dir: Path :return: DataFrame containing all climate data .. py:data:: data :value: None