-
Notifications
You must be signed in to change notification settings - Fork 0
/
FigX_plot_vertical_all.py
62 lines (49 loc) · 1.8 KB
/
FigX_plot_vertical_all.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
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 22 22:58:33 2022
"""
# %% headers
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from datetime import datetime, timedelta
from load_data_functions import read_MMS_ict
from load_data_functions import return_filenames
plt.rcParams['axes.labelsize'] = 8
plt.rcParams['legend.fontsize'] = 8
plt.rcParams['xtick.labelsize'] = 7
plt.rcParams['ytick.labelsize'] = 7
# %% loop to load and plot the data
fig1, ax1 = plt.subplots(1, 1, figsize=(3.5,3.5))
plot_style = 'vert'
for ii in range(3,18): #[10,5,3]:
# load data
case_name = "RF" + "{:02d}".format(ii)
filenames = return_filenames(case_name)
filename_COMA = filenames['COMA_ict']
filename_MMS = filenames['MMS']
cur_day = datetime.strptime(filename_COMA[-15:-7],"%Y%m%d") # get date from end of file name
COMA = pd.read_csv(filename_COMA,header=35)
COMA['time'] = [cur_day+timedelta(seconds=t) for t in COMA['Time_Mid']]
#COMA['flightID'] = [ii for t in COMA['Time_Mid']]
COMA[COMA['CO'] == -9999] = np.nan
MMS = read_MMS_ict(filename_MMS)
# sychronize data
MMS_sync = MMS.groupby(pd.Grouper(key="time", freq="10s")).mean()
COMA_sync = COMA.groupby(pd.Grouper(key="time", freq="10s")).mean()
sync_data = pd.merge(MMS_sync, COMA_sync, how='inner', on=['time'])
# plot vertical profile
if plot_style == 'vert':
ax1.plot(sync_data['CO'],sync_data['ALT']/1000,'k.',label=case_name,markersize=1)
else:
ax1.plot(sync_data['ALT'].values/1000,'.',label=case_name)
# %% format plot
if plot_style == 'vert':
#ax1.legend(ncol=3)
ax1.set_xlim(0,350)
ax1.grid('on')
ax1.set_xlabel('CO, ppbv')
ax1.set_ylabel('Altitude, km')
fig1.tight_layout()
#fig1.savefig('fig1.png',dpi=300)