Skip to content

Commit f7c04d3

Browse files
commit before moving to fasrc
1 parent f69ca46 commit f7c04d3

File tree

21 files changed

+306
-142
lines changed

21 files changed

+306
-142
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.micromamba
22
logs/*
33
.snakemake/*
4-
.DS_Store
4+
.DS_Store
5+
sandbox

conf/config.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
defaults:
22
- _self_
33
- datapaths: datapaths
4-
4+
#- CDS_API_KEY: $HOME/.cdsapirc
55
query:
66
product_type: reanalysis
7-
variable: ["2m_dewpoint_temperature", "2m_temperature", "skin_temperature"]
7+
# check precipitation
8+
variable: ["2m_dewpoint_temperature", "2m_temperature", "skin_temperature", "total_precipitation"]
89
year: [2010, 2011]
9-
month: [1, 2, 3]
10-
day: [1, 2, 3, 4, 5]
11-
time: [0, 6, 12, 18]
10+
month: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
11+
day: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
12+
time: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
13+
14+
# in the current workflow we can test with a small number of healthsheds
15+
# this bounding box will need to be expanded by ~ 50km (in G's dataset it is 50) or even up to 70 or 08
16+
# we can also experiment with a buffer that follows the coastline precisely by 100KM
17+
1218
area: [0, 360, -90, 90]
1319
data_format: netcdf
1420
download_format: unarchived

era5_sandbox.egg-info/PKG-INFO

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Classifier: License :: OSI Approved :: Apache Software License
2020
Requires-Python: >=3.7
2121
Description-Content-Type: text/markdown
2222
License-File: LICENSE
23+
Requires-Dist: fastcore
24+
Requires-Dist: pyprojroot
2325
Provides-Extra: dev
2426
Dynamic: author
2527
Dynamic: author-email
@@ -30,6 +32,7 @@ Dynamic: home-page
3032
Dynamic: keywords
3133
Dynamic: license
3234
Dynamic: provides-extra
35+
Dynamic: requires-dist
3336
Dynamic: requires-python
3437
Dynamic: summary
3538

era5_sandbox.egg-info/SOURCES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ setup.py
77
era5_sandbox/__init__.py
88
era5_sandbox/_modidx.py
99
era5_sandbox/core.py
10+
era5_sandbox/download.py
1011
era5_sandbox.egg-info/PKG-INFO
1112
era5_sandbox.egg-info/SOURCES.txt
1213
era5_sandbox.egg-info/dependency_links.txt

era5_sandbox.egg-info/requires.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
fastcore
2+
pyprojroot
13

24
[dev]
0 Bytes
Binary file not shown.
117 Bytes
Binary file not shown.
174 Bytes
Binary file not shown.

era5_sandbox/download.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import os
1010
import hydra
1111
import cdsapi
12-
from fastcore.script import call_parse # for the console script
13-
12+
from core import _expand_path
1413
from omegaconf import DictConfig, OmegaConf
1514

1615
# %% ../notes/01_download_raw_data.ipynb 5
@@ -39,7 +38,7 @@ def fetch_MDG_GADM(
3938
https://geodata.ucdavis.edu/gadm/gadm4.1/gpkg/gadm41_MDG.gpkg
4039
'''
4140

42-
output_file_path = os.path.join(os.getcwd(), output_file)
41+
output_file_path = _expand_path(output_file)
4342
if os.path.exists(output_file_path):
4443
print("GADM data already exists")
4544
return output_file_path
@@ -67,7 +66,7 @@ def download(
6766

6867
# Send the query to the client
6968
if not testing:
70-
client.retrieve(dataset, query).download(os.path.join(output_dir, "{}_{}.nc".format(query.year, query.month)))
69+
client.retrieve(dataset, query).download(os.path.join(_expand_path(output_dir), "{}_{}.nc".format(query.year, query.month)))
7170
else:
7271
print(f"Testing mode. Not downloading data. Query is {query}")
7372

notes/00_core.ipynb

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
{
3333
"cell_type": "code",
34-
"execution_count": 2,
34+
"execution_count": null,
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
@@ -46,7 +46,7 @@
4646
},
4747
{
4848
"cell_type": "code",
49-
"execution_count": 3,
49+
"execution_count": null,
5050
"metadata": {},
5151
"outputs": [],
5252
"source": [
@@ -152,7 +152,7 @@
152152
},
153153
{
154154
"cell_type": "code",
155-
"execution_count": 33,
155+
"execution_count": null,
156156
"metadata": {},
157157
"outputs": [
158158
{
@@ -239,21 +239,9 @@
239239
],
240240
"metadata": {
241241
"kernelspec": {
242-
"display_name": "era5_sandbox",
242+
"display_name": "python3",
243243
"language": "python",
244244
"name": "python3"
245-
},
246-
"language_info": {
247-
"codemirror_mode": {
248-
"name": "ipython",
249-
"version": 3
250-
},
251-
"file_extension": ".py",
252-
"mimetype": "text/x-python",
253-
"name": "python",
254-
"nbconvert_exporter": "python",
255-
"pygments_lexer": "ipython3",
256-
"version": "3.13.2"
257245
}
258246
},
259247
"nbformat": 4,

0 commit comments

Comments
 (0)