forked from andrejsim/ClimExp-pyapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclimexp_pyapi.py
More file actions
45 lines (29 loc) · 935 Bytes
/
climexp_pyapi.py
File metadata and controls
45 lines (29 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Climate Explorer KNMI Python Binding
# author: Andrej
# python api
import os
import bind
# generated
# fortran build location / add as env in docker...
try:
location = os.environ['CLIMEXPFORTRAN']
except Exception, e:
location = '../Fortran/build/'
#http://climexp.knmi.nl/fieldcorrseries.cgi?id=someone@somewhere&field=ghcn_cams_05
def correlatefield(inputs):
try:
sourceA = inputs["netcdf_source1"]["default"]
sourceB = inputs["netcdf_source2"]["default"]
freq = inputs["frequency"]["default"]
ratio = inputs["ratio"]["default"]
ave = inputs["average"]["default"]
var = inputs["var"]["default"]
target = inputs["netcdf_target"]["default"]
fortran = 'correlatefield'
script = location+fortran+' '+sourceA+' '+sourceB+' '+freq+' '+ratio+' '+ave+' '+var+' '+str(target)
bind.execute(script)
except Exception, e:
raise e
# GENERATE HERE...
# test
# see test-climexp-pyapi.py