Skip to content

Commit 3015aa4

Browse files
committed
old code in a repo
0 parents  commit 3015aa4

File tree

930 files changed

+1444513
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

930 files changed

+1444513
-0
lines changed

BVOCs/.ipynb_checkpoints/AliceHOlt_JULES_function_with_site_drive-checkpoint.ipynb

+407
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 2,
6+
"metadata": {
7+
"collapsed": true
8+
},
9+
"outputs": [],
10+
"source": [
11+
"import netCDF4 as nc\n",
12+
"import numpy as np\n"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 3,
18+
"metadata": {
19+
"collapsed": true
20+
},
21+
"outputs": [],
22+
"source": [
23+
"BASE_DIR='/prj/wetlands_africa/jules/JASMIN/BVOCs/SITE_DATA/'\n",
24+
"\n",
25+
"infile=BASE_DIR+'Isoprene_Flux_AuchencorthMoss_2015.csv'\n",
26+
"outfile=BASE_DIR+'Isoprene_Flux_AuchencorthMoss_2015.nc'\n",
27+
"\n",
28+
"#infile=BASE_DIR+'Isoprene_Flux_AliceHolt_2005.csv'\n",
29+
"#outfile=BASE_DIR+'Isoprene_Flux_AliceHolt_2005.nc'\n",
30+
"\n",
31+
"fill_value=-999.\n",
32+
"out_time_units='seconds since 2000-01-01 00:00:00'\n"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": 4,
38+
"metadata": {
39+
"collapsed": true
40+
},
41+
"outputs": [],
42+
"source": [
43+
"inlines=open(infile,'r').readlines()\n",
44+
"headers=inlines.pop(0).split(',')"
45+
]
46+
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": 5,
50+
"metadata": {
51+
"collapsed": false
52+
},
53+
"outputs": [
54+
{
55+
"name": "stdout",
56+
"output_type": "stream",
57+
"text": [
58+
"['Date & Time [UTC]', 'DOY', 'Temperature [C]', 'PAR [umol m-2 s-1]', 'Isoprene Flux [ug m-2 h-1]', 'Isoprene Flux Random Error [ug m-2 h-1]', 'Isoprene Concentration [ug m-3]\\n']\n"
59+
]
60+
}
61+
],
62+
"source": [
63+
"print(headers)\n",
64+
"short_headers=['time','t','par','isoprene','isoprene_err','isoprene_mmr']\n",
65+
"units=[out_time_units,'C','umol m-2 s-1','ug m-2 h-1','ug m-2 h-1','ug m-3']"
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": 6,
71+
"metadata": {
72+
"collapsed": false
73+
},
74+
"outputs": [],
75+
"source": [
76+
"DataDict={ hdr:[] for hdr in short_headers }\n",
77+
"for line in inlines:\n",
78+
" split=line[:-1].split(',')\n",
79+
" DataDict['time'].append(nc.datetime.strptime(split[0],'%d/%m/%Y %H:%M'))\n",
80+
" for hdr,val in zip(short_headers[1:],split[2:]):\n",
81+
" if val != '':\n",
82+
" DataDict[hdr].append(float(val))\n",
83+
" else:\n",
84+
" DataDict[hdr].append(fill_value)\n",
85+
" "
86+
]
87+
},
88+
{
89+
"cell_type": "code",
90+
"execution_count": 7,
91+
"metadata": {
92+
"collapsed": false
93+
},
94+
"outputs": [],
95+
"source": [
96+
"outf=nc.Dataset(outfile,'w')\n",
97+
"outf.createDimension('time',len(DataDict['time']))\n",
98+
"\n",
99+
"for var,unit in zip(short_headers,units):\n",
100+
" outvar=outf.createVariable(var,'float32',('time'),fill_value=fill_value)\n",
101+
" outvar.units=unit\n",
102+
" \n",
103+
" if var == 'time':\n",
104+
" outvar[:] = nc.date2num(DataDict[var],units=out_time_units)\n",
105+
" else:\n",
106+
" outvar[:]=DataDict[var]\n",
107+
"\n",
108+
"outf.title='Alice Holt Isoprene Flux Data'\n",
109+
"outf.owner='Ben Langford'\n",
110+
"outf.converted_by='Edward Comyn-Platt ([email protected])'\n",
111+
"outf.close()\n",
112+
" "
113+
]
114+
},
115+
{
116+
"cell_type": "code",
117+
"execution_count": 8,
118+
"metadata": {
119+
"collapsed": false
120+
},
121+
"outputs": [
122+
{
123+
"ename": "RuntimeError",
124+
"evalue": "NetCDF: Not a valid ID",
125+
"output_type": "error",
126+
"traceback": [
127+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
128+
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
129+
"\u001b[0;32m<ipython-input-8-6e2e6550ee10>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0moutf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
130+
"\u001b[0;32mnetCDF4/_netCDF4.pyx\u001b[0m in \u001b[0;36mnetCDF4._netCDF4.Dataset.close (netCDF4/_netCDF4.c:15059)\u001b[0;34m()\u001b[0m\n",
131+
"\u001b[0;31mRuntimeError\u001b[0m: NetCDF: Not a valid ID"
132+
]
133+
}
134+
],
135+
"source": [
136+
"outf.close()"
137+
]
138+
},
139+
{
140+
"cell_type": "code",
141+
"execution_count": null,
142+
"metadata": {
143+
"collapsed": true
144+
},
145+
"outputs": [],
146+
"source": []
147+
}
148+
],
149+
"metadata": {
150+
"kernelspec": {
151+
"display_name": "Python 3",
152+
"language": "python",
153+
"name": "python3"
154+
},
155+
"language_info": {
156+
"codemirror_mode": {
157+
"name": "ipython",
158+
"version": 3
159+
},
160+
"file_extension": ".py",
161+
"mimetype": "text/x-python",
162+
"name": "python",
163+
"nbconvert_exporter": "python",
164+
"pygments_lexer": "ipython3",
165+
"version": "3.5.2"
166+
}
167+
},
168+
"nbformat": 4,
169+
"nbformat_minor": 0
170+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 0
6+
}

BVOCs/.ipynb_checkpoints/MEGAN_Investigation-checkpoint.ipynb

+286
Large diffs are not rendered by default.

BVOCs/.ipynb_checkpoints/Plot_Site_BVOC_runs-checkpoint.ipynb

+365
Large diffs are not rendered by default.

BVOCs/.ipynb_checkpoints/Plot_Site_BVOC_runs_Bosco-checkpoint.ipynb

+365
Large diffs are not rendered by default.

BVOCs/.ipynb_checkpoints/Plot_Site_MetData_Bosco-checkpoint.ipynb

+362
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)