diff --git a/environment-dev.yml b/environment-dev.yml index 41f40a6..d3fbd8e 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -30,9 +30,8 @@ dependencies: - pint - pint-pandas - pint-xarray - + - tzfpy - pip - pip: - - timezonefinder[numba] - codetiming - hydroutils diff --git a/hydrodataset/caravan.py b/hydrodataset/caravan.py index ad1ff21..9965c62 100644 --- a/hydrodataset/caravan.py +++ b/hydrodataset/caravan.py @@ -11,7 +11,7 @@ from urllib.request import urlopen import pandas as pd import numpy as np -from timezonefinder import TimezoneFinder +from tzfpy import get_tz from hydroutils import hydro_file from hydrodataset import CACHE_DIR, HydroDataset @@ -532,9 +532,9 @@ def cache_attributes_xrdataset(self): # for attrs not from hydroatlas in caravan, we directly set pint unit units_dict["area"] = "km^2" - units_dict[ - "area_fraction_used_for_aggregation" - ] = "dimensionless" # this one is from atlas but not specified in the document + units_dict["area_fraction_used_for_aggregation"] = ( + "dimensionless" # this one is from atlas but not specified in the document + ) units_dict["aridity"] = "dimensionless" units_dict["country"] = "dimensionless" units_dict["frac_snow"] = "dimensionless" @@ -748,7 +748,7 @@ def _check_data(self, regions): _data.set_index(["date"]) ) the_ncfile_data.attrs = attrs - tf = TimezoneFinder() + # tf = TimezoneFinder() site_meta_file = os.path.join( self.data_source_description["ATTR_DIR"], region, @@ -763,7 +763,7 @@ def _check_data(self, regions): lon = df_metadata.loc[ df_metadata.index == gage_id, "gauge_lon" ].values[0] - the_ncfile_data.attrs["Timezone"] = tf.timezone_at(lat=lat, lng=lon) + the_ncfile_data.attrs["Timezone"] = get_tz(lat=lat, lng=lon) the_ncfile = os.path.join( os.path.dirname(file_path), f"{gage_id}.nc" ) diff --git a/hydrodataset/hydro_dataset.py b/hydrodataset/hydro_dataset.py index 9fa0df4..2783f2e 100644 --- a/hydrodataset/hydro_dataset.py +++ b/hydrodataset/hydro_dataset.py @@ -1,16 +1,19 @@ """ Author: Wenyu Ouyang Date: 2022-09-05 23:20:24 -LastEditTime: 2023-07-27 21:44:01 +LastEditTime: 2024-02-20 19:33:43 LastEditors: Wenyu Ouyang Description: main modules for hydrodataset FilePath: \hydrodataset\hydrodataset\hydro_dataset.py Copyright (c) 2021-2022 Wenyu Ouyang. All rights reserved. """ -from pathlib import Path + from abc import ABC +from pathlib import Path from typing import Union + import numpy as np + from hydrodataset import ROOT_DIR @@ -63,7 +66,8 @@ def read_other_cols( self, object_ids=None, other_cols: dict = None, **kwargs ) -> dict: """some data which cannot be easily treated as constant vars or time-series with same length as relevant vars - CONVENTION: other_cols is a dict, where each item is also a dict with all params in it""" + CONVENTION: other_cols is a dict, where each item is also a dict with all params in it + """ raise NotImplementedError def get_constant_cols(self) -> np.array: diff --git a/requirements.txt b/requirements.txt index bec01f2..425aa1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ scipy pint pint-pandas pint-xarray -timezonefinder[numba] +tzfpy codetiming -hydroutils \ No newline at end of file +hydroutils diff --git a/requirements_dev.txt b/requirements_dev.txt index ac36262..8d9fbbd 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -22,7 +22,7 @@ scipy pint pint-pandas pint-xarray -timezonefinder[numba] +tzfpy codetiming hydroutils \ No newline at end of file