-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathget_sitelist_simsuite.py
More file actions
47 lines (43 loc) · 1.67 KB
/
get_sitelist_simsuite.py
File metadata and controls
47 lines (43 loc) · 1.67 KB
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
46
47
import pandas
import os
import os.path
##--------------------------------------------------------------------
## Simulation suite
## - "swissface"
## - "fluxnet"
## - "fluxnet2015"
## - "fluxnet_cnmodel"
## - "gcme"
## - "campi"
## - "campi_cmodel"
## - "fluxnet_fixalloc"
## - "atkin"
## - "atkinfull"
## - "olson"
## - "olson_cmodel"
##--------------------------------------------------------------------
## For global simulations, set simsuite to 'global'.
## This links NetCDF input files from directories mirrored locally from
## /work/bstocker/labprentice/data on Imperial's HPC CX1 server into the
## input directory structure required for SOFUN.
##--------------------------------------------------------------------
## For an example simulation (simulation name 'EXAMPLE_global'), set
## simsuite to 'example'. This should work after cloning this repo
## from github.
##--------------------------------------------------------------------
simsuite = 'fluxnet2015'
##--------------------------------------------------------------------
## Get site/experiment names
##--------------------------------------------------------------------
filnam_siteinfo_csv = '../input_' + simsuite + '_sofun/experiments_' + simsuite + '_sofun.csv'
if os.path.exists( filnam_siteinfo_csv ):
print 'reading site information file ' + filnam_siteinfo_csv + ' ...'
siteinfo = pandas.read_csv( filnam_siteinfo_csv )
elif simsuite == 'example':
print 'Executing single example simulation...'
else:
print 'site info file does not exist: ' + filnam_siteinfo_csv
print 'writing file sitelist.txt'
fil = open('sitelist.txt', 'w')
for index, row in siteinfo.iterrows():
fil.write( row['expname'] + '\n' )