source: configs/testing/python/common.py @ 504

Last change on this file since 504 was 504, checked in by dubos, 7 years ago

configs/testing : towards first working version

File size: 638 bytes
Line 
1import numpy as np
2import netCDF4 as cdf
3# select non-interactive backend, cf http://stackoverflow.com/questions/4931376/generating-matplotlib-graphs-without-a-running-x-server
4import matplotlib
5matplotlib.use('Agg') 
6import matplotlib.pyplot as plt
7
8def getdims(nc, *names): return [len(nc.dimensions[name]) for name in names]
9def getvars(nc, *names): return [nc.variables[name] for name in names]
10
11def axis_longitude():
12    plt.xlim((0,360))
13    plt.xlabel('longitude (degrees)')
14    plt.xticks(np.arange(0,361,30))
15
16def axis_latitude():
17    plt.ylim((-90,90))
18    plt.ylabel('latitude (degrees)')
19    plt.yticks(np.arange(-90,91,30))
20
Note: See TracBrowser for help on using the repository browser.