From a76b49338bd6bb90ac2751f6748bda06ddfe8706 Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 13:33:46 +0200 Subject: [PATCH 1/8] ga-test --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index cbfc43a..0eda4ae 100644 --- a/setup.py +++ b/setup.py @@ -22,13 +22,18 @@ 'pooch', 'python-dateutil', 'meteostat', - 'cyclopts', 'requests', 'pydantic', 'pyyaml', + 'cyclopts', 'requests', + 'pydantic>=2.0', + 'pyyaml', 'geopandas', 'libpysal', 'docker', 'jax', 'jaxlib', 'blackjax', 'dynamax', 'flax', 'optax', 'scipy', 'fastapi', 'gitpython', 'earthengine-api', 'python-dotenv', 'rq', "python-multipart", "uvicorn", - 'pydantic-geojson', 'annotated_types' + 'pydantic-geojson', 'annotated_types', + 'pycountry', + 'unidecode', + ] test_requirements = ['pytest>=3', "hypothesis"] From 73c95deb9b46e5aa272c1321746f56142a352775 Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 13:36:12 +0200 Subject: [PATCH 2/8] missing req --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0eda4ae..c32fe0f 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,8 @@ 'pydantic-geojson', 'annotated_types', 'pycountry', 'unidecode', - + 'httpx', + ] test_requirements = ['pytest>=3', "hypothesis"] From 43f5c8fdcf60dd41fa14770360e0d4528acbc768 Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 13:39:39 +0200 Subject: [PATCH 3/8] missing req --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index c32fe0f..c07037c 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ 'pycountry', 'unidecode', 'httpx', + 'ee' ] From 4874d859034632f6d53cbed5a7ec428bbcd74205 Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 14:01:55 +0200 Subject: [PATCH 4/8] missing req --- requirements_dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements_dev.txt b/requirements_dev.txt index 5314c04..bb06038 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -13,3 +13,4 @@ meteostat pytest-mock furo myst-parser +ee From 39672147d828aad08be31d5d13f7a7b9db61f576 Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 14:07:26 +0200 Subject: [PATCH 5/8] requirement fix --- requirements_dev.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index bb06038..fb71bbb 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -13,4 +13,4 @@ meteostat pytest-mock furo myst-parser -ee +earthengine-api diff --git a/setup.py b/setup.py index c07037c..160ef52 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ 'pycountry', 'unidecode', 'httpx', - 'ee' + 'earthengine-api' ] From 4867c75c3dcea8c3e1537a51df781a8c6258c6aa Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 14:12:09 +0200 Subject: [PATCH 6/8] missing req --- requirements_dev.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements_dev.txt b/requirements_dev.txt index fb71bbb..b383082 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -14,3 +14,6 @@ pytest-mock furo myst-parser earthengine-api +python-dotenv +myst_parser +furo From b7dae80ffe9861b41dd9df98c6346e112db2873b Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 14:14:19 +0200 Subject: [PATCH 7/8] missing req --- .github/workflows/build_sphinx_website.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_sphinx_website.yml b/.github/workflows/build_sphinx_website.yml index 4202bd4..458ccd3 100644 --- a/.github/workflows/build_sphinx_website.yml +++ b/.github/workflows/build_sphinx_website.yml @@ -25,6 +25,7 @@ jobs: - name: install dependencies run: | python -m pip install --upgrade pip + pip install -e . pip install -r requirements_dev.txt - name: make html & commit the changes From 20806122d437036df315a494d4fa912f4b8ee74c Mon Sep 17 00:00:00 2001 From: Ivar Grytten Date: Thu, 29 Aug 2024 14:38:54 +0200 Subject: [PATCH 8/8] getting test external models with ewars to work --- tests/external/test_external_models.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/external/test_external_models.py b/tests/external/test_external_models.py index 5b8b2b7..672c585 100644 --- a/tests/external/test_external_models.py +++ b/tests/external/test_external_models.py @@ -9,11 +9,11 @@ from climate_health.api import get_model_from_directory_or_github_url from climate_health.spatio_temporal_data.temporal_dataclass import SpatioTemporalDict -from climate_health.datatypes import ClimateHealthTimeSeries +from climate_health.datatypes import ClimateHealthTimeSeries, FullData logging.basicConfig(level=logging.INFO) from climate_health.external.external_model import get_model_from_yaml_file, run_command -from ..data_fixtures import full_data, train_data, future_climate_data +from ..data_fixtures import full_data, train_data, train_data_pop, future_climate_data from climate_health.util import conda_available @@ -35,7 +35,7 @@ def test_python_model_from_folder(models_path, train_data, future_climate_data): assert results is not None -def get_dataset_from_yaml(yaml_path: Path): +def get_dataset_from_yaml(yaml_path: Path, datatype=ClimateHealthTimeSeries): specs = yaml.load(yaml_path.read_text(), Loader=yaml.FullLoader) if 'demo_data' in specs: path = yaml_path.parent / specs['demo_data'] @@ -49,19 +49,19 @@ def get_dataset_from_yaml(yaml_path: Path): df[to_name] = df[from_name] #df['disease_cases'] = np.arange(len(df)) - return SpatioTemporalDict.from_pandas(df, ClimateHealthTimeSeries) + return SpatioTemporalDict.from_pandas(df, datatype) #@pytest.mark.skipif(not conda_available(), reason='requires conda') @pytest.mark.parametrize('model_directory', ['ewars_Plus']) #@pytest.mark.parametrize('model_directory', ['naive_python_model']) -def test_all_external_models_acceptance(model_directory, models_path, train_data, future_climate_data): +def test_all_external_models_acceptance(model_directory, models_path, train_data_pop, future_climate_data): """Only tests that the model can be initiated and that train and predict can be called without anything failing""" print("Running") yaml_path = models_path / model_directory / 'config.yml' model = get_model_from_yaml_file(yaml_path, working_dir=models_path / model_directory) - train_data = get_dataset_from_yaml(yaml_path) + train_data = get_dataset_from_yaml(yaml_path, FullData) model.setup() model.train(train_data) #results = model.predict(future_climate_data) @@ -72,11 +72,12 @@ def test_all_external_models_acceptance(model_directory, models_path, train_data @pytest.mark.parametrize('model_directory', ['ewars_Plus']) def test_external_model_predict(model_directory, models_path): yaml_path = models_path / model_directory / 'config.yml' - train_data = get_dataset_from_yaml(yaml_path) + train_data = get_dataset_from_yaml(yaml_path, FullData) model = get_model_from_yaml_file(yaml_path, working_dir=models_path / model_directory) model.setup() #model.setup() results = model.predict(train_data) + print(results) assert isinstance(results, SpatioTemporalDict)