Skip to content

Commit f69ca46

Browse files
disable github actions and experiment with datapaths
1 parent 7dd185b commit f69ca46

File tree

8 files changed

+50
-27
lines changed

8 files changed

+50
-27
lines changed

.github/workflows/deploy.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
name: Deploy to GitHub Pages
1+
# name: Deploy to GitHub Pages
22

3-
permissions:
4-
contents: write
5-
pages: write
3+
# permissions:
4+
# contents: write
5+
# pages: write
66

7-
on:
8-
push:
9-
branches: [ "main", "master" ]
10-
workflow_dispatch:
11-
jobs:
12-
deploy:
13-
runs-on: ubuntu-latest
14-
steps: [uses: fastai/workflows/quarto-ghp@master]
7+
# on:
8+
# push:
9+
# branches: [ "main", "master" ]
10+
# workflow_dispatch:
11+
# jobs:
12+
# deploy:
13+
# runs-on: ubuntu-latest
14+
# steps: [uses: fastai/workflows/quarto-ghp@master]

.github/workflows/test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: CI
2-
on: [workflow_dispatch, pull_request, push]
1+
# name: CI
2+
# on: [workflow_dispatch, pull_request, push]
33

4-
jobs:
5-
test:
6-
runs-on: ubuntu-latest
7-
steps: [uses: fastai/workflows/nbdev-ci@master]
4+
# jobs:
5+
# test:
6+
# runs-on: ubuntu-latest
7+
# steps: [uses: fastai/workflows/nbdev-ci@master]

conf/config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
defaults:
2+
- _self_
3+
- datapaths: datapaths
4+
15
query:
26
product_type: reanalysis
37
variable: ["2m_dewpoint_temperature", "2m_temperature", "skin_temperature"]
@@ -9,6 +13,7 @@ query:
913
data_format: netcdf
1014
download_format: unarchived
1115

16+
# logging config
1217
hydra:
1318
run:
1419
dir: logs/${now:%Y-%m-%d}/${now:%H-%M-%S}

conf/datapaths.yaml

Whitespace-only changes.

conf/datapaths/datapaths.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# if the files are stored in local, then paths are null
2+
input: null
3+
output: null

era5_sandbox/_modidx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'lib_path': 'era5_sandbox'},
88
'syms': { 'era5_sandbox.core': { 'era5_sandbox.core._expand_path': ('core.html#_expand_path', 'era5_sandbox/core.py'),
99
'era5_sandbox.core.describe': ('core.html#describe', 'era5_sandbox/core.py'),
10+
'era5_sandbox.core.main': ('core.html#main', 'era5_sandbox/core.py'),
1011
'era5_sandbox.core.testAPI': ('core.html#testapi', 'era5_sandbox/core.py')},
1112
'era5_sandbox.download': { 'era5_sandbox.download._validate_query': ( 'download_raw_data.html#_validate_query',
1213
'era5_sandbox/download.py'),

era5_sandbox/core.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# AUTOGENERATED! DO NOT EDIT! File to edit: ../notes/00_core.ipynb.
44

55
# %% auto 0
6-
__all__ = ['describe', 'testAPI']
6+
__all__ = ['describe', 'testAPI', 'main']
77

88
# %% ../notes/00_core.ipynb 3
99
import os
@@ -28,7 +28,6 @@ def _expand_path(
2828
return path
2929

3030
# %% ../notes/00_core.ipynb 5
31-
@hydra.main(version_base=None, config_path="../conf", config_name="config")
3231
def describe(
3332
cfg: DictConfig=None, # Configuration file
3433
)-> None:
@@ -41,7 +40,6 @@ def describe(
4140
print(OmegaConf.to_yaml(cfg))
4241

4342
# %% ../notes/00_core.ipynb 6
44-
@hydra.main(version_base=None, config_path="../conf", config_name="config")
4543
def testAPI(
4644
cfg: DictConfig=None,
4745
output_path:str=None,
@@ -92,3 +90,9 @@ def testAPI(
9290
print("Did you set up your API key with CDS? If not, please visit https://cds.climate.copernicus.eu/how-to-api#install-the-cds-api-client")
9391
print("Error: {}".format(e))
9492
return False
93+
94+
# %% ../notes/00_core.ipynb 10
95+
@hydra.main(version_base=None, config_path="../conf", config_name="config")
96+
def main(cfg: DictConfig) -> None:
97+
describe(cfg=cfg)
98+
testAPI(cfg=cfg)

notes/00_core.ipynb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"outputs": [],
7373
"source": [
7474
"#| export\n",
75-
"@hydra.main(version_base=None, config_path=\"../conf\", config_name=\"config\")\n",
7675
"def describe(\n",
7776
" cfg: DictConfig=None, # Configuration file\n",
7877
" )-> None:\n",
@@ -87,12 +86,11 @@
8786
},
8887
{
8988
"cell_type": "code",
90-
"execution_count": 21,
89+
"execution_count": null,
9190
"metadata": {},
9291
"outputs": [],
9392
"source": [
9493
"#| export\n",
95-
"@hydra.main(version_base=None, config_path=\"../conf\", config_name=\"config\")\n",
9694
"def testAPI(\n",
9795
" cfg: DictConfig=None,\n",
9896
" output_path:str=None,\n",
@@ -192,7 +190,7 @@
192190
"source": [
193191
"### Importing the Main Function\n",
194192
"\n",
195-
"Important: using main in nbdev is a little bit tricky. We need to define the main function in the module and then when we export the notebook to script, we need to add the `nbdev.imports.IN_NOTEBOOK` variable. This way, the main function will only be executed when we run the notebook and not when we import the module.\n",
193+
"Important: using `__main__` in nbdev and Hydra is a little bit tricky. We need to define the main function in the module ONLY ONCE and then when we export the notebook to script, we need to add the `nbdev.imports.IN_NOTEBOOK` variable. This way, the main function will only be executed when we run the notebook and not when we import the module.\n",
196194
"\n",
197195
"```python\n",
198196
"from nbdev.imports import IN_NOTEBOOK\n",
@@ -201,6 +199,19 @@
201199
"You'll see this listed throughout the notebooks."
202200
]
203201
},
202+
{
203+
"cell_type": "code",
204+
"execution_count": null,
205+
"metadata": {},
206+
"outputs": [],
207+
"source": [
208+
"#| export\n",
209+
"@hydra.main(version_base=None, config_path=\"../conf\", config_name=\"config\")\n",
210+
"def main(cfg: DictConfig) -> None:\n",
211+
" describe(cfg=cfg)\n",
212+
" testAPI(cfg=cfg)"
213+
]
214+
},
204215
{
205216
"cell_type": "code",
206217
"execution_count": null,
@@ -212,8 +223,7 @@
212223
"except: IN_NOTEBOOK=False\n",
213224
"\n",
214225
"if __name__ == \"__main__\" and not IN_NOTEBOOK:\n",
215-
" # for testing\n",
216-
" describe()"
226+
" main()"
217227
]
218228
},
219229
{

0 commit comments

Comments
 (0)