-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_verti_profile_arome.py
More file actions
71 lines (51 loc) · 1.68 KB
/
plot_verti_profile_arome.py
File metadata and controls
71 lines (51 loc) · 1.68 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script for plotting vertical profiles from AROME .fa files
@author: lunelt
"""
import epygram
import matplotlib.pyplot as plt
import global_variables as gv
# from dask import compute
# from dask.delayed import delayed
# import dask
import time
import tools
folder_path = '/home/lunelt/Data/analysis/'
wanted_date = '20230724.08'
site = 'planier'
varname = 'tke' # tke, t, u, v, q
vmin, vmax = 0, 3
max_height = 3000 # [m]
#%% MISC
# filename = f'arome.AN.{wanted_date}'
# file = epygram.formats.resource(filename=f'{folder_path}/{filename}',
# openmode='r')
# # list of variable availables
# simplified_field_dict = {}
# for field in file.listfields():
# simplified_field_dict[field['shortName']]=field['name']
# # for maps
# land_sea_mask = file.find_fields_in_resource('shortName:lsm')
# lsm = file.readfields(land_sea_mask[0])
# # unk = file.find_fields_in_resource('shortName:unknown')
# fid3D = file.find_fields_in_resource(f'shortName:{varname}')
# # file.readfields(fid3D)
# # f = file.readfield({'shortName':'t', 'typeOfFirstFixedSurface':119}) # temperature on pressure levels
#%% PLOT verti profile
t1 = time.time()
verti_profile = tools.extract_profile_arome(site, wanted_date, varname)
t2 = time.time()
print('exec time: ', t2-t1)
fig = plt.figure()
plt.plot(verti_profile.values(), verti_profile.keys(),
label='arome', marker='+', linestyle='--')
plt.xlabel = varname
plt.ylim(0, 2000)
#%% PLOT 2D map
# fig, ax = field[0].cartoplot() # does not work
# fig = plt.figure()
# plt.contour(lsm[0].data, color='k')
# plt.pcolormesh(field[0].data, vmin=vmin, vmax=vmax)
# plt.colorbar()