-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_atm.py
79 lines (60 loc) · 2.45 KB
/
run_atm.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
import sys, random, argparse
sys.path.append('../reconstruction')
sys.path.append('../utils')
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
from reconstruct_atom_data import *
from pyatom import Atmosphere, Hydrosphere
import create_atm_maps, create_hyd_maps
import time
timestart_time = time.time()
from datetime import datetime
start_time_computer = datetime.now()
print('\n\n\n')
print(' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Atmosphere General Circulation Model %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \n')
print('\n')
print('\n' + ' ... run_atm.py: date and time at run time begin: \n'
+ ' ... {0}'.format(start_time_computer))
atm_model = Atmosphere()
atm_model.load_config( './config_atm.xml' )
start_time = atm_model.time_start
end_time = atm_model.time_end
time_step = atm_model.time_step
print('\n')
print('\n' + ' ... run_atm.py: computed time range: \n'
+ ' ... start time = {0} \n ... end time = {1} \n ... time step = {2}'
.format(start_time, end_time, time_step))
times = range(start_time, end_time+1, time_step)
atom_output_dir = atm_model.output_path
BATHYMETRY_SUFFIX = 'Ma_smooth.xyz'
for t in range(len(times)):
time = times[t]
atm_model.run_time_slice(time)
if t<len(times)-1:
reconstruct_temperature(time,times[t+1], BATHYMETRY_SUFFIX)
# reconstruct_precipitation(time,times[t+1], BATHYMETRY_SUFFIX)
# reconstruct_salinity(time,times[t+1], BATHYMETRY_SUFFIX)
# reconstruct_wind_v(time,times[t+1], BATHYMETRY_SUFFIX)
# reconstruct_wind_w(time,times[t+1], BATHYMETRY_SUFFIX)
end_time_computer = datetime.now()
print('\n')
print('\n' + ' ... run_atm.py: date and time at run time end: \n'
+ ' ... {0}'.format(end_time_computer))
print('\n' + ' ... run_atm.py: duration of run time in hours, minutes and seconds: {}'
.format(end_time_computer - start_time_computer))
print('\n\n\n')
try:
topo_dir = '../data/topo_grids/'
topo_suffix = 'smooth'
atm_map_output_dir = './atm_maps'
atm_sub_dirs = ['temperature','v_velocity','w_velocity', 'water_vapour', 'precipitation',
'precipitable_water', 'topography', 'velocity', 'evaporation']
create_atm_maps.create_all_maps(atm_sub_dirs, start_time, end_time, time_step, atm_map_output_dir,
atom_output_dir, topo_dir, topo_suffix)
except:
import traceback
traceback.print_exc()