-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap_arome.py
More file actions
80 lines (57 loc) · 2.03 KB
/
map_arome.py
File metadata and controls
80 lines (57 loc) · 2.03 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
72
73
74
75
76
77
78
79
80
#!/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
wanted_height = 15 #[m]
nearest_height, ind = tools.nearest(list(gv.level_height_AROME_mean.values()),
wanted_height)
level_arome = list(gv.level_height_AROME_mean.keys())[ind]
print(f"Level and height in AROME are: {level_arome}, {nearest_height}")
#%% 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
fid = file.find_fields_in_resource(f'shortName:{varname}, level:{level_arome}')
field = file.readfields(fid[0])[0]
#%% 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.data, vmin=vmin, vmax=vmax)
plt.colorbar()