Пример #1
0
import numpy as np
import pyhdf.SD
import matplotlib.pyplot as plt
from dateutil.parser import parse
from plot_rads import make_dir

import dateutil.tz as tz
import re
import bitmap

plot_dir='plots'
make_dir(plot_dir)


mask_file=glob.glob('MYD35*2010215*.hdf')[0]
my_parser=metaParse(filename=mask_file)
meta_data=my_parser.get_info()
mask=pyhdf.SD.SD(mask_file)

theDate=parse(meta_data['startdate'][:-3] + meta_data['starttime'])
theDate=theDate.replace(tzinfo=tz.tzutc())

maskVals=mask.select('Cloud_Mask')
maskVals=maskVals.get()
maskVals=maskVals[0,...] #get the first byte
#
# pass the byte to bitmap and get back the cloudmask
# and the landmask
#
maskout,landout=bitmap.getmask_zero(maskVals)
oceanvals=(landout==0)
Пример #2
0
if __name__=="__main__":

    import copy
    from matplotlib.colors import Normalize
    from matplotlib import cm
    cmap=copy.deepcopy(cm.RdBu_r)
    cmap.set_over('y')
    cmap.set_under('w')
    vmin= 7.5
    vmax= 8.5
    the_norm=Normalize(vmin=vmin,vmax=vmax,clip=False)
    granule_info='A2010215.2145.005'
    model3_file='*D03*{0:s}*hdf'.format(granule_info)
    model3_file=glob.glob(model3_file)[0]
    my_parser=metaParse(filename=model3_file)
    meta_data=my_parser.get_info()
    sdgeom=pyhdf.SD.SD(model3_file)
    fullLats_raw=sdgeom.select('Latitude')
    fullLats_raw=fullLats_raw.get()
    fullLons_raw=sdgeom.select('Longitude')
    fullLons_raw=fullLons_raw.get()
    sdgeom.end()
    model2_file='*D021KM*{0:s}*hdf'.format(granule_info)
    model2_file=glob.glob(model2_file)[0]
    sdrad=pyhdf.SD.SD(model2_file)
    longWave=sdrad.select('EV_1KM_Emissive')
    allRadiances=longWave.get()

    model35_file='*D35*{0:s}*hdf'.format(granule_info)
    model35_file=glob.glob(model35_file)[0]