Skip to content

Commit

Permalink
update config files for forge-py add pytest to test configs make sure…
Browse files Browse the repository at this point in the history
… valid json
  • Loading branch information
sliu008 committed Nov 11, 2024
1 parent 5113016 commit 3534a54
Show file tree
Hide file tree
Showing 15 changed files with 173 additions and 49 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,32 @@ on:
workflow_dispatch:

jobs:

test:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run pytest
run: pytest

# First job in the workflow installs and verifies the software
deploy_sit:
name: Deploy SIT
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: test

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand All @@ -38,6 +59,7 @@ jobs:
name: Deploy UAT
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: test

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand All @@ -61,6 +83,7 @@ jobs:
name: Deploy OPS
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: test

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/test_configs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test Configs

on:
push:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run pytest
run: pytest
17 changes: 10 additions & 7 deletions config-files/AVHRR19_G-NAVO-L2P-v1.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
]
},
"footprint": {
"alpha": 0.06,
"thinning_fac": 220,
"cutoff_lat": 80,
"smooth_poles": [
78,
80
]
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.06,
"thinning": {
"method": "standard",
"value": 220
},
"cutoff_lat": 80,
"smooth_poles": [78,80]
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
17 changes: 10 additions & 7 deletions config-files/AVHRRMTA_G-NAVO-L2P-v1.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
]
},
"footprint": {
"alpha": 0.035,
"thinning_fac": 300,
"cutoff_lat": 80,
"smooth_poles": [
78,
80
]
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.035,
"thinning": {
"method": "standard",
"value": 300
},
"cutoff_lat": 80,
"smooth_poles": [78,80]
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
17 changes: 10 additions & 7 deletions config-files/AVHRRMTA_G-NAVO-L2P-v2.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
]
},
"footprint": {
"alpha": 0.04,
"thinning_fac": 200,
"cutoff_lat": 80,
"smooth_poles": [
78,
80
]
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.04,
"thinning": {
"method": "standard",
"value": 200
},
"cutoff_lat": 80,
"smooth_poles": [78,80]
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
17 changes: 10 additions & 7 deletions config-files/AVHRRMTB_G-NAVO-L2P-v1.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
]
},
"footprint": {
"alpha": 0.03,
"thinning_fac": 240,
"cutoff_lat": 80,
"smooth_poles": [
78,
80
]
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.03,
"thinning": {
"method": "standard",
"value": 240
},
"cutoff_lat": 80,
"smooth_poles": [78,80]
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
12 changes: 9 additions & 3 deletions config-files/COWVR_STPH8_L1_TSDR_V10.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"lonVar": "obs_lon",
"is360": false,
"footprint": {
"thinning_fac": 200,
"alpha": 0.03,
"group": "GeolocationAndFlags"
"strategy": "alpha_shape",
"alpha_shape":{
"thinning": {
"value": "200",
"method" : "standard"
},
"alpha": 0.03,
"group": "GeolocationAndFlags"
}
},
"footprinter": "forge-py"
}
12 changes: 9 additions & 3 deletions config-files/COWVR_STPH8_L1_TSDR_V9.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"lonVar": "obs_lon",
"is360": false,
"footprint": {
"thinning_fac": 200,
"alpha": 0.03,
"group": "GeolocationAndFlags"
"strategy": "alpha_shape",
"alpha_shape":{
"thinning": {
"value": "200",
"method" : "standard"
},
"alpha": 0.03,
"group": "GeolocationAndFlags"
}
},
"footprinter": "forge-py"
}
12 changes: 9 additions & 3 deletions config-files/COWVR_STPH8_L2_EDR_V10.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"lonVar": "obs_lon",
"is360": false,
"footprint": {
"thinning_fac": 200,
"alpha": 0.03,
"group": "GeolocationAndFlags"
"strategy": "alpha_shape",
"alpha_shape":{
"thinning": {
"value": "200",
"method" : "standard"
},
"alpha": 0.03,
"group": "GeolocationAndFlags"
}
},
"footprinter": "forge-py"
}
12 changes: 9 additions & 3 deletions config-files/COWVR_STPH8_L2_EDR_V9.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"lonVar": "obs_lon",
"is360": false,
"footprint": {
"thinning_fac": 200,
"alpha": 0.03,
"group": "GeolocationAndFlags"
"strategy": "alpha_shape",
"alpha_shape":{
"thinning": {
"value": [1, 1],
"method" : "bin_avg"
},
"alpha": 0.03,
"group": "GeolocationAndFlags"
}
},
"footprinter": "forge-py"
}
10 changes: 8 additions & 2 deletions config-files/PRIM_SMAP_L2_V1.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
]
},
"footprint": {
"alpha": 0.35,
"thinning_fac": 4
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.35,
"thinning": {
"method": "standard",
"value": 4
}
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
10 changes: 8 additions & 2 deletions config-files/SCATSAT1_ESDR_L2_WIND_STRESS_V1.1.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
]
},
"footprint": {
"thinning_fac": 30,
"alpha": 0.035
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.035,
"thinning": {
"method": "standard",
"value": 30
}
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
11 changes: 8 additions & 3 deletions config-files/SMAP_RSS_L2_SSS_V5.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
"lonVar": "cellon",
"timeVar": "time",
"is360": true,
"tolerance": 0.4,
"footprint": {
"alpha": 0.03,
"thinning_fac": 30
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.03,
"thinning": {
"method": "bin_avg",
"value": [1.5, 1.5]
}
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
10 changes: 8 additions & 2 deletions config-files/SMAP_RSS_L2_SSS_V6.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
]
},
"footprint": {
"alpha": 0.03,
"thinning_fac": 30
"strategy": "alpha_shape",
"alpha_shape": {
"alpha": 0.03,
"thinning": {
"method": "standard",
"value": 30
}
}
},
"footprinter": "forge-py",
"imgVariables": [
Expand Down
17 changes: 17 additions & 0 deletions test_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import json
import pytest

# Directory containing the configuration files
CONFIG_DIR = 'config-files'

@pytest.mark.parametrize("config_file", [
os.path.join(CONFIG_DIR, f) for f in os.listdir(CONFIG_DIR) if f.endswith('.cfg')
])
def test_json_loadable(config_file):
"""Test if a configuration file can be loaded as JSON."""
with open(config_file, 'r') as f:
try:
json.load(f)
except json.JSONDecodeError as e:
pytest.fail(f"Failed to load JSON from {config_file}: {e}")

0 comments on commit 3534a54

Please sign in to comment.