Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MAfarrag committed Jan 15, 2023
1 parent 7e4cb29 commit bed731f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion earth2observe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ def print_progress_bar(
sys.stdout.flush()

if i == total:
print()
print()
8 changes: 4 additions & 4 deletions examples/abstract_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
lat_lim=latlim,
lon_lim=lonlim,
temporal_resolution=temporal_resolution,
path=path
path=path,
)
# e2o.download()
#%%
Expand All @@ -30,7 +30,7 @@
lat_lim=latlim,
lon_lim=lonlim,
temporal_resolution=temporal_resolution,
path=path
path=path,
)
# e2o.download(cores=4)
#%%
Expand All @@ -46,6 +46,6 @@
lat_lim=latlim,
lon_lim=lonlim,
temporal_resolution=temporal_resolution,
path=path
path=path,
)
e2o.download()
e2o.download()
10 changes: 9 additions & 1 deletion examples/chirps_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from earth2observe.chirps import CHIRPS

# %% precipitation
start = "2009-01-01"
end = "2009-01-10"
Expand All @@ -7,7 +8,14 @@
lonlim = [-75.65, -74.73]

path = r"examples\data\chirps"
Coello = CHIRPS(start=start, end=end, lat_lim=latlim, lon_lim=lonlim, temporal_resolution=time, path=path)
Coello = CHIRPS(
start=start,
end=end,
lat_lim=latlim,
lon_lim=lonlim,
temporal_resolution=time,
path=path,
)
#%%
Coello.download() # cores=4
#%%
Expand Down
4 changes: 2 additions & 2 deletions examples/ecmwf_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
path=path,
variables=variables,
lat_lim=latlim,
lon_lim=lonlim
lon_lim=lonlim,
)

Coello.download(dataset="interim")
Expand All @@ -51,7 +51,7 @@
path=path,
variables=variables,
lat_lim=latlim,
lon_lim=lonlim
lon_lim=lonlim,
)

Coello.download()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ loguru >=0.6.0
netCDF4 >=1.6.1
numpy ==1.24.1
pandas >=1.4.4
pathlib >=1.0.1
pip >=22.3.1
pyramids-gis >=0.2.12
PyYAML >=6.0
pathlib >=1.0.1
requests >=2.28.1
18 changes: 14 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import pytest
from typing import List
from pathlib import Path
from tests.gee.conftest import *
from typing import List

import pytest

from tests.gee.conftest import *


@pytest.fixture(scope="session")
def dates() -> List:
return ["2009-01-01", "2009-01-05"]


@pytest.fixture(scope="session")
def number_downloaded_files() -> int:
return 5


@pytest.fixture(scope="session")
def daily_temporal_resolution() -> str:
return "daily"


@pytest.fixture(scope="session")
def lat_bounds() -> List:
return [4.19, 4.64]
Expand All @@ -26,6 +30,7 @@ def lat_bounds() -> List:
def lon_bounds() -> List:
return [-75.65, -74.73]


@pytest.fixture(scope="session")
def chirps_base_dir() -> str:
return "tests/data/delete/chirps"
Expand All @@ -40,22 +45,27 @@ def ecmwf_base_dir() -> Path:
def chirps_variables() -> List[str]:
return ["precipitation"] # "T",


@pytest.fixture(scope="session")
def ecmwf_variables() -> List[str]:
return ["E"] # "T",


@pytest.fixture(scope="session")
def ecmwf_data_source() -> str:
return "ecmwf"


@pytest.fixture(scope="session")
def ecmwf_data_source_output_dir() -> str:
return Path("tests/data/delete/ecmwf-backend").absolute()


@pytest.fixture(scope="session")
def chirps_data_source() -> str:
return "chirps"


@pytest.fixture(scope="session")
def chirps_data_source_output_dir() -> str:
return Path("tests/data/delete/chirps-backend").absolute()
return Path("tests/data/delete/chirps-backend").absolute()

0 comments on commit bed731f

Please sign in to comment.