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