Ejemplo n.º 1
0
site.addsitedir('/Users/phil/Library/Python/2.7/lib/python/site-packages')
site.addsitedir('/Users/phil/repos/e582_code/satellite')
matplotlib.use('Agg')
from modismeta import metaParse
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
Ejemplo n.º 2
0
"""
  zoom the top map to the area around edmonds, wa
"""

from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
import matplotlib.pyplot as plt

from plot_rads import make_dir

#
# write the png files to the plots directory
#
dirname='plots'
make_dir(dirname)

#
# extra feature: print coordinates when you click the mouse on a point
# (commented out below)
#
def onclick(event):
    print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
        event.button, event.x, event.y, event.xdata, event.ydata)

# read in topo data (on a regular lat/lon grid)
# see http://clouds.eos.ubc.ca/~phil/courses/e582data
etopo=np.loadtxt('etopo20data.gz')
lons=np.loadtxt('etopo20lons.gz')
lats=np.loadtxt('etopo20lats.gz')
# create Basemap instance for Robinson projection.
# control the size and screen size