-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathone_d_plotter.py
More file actions
68 lines (49 loc) · 1.26 KB
/
one_d_plotter.py
File metadata and controls
68 lines (49 loc) · 1.26 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
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 04 11:28:27 2016
@author: hanbre
"""
from __future__ import print_function
import sys
import numpy as np
import pandas as pd
import xray
import netCDF4
import datetime as dt
from netcdftime import datetime
import scipy
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from math import *
import restart_file_modifier2 as rfm
def one_d_plot(x, fx):
plt.plot_date(x,fx)
plt.title()
def get_data(ID):
case_id = ID.split('/')
dataset= rfm.read_data(ID)
return dataset,case_id
if __name__ == '__main__':
ds,case_id = get_data(sys.argv[1])
xax = sys.argv[2]
var = sys.argv[3]
x = getattr(ds,xax).values
fx = getattr(ds,var).values
if type(fx) != np.ndarray:
fx = getattr(ds,var).values()
fx = fx[0]
fx=fx.squeeze()
fx=fx.values
frame = pd.DataFrame(fx,index=x)
if len(sys.argv)>4:
skip = sys.argv[4]
else:
skip = 1
frame.plot()
if int(skip) == 0:
s = raw_input('Title for plot: ')
plt.title(s)
plt.savefig('{0}/{1}_{2}_{3}.png'.format(case_id[0],case_id[1],xax,var),dpi=100)
#plt.show()
#one_d_plot(x,fx)