Skip to content

Commit 12f3017

Browse files
committed
Merging
2 parents 002e347 + e1f5eea commit 12f3017

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2017
-477
lines changed

.github/workflows/deploy.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
name: "Build a Docker image for deployment"
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- 'v*'
10+
workflow_dispatch:
11+
inputs:
12+
logLevel:
13+
description: 'Log level'
14+
required: true
15+
default: 'warning'
16+
type: choice
17+
options:
18+
- info
19+
- warning
20+
- debug
21+
22+
jobs:
23+
release:
24+
runs-on: ubuntu-latest
25+
26+
# env...
27+
env:
28+
REGISTRY: ghcr.io
29+
IMAGE_NAME: ${{ github.repository }}
30+
31+
steps:
32+
- name: Maximize build space
33+
uses: easimon/maximize-build-space@master
34+
with:
35+
swap-size-mb: 4096
36+
temp-reserve-mb: 4096
37+
root-reserve-mb: 16384
38+
remove-dotnet: 'true'
39+
remove-android: 'true'
40+
remove-haskell: 'true'
41+
42+
- uses: actions/checkout@v3
43+
44+
- name: Log in to the Container registry
45+
uses: docker/login-action@v2
46+
with:
47+
registry: ${{ env.REGISTRY }}
48+
username: ${{ github.repository_owner }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Extract metadata (tags, labels) for Docker
52+
id: meta
53+
uses: docker/metadata-action@v4
54+
with:
55+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
56+
tags: |
57+
type=ref,event=branch
58+
type=ref,event=pr
59+
type=semver,pattern={{version}}
60+
type=semver,pattern={{major}}.{{minor}}
61+
type=semver,pattern=latest
62+
63+
- name: Set up Docker Buildx
64+
id: buildx
65+
uses: docker/setup-buildx-action@v2
66+
67+
- name: Builder instance name
68+
run: echo ${{ steps.buildx.outputs.name }}
69+
70+
- name: Available platforms
71+
run: echo ${{ steps.buildx.outputs.platforms }}
72+
73+
- name: Cache Docker layers
74+
uses: actions/cache@v3
75+
with:
76+
path: /tmp/.buildx-cache
77+
key: ${{ runner.os }}-buildx-${{ github.sha }}
78+
restore-keys: |
79+
${{ runner.os }}-buildx-
80+
81+
#
82+
- name: Build and Push the image
83+
id: docker_push
84+
uses: docker/build-push-action@v4
85+
with:
86+
context: ./
87+
file: ./Dockerfile
88+
builder: ${{ steps.buildx.outputs.name }}
89+
push: true
90+
tags: ${{ steps.meta.outputs.tags }}
91+
labels: ${{ steps.meta.outputs.labels }}
92+
cache-from: type=local,src=/tmp/.buildx-cache
93+
cache-to: type=local,dest=/tmp/.buildx-cache-new
94+
95+
# Needed to prevent cache from growing forever (see https://github.com/docker/build-push-action/issues/252)
96+
- name: Move cache
97+
run: |
98+
rm -rf /tmp/.buildx-cache
99+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile ~/.gitignore_global
6+
7+
/log
8+
/tmp
9+
tmp/*
10+
rerun.txt
11+
*.DS_Store
12+
.project
13+
.docker-sync
14+
.envrc
15+
.vscode
16+
17+
# Ignore pow environment settings
18+
.powenv

DRAW-post-processing/config.py

Lines changed: 59 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,60 @@
44

55
# assigning post-process ID's to field ID's
66
# assign a TUPLE to multiple field_id's with one PPID; otherwise assign integer for single field_id
7+
# 1: pressure(in_hg), 2: vapour pressure(in_Hg), 3:temperature (F), 4: precipitation (in), 5: direction, 6: velocity (miles), 7: weather, 8: cloud type, 9:time, 10: RH (%), 11: cloud cover (tenths), 12 :various (character)
78
ppid_to_field_id = {1: (4, 6, 7, 8, 67, 69),
89
2: 14,
9-
3: (5,9,10,11,12,13,36,37,38,39,63,64,68,76,77,78,79),
10-
4: (25, 26, 27, 28, 29, 30, 31, 50, 70, 71),
11-
5: (16, 17, 22, 23, 24, 53, 54),
12-
6: (19, 20, 21, 34, 35, 48, 61, 85),
13-
7: (18, 40, 41, 44, 51, 52, 56, 57, 66, 80, 82, 83)}
14-
15-
sef_type_to_field_id ={ "atb": (5,68),
16-
"au": (47),
17-
"cl":(22,53),
18-
"cd":(23),
19-
"ch":(16,54),
20-
"dd":(19),
21-
"e":(14),
22-
"hd":(17),
23-
"mslp":(7),
24-
"nl":(24),
25-
"p": (4,67),
26-
"p_cor":(7,69),
27-
"pr":(27,31),
28-
"ptb":(25,28),
29-
"pte":(26,29),
30-
"rh":(15,58,59,73,75,60,72),
31-
"rrt":(66),
32-
"sd":(50),
33-
"rain_dur":(70),
34-
"snow_dur":(71),
35-
"ss":(65),
36-
"ta":9,
37-
"ta_cor":(10),
38-
"tb":(11),
39-
"tb_cor":(12),
40-
"td":(33),
41-
"TGn":(62,81),
42-
"Tn":(38,76),
43-
"Tn_cor":(37,77),
44-
"Tx":(36,78),
45-
"Tx_cor":(37,79),
46-
"Tsx":(63,64),
47-
"wf":(85),
48-
"w":(34,48,35),
49-
"ws":(20),
50-
"ww":(18,52,40,44,57,56,80,83),
51-
"w2":(51,41,82)
52-
}
53-
sef_type_to_unit={ "atb": "C",
10+
3: (5, 9, 10, 11, 12, 13, 33, 36, 37, 38, 39, 62, 63, 64, 68, 76, 77, 78, 79, 81),
11+
4: (27, 30, 31, 50),
12+
5: (17, 19, 23),
13+
6: (20),
14+
7: (18, 40, 41, 44, 51, 52, 56, 57, 66, 80, 82, 83),
15+
8: (16, 22, 53, 54),
16+
9: (25, 26, 28, 29, 46, 65, 70, 71),
17+
10: (15, 58, 59, 60, 72, 74, 75),
18+
11: (24),
19+
12: (21, 61, 42, 47, 66),
20+
13: (34, 35, 48)}
21+
22+
sef_type_to_field_id = {"atb": (5, 68),
23+
"au": (47),
24+
"cl": (22, 53),
25+
"cd": (23),
26+
"ch": (16, 54),
27+
"dd": (19),
28+
"e": (14),
29+
"hd": (17),
30+
"mslp": (7),
31+
"nl": (24),
32+
"p": (4, 67),
33+
"p_cor": (7, 69),
34+
"pr": (27, 31),
35+
"ptb": (25, 28),
36+
"pte": (26, 29),
37+
"rh": (15, 58, 59, 73, 75, 60, 72),
38+
"rrt": (66),
39+
"sd": (50),
40+
"rain_dur": (70),
41+
"snow_dur": (71),
42+
"ss": (65),
43+
"ta": (9),
44+
"ta_cor": (10),
45+
"tb": (11),
46+
"tb_cor": (12),
47+
"td": (33),
48+
"TGn": (62, 81),
49+
"Tn": (38, 76),
50+
"Tn_cor": (37, 77),
51+
"Tx": (36, 78),
52+
"Tx_cor": (37, 79),
53+
"Tsx": (63, 64),
54+
"wf": (85),
55+
"w": (34, 48, 35),
56+
"ws": (20),
57+
"ww": (18, 52, 40, 44, 57, 56, 80, 83),
58+
"w2": (51, 41, 82)
59+
}
60+
sef_type_to_unit={"atb": "C",
5461
"au": "text",
5562
"cl":"lct",
5663
"cd":"dir",
@@ -165,23 +172,26 @@ def possible_pressure_formats(value, for_leading_digits):
165172

166173
temperature_min = -100.0
167174
temperature_max= {
168-
"5": 100,
175+
"5": 100,
169176
"9": 120,
170177
"10": 120,
171-
"11": 110,
178+
"11": 110,
172179
"12": 110,
173180
"13": 110,
181+
"33": 130,
174182
"36": 130,
175183
"37": 130,
176184
"38": 100,
177185
"39": 100,
186+
"62": 130,
178187
"63": 160,
179188
"64": 160,
180189
"68": 100,
181190
"76": 100,
182191
"77": 100,
183192
"78": 130,
184-
"79": 130
193+
"79": 130,
194+
"81": 130
185195
}
186196

187197

@@ -202,7 +212,7 @@ def possible_pressure_formats(value, for_leading_digits):
202212
temperature_air_wet_bulb=[[9,11,13],[10,12,13]] #same observation time: abs(abs(field[0]-field[1])-abs(field[2]))<air_wet_bulb_threshold
203213

204214
# temperature fields to detect stat outliers
205-
temperature_stat_outliers=[9,10]
215+
temperature_stat_outliers=[9,10]
206216

207217
#define whether to display or not graphs for outliers
208218
temperature_plot_outliers=False

DRAW-post-processing/database_connection.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@
1010
phase_2_errors=[]
1111
duplicateless=[]
1212

13+
#
1314
db_user=os.environ.get('DRAW_local_db_user')
1415
db_passwd=os.environ.get('DRAW_local_db_pass')
1516
db_name=os.environ.get('DRAW_local_db_name')
16-
db_host=os.environ.get('DRAW_db_host')
17+
db_host=os.environ.get('DRAW_db_host',"127.0.0.1")
18+
db_port=os.environ.get('DRAW_db_port',"3306")
1719

1820
# connection to copy of database on local machine
1921
conn = mysql.connector.connect(
2022
##### FOLLOWING 3 VARIABLES TO BE CONFIGURED AS NECESSARY FOR LOCAL MACHINE: #####
2123
user=db_user,
2224
password=db_passwd,
2325
database=db_name,
24-
host=db_host
26+
host=db_host,
27+
port=db_port
2528
)
2629

2730
cursor = conn.cursor()
2831

29-
url = "mysql+mysqlconnector://"+db_user+":"+db_passwd+"@"+db_host+"/"+db_name
32+
33+
# Problem? dialect+driver://username:password@host:port/database
34+
url = "mysql+mysqlconnector://"+db_user+":"+db_passwd+"@"+db_host+":"+db_port+"/"+db_name
35+
3036
engine = sqlalchemy.create_engine(url)
3137

3238

0 commit comments

Comments
 (0)