download_airnow.cwl

 1#!/usr/bin/env cwl-runner
 2### Downloader of AirNow Data
 3#  Copyright (c) 2021. Harvard University
 4#
 5#  Developed by Research Software Engineering,
 6#  Faculty of Arts and Sciences, Research Computing (FAS RC)
 7#  Author: Michael A Bouzinier
 8#
 9#  Licensed under the Apache License, Version 2.0 (the "License");
10#  you may not use this file except in compliance with the License.
11#  You may obtain a copy of the License at
12#
13#         http://www.apache.org/licenses/LICENSE-2.0
14#
15#  Unless required by applicable law or agreed to in writing, software
16#  distributed under the License is distributed on an "AS IS" BASIS,
17#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18#  See the License for the specific language governing permissions and
19#  limitations under the License.
20#
21
22cwlVersion: v1.2
23class: CommandLineTool
24baseCommand: [python, -m, dorieh.epa.airnow]
25requirements:
26  InlineJavascriptRequirement: {}
27  EnvVarRequirement:
28    envDef:
29      HTTPS_PROXY: $(inputs.proxy)
30      HTTP_PROXY: $(inputs.proxy)
31
32doc: |
33  This tool downloads AirNow data from EPA website
34
35# -p pm25 --dest airnow_pm25.json.gz --from 2020-12-25 --to 2020-12-31 --qc
36inputs:
37  proxy:
38    type: string?
39    default: ""
40    doc: HTTP/HTTPS Proxy if required
41  parameter_code:
42    type: string
43    doc: |
44      Parameter code. Either a numeric code (e.g. 88101, 44201)
45      or symbolic name (e.g. PM25, NO2).
46      See more: [AQS Code List](https://www.epa.gov/aqs/aqs-code-list)
47    inputBinding:
48      prefix: --parameters
49  from:
50    type: string
51    doc: Start date for downolading, in YYYY-MM-DD format
52    inputBinding:
53      prefix: --from
54  to:
55    type: string
56    doc: End date for downolading, in YYYY-MM-DD format
57    inputBinding:
58      prefix: --to
59  shapes:
60    type: File[]
61    inputBinding:
62      prefix: --shapes
63    secondaryFiles:
64      - "^.dbf"
65      - "^.shx"
66      - "^.prj"
67      - "^.cpg"
68  table:
69    type: string
70    doc: the name of the table to be created
71  api-key:
72    type: string?
73    inputBinding:
74      prefix: --api_key
75
76arguments:
77    - valueFrom: "--qc"
78    - valueFrom: $(inputs.table + ".json.gz")
79      prefix: --destination
80
81
82outputs:
83  log:
84    type: File
85    outputBinding:
86      glob: "*.log"
87  data:
88    type: File
89    outputBinding:
90      glob: "*.json*"