download.cwl

 1#!/usr/bin/env cwl-runner
 2### Downloader of gridMET 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: [wget]
25
26requirements:
27  InlineJavascriptRequirement: {}
28  ResourceRequirement:
29    coresMin: 0.5
30  EnvVarRequirement:
31    envDef:
32      HTTP_PROXY: "$('proxy' in inputs? inputs.proxy: null)"
33      HTTPS_PROXY: "$('proxy' in inputs? inputs.proxy: null)"
34      NO_PROXY: "localhost,127.0.0.1,172.17.0.1"
35
36doc: |
37  This tool downloads gridMET data from Atmospheric Composition Analysis Group
38
39
40inputs:
41  proxy:
42    type: string?
43    default: ""
44    doc: HTTP/HTTPS Proxy if required
45  year:
46    type: string
47    doc: "Year to process"
48  band:
49    type: string
50    doc: |
51      [Gridmet Band](https://developers.google.com/earth-engine/datasets/catalog/IDAHO_EPSCOR_GRIDMET#bands)
52
53arguments:
54  - position: 1
55    valueFrom: "-d"
56  - position: 2
57    valueFrom: $("-e https_proxy=" + inputs.proxy)
58  - position: 3
59    valueFrom: |
60      ${
61          var base = "https://www.northwestknowledge.net/metdata/data/";
62          return base + inputs.band + "_" + inputs.year + ".nc";
63      }
64
65outputs:
66  log:
67    type: File?
68    outputBinding:
69      glob: "*.log"
70  data:
71    type: File?
72    outputBinding:
73      glob: "*.nc"
74  errors:
75    type: stderr
76
77stderr:  $("wget-" + inputs.band + "-" + inputs.year + ".err")