File tree 8 files changed +459
-1
lines changed
8 files changed +459
-1
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,6 @@ wheels/
10
10
.venv
11
11
12
12
.idea
13
+ generated-indicators *
14
+ output *
15
+ inputs *
Original file line number Diff line number Diff line change
1
+ FROM amazonlinux:latest
2
+
3
+ # Install dependencies
4
+ RUN yum install -y awscli
5
+
6
+ # Set working directory
7
+ WORKDIR /app
8
+
9
+ # Copy the Bash script into the container
10
+ COPY prepare-output.sh /prepare-output.sh
11
+
12
+ # Ensure script is executable
13
+ RUN chmod +x /prepare-output.sh
14
+
15
+ # Set entrypoint to use the script
16
+ ENTRYPOINT ["bash" , "/prepare-output.sh" ]
Original file line number Diff line number Diff line change
1
+ cwlVersion: v1.2
2
+ $graph:
3
+ - class: Workflow
4
+ id : fetch-hazard-indicator
5
+ label : Fetch a hazard indicator from S3
6
+ doc : Fetch a hazard indicator produced with os_climate_hazard
7
+ requirements :
8
+ ResourceRequirement:
9
+ coresMax : 2
10
+ ramMax : 4096
11
+
12
+ inputs :
13
+ hazard_indicator_key:
14
+ type : string
15
+ default : ""
16
+ aws_access_key_id:
17
+ type : string
18
+ default : ""
19
+ aws_secret_access_key:
20
+ type : string
21
+ default : ""
22
+ aws_session_token:
23
+ type : string
24
+ default : ""
25
+
26
+ outputs :
27
+ - id : fetched-indicator
28
+ type : Directory
29
+ outputSource :
30
+ - fetch-indicator-step/indicator-results
31
+
32
+ steps :
33
+ fetch-indicator-step:
34
+ run : "#fetch-indicator-command"
35
+ in :
36
+ hazard_indicator_key: hazard_indicator_key
37
+ aws_access_key_id: aws_access_key_id
38
+ aws_secret_access_key: aws_secret_access_key
39
+ aws_session_token: aws_session_token
40
+ out :
41
+ - indicator-results
42
+
43
+
44
+ - class: CommandLineTool
45
+ id : fetch-indicator-command
46
+
47
+ hints :
48
+ DockerRequirement:
49
+ dockerPull: indicator-fetching:latest
50
+
51
+ requirements :
52
+ ResourceRequirement:
53
+ coresMax : 2
54
+ ramMax : 4096
55
+ NetworkAccess:
56
+ networkAccess: true
57
+ EnvVarRequirement:
58
+ envDef :
59
+ AWS_ACCESS_KEY_ID: $(inputs.aws_access_key_id)
60
+ AWS_SECRET_ACCESS_KEY: $(inputs.aws_secret_access_key)
61
+ AWS_SESSION_TOKEN: $(inputs.aws_session_token)
62
+ AWS_DEFAULT_REGION: "eu-west-2"
63
+
64
+ inputs :
65
+ hazard_indicator_key:
66
+ type : string
67
+ aws_access_key_id:
68
+ type : string
69
+ aws_secret_access_key:
70
+ type : string
71
+ aws_session_token:
72
+ type : string
73
+
74
+ outputs :
75
+ indicator-results:
76
+ type : Directory
77
+ outputBinding :
78
+ glob : output
79
+
80
+ baseCommand : ["prepare-output. sh" ]
81
+
82
+ arguments :
83
+ - valueFrom : $(inputs.hazard_indicator_key)
Original file line number Diff line number Diff line change
1
+ import json
2
+ import sys
3
+
4
+ def main (input_path ):
5
+ with open (input_path , "r" ) as f :
6
+ jase = json .load (f )
7
+ print ('"' + json .dumps (jase ).replace ('"' , '\\ "' ) + '"' )
8
+
9
+ if __name__ == '__main__' :
10
+ main (sys .argv [1 ])
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ VALUE=" $2 "
4
+ SRC_BUCKET=" ukri-eodh-hazard-tiles-test"
5
+ SRC_PATH=" indicator-generation/$VALUE "
6
+ DEST_DIR=" output"
7
+
8
+ # Create output directory if it doesn't exist
9
+ mkdir -p " $DEST_DIR "
10
+
11
+ # Sync data from S3
12
+ aws s3 cp " s3://$SRC_BUCKET /$SRC_PATH /" " $DEST_DIR /" --recursive --exclude " *" \
13
+ --include " cubified/*" \
14
+ --include " days_tas_above_*.json" \
15
+ --include " degree_days_*.json" \
16
+ --include " collection.json"
17
+
18
+ echo " Files have been organized into '$DEST_DIR '."
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ dependencies = [
9
9
" stactools-osc-hazard" ,
10
10
" typer>=0.15.2" ,
11
11
" cf-xarray==0.9.4" ,
12
- " xarray==2023.1.0"
12
+ " xarray==2023.1.0" ,
13
+ " cwltool>=3.1.20250110105449" ,
13
14
]
14
15
15
16
[tool .uv .sources ]
You can’t perform that action at this time.
0 commit comments