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