Ticket #679: n4.py

File n4.py, 610 bytes (added by warrick, 4 years ago)

Test script for CF 1.7 file

Line 
1
2#modules to read in which are generic python modules
3import matplotlib.pyplot as plt
4import netCDF4 as nc
5
6#define location of data
7dir = '/path/to/data/'
8
9filename = 'eum_test.n4'
10my_example_nc_file = dir + filename
11
12#read in data
13ds = nc.Dataset(my_example_nc_file, mode='r')
14
15print(ds)
16#find out what variables are in data
17print(ds.groups['data']['level_1b'])
18
19y=ds.groups['data']['level_1b']['thinned']['impact_height'][:]
20x=ds.groups['data']['level_1b']['thinned']['bangle'][:]
21
22
23plt.plot(x,y)
24
25plt.xlabel('Bending Angle (rad)')
26plt.ylabel('Impact Height (m)')
27plt.yscale('log')
28plt.show() #show plot
29