def _read_diag_rad(fname, endian='big'): ''' Helper function to read a radiance diagnostic file ''' try: diag = _rd.diag_rad(fname, endian=endian) diag.read_obs() except: raise Exception('Error handling %s' % fname) return diag
m = Basemap(lon_0=180) m.drawmapboundary(fill_color='#A6CAE0', linewidth=0) m.fillcontinents(color='grey', alpha=0.7, lake_color='grey', zorder=10) m.drawcoastlines(linewidth=0.1, color="white") dtg = '2017091712' instrument = 'airs' platformlist = ['aqua'] for platform in platformlist: obsfile = 'diag_' + instrument + '_' + platform + '_ges.' + dtg # open diag diag_rad = read_diag.diag_rad(obsfile, endian='big') print(platform, ' total number of obs = ', diag_rad.nobs) # activate reading in data diag_rad.read_obs() # print o-f stats for one channel nobsall = diag_rad.channel.sum() idx = np.logical_and(diag_rad.used == 1, diag_rad.oberr < 1.e9) nobs = idx.sum() print(' total ', nobs, ' obs out of ', nobsall) x, y = m(diag_rad.lon[idx], diag_rad.lat[idx])
import read_diag import numpy as np obsfile = 'diag_amsua_n15_ges.2016030100' diag_rad = read_diag.diag_rad(obsfile,endian='big') print 'total number of obs = ',diag_rad.nobs diag_rad.read_obs() # print o-f stats for one channel ichan = 7 idxall = diag_rad.channel == ichan nobsall = idxall.sum() idx = np.logical_and(np.logical_and(diag_rad.channel == ichan, diag_rad.used == 1), diag_rad.oberr < 1.e9) nobs = idx.sum() fitsq = ((diag_rad.hx[idx]-diag_rad.obs[idx])**2).mean() print diag_rad.obs[6],diag_rad.hx[6],diag_rad.biascorr[6],diag_rad.biaspred[1:,6].sum() print nobs,'obs used for channel',ichan,'out of',nobsall,'rms o-f', np.sqrt(fitsq)