Example #1
0
        cyctime[i] = grbs[i][1].dataTime  #Cycle (e.g. 1200 UTC)

        if fhr[i] == 0: cyctime[i] = cytime[i] + '00'
        #Pad with a zero and convert to a string
        if cyctime[i] < 1000:
            grbtime[i] = '0' + repr(cyctime[i])
        else:
            grbtime[i] = repr(cyctime[i])

        date[i] = grbs[i][1].dataDate  #PDY

    # Specify some plotting domains which have the regions pre-set in ncepy
#  domains=['CONUS','NW','NC','NE','SW','SC','SE','Great_Lakes']
    domains = ['SC4']
    proj = 'lcc'
    llcrnrlon_sc, llcrnrlat_sc, urcrnrlon_sc, urcrnrlat_sc, res = ncepy.corners_res(
        'SC', proj=proj)

    # Start reading fields to be plotted

    # read precip
    precip = ["" for x in range(num)]
    precip_vals = ["" for x in range(num)]
    precipOBS = ["" for x in range(num)]
    precipOBSvals = ["" for x in range(num)]
    bucket_length = 3

    for i in range(num):
        precip[i] = grbs[i].select(
            name='Total Precipitation',
            lengthOfTimeRange=bucket_length)[0]  # QPF is stored as mm
        precipOBS[i] = obs[i].select(
varnames = [  # uncomment the desired variables below
    #        'TMP_P0_L100_GGA0',
    #        'SPFH_P0_L100_GGA0',
    #        'RH_P0_L100_GGA0',
    #        'UGRD_P0_L100_GGA0',
    #        'VGRD_P0_L100_GGA0',
    #        'VVEL_P0_L100_GGA0',
    #        'DZDT_P0_L100_GGA0',
    #        'ABSV_P0_L100_GGA0',
    'HGT_P0_L100_GGA0',
]
######################   USER DEFINED SETTINGS    ############################################
fig = plt.figure(figsize=(8, 8))
ax = plt.subplot(111)

llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat, res = ncepy.corners_res(dom,
                                                                    proj=proj)
if (proj == "cyl"):
    llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat, res = -180, -80, 180, 80, 'c'
lon_0 = -95.0
lat_0 = 25.0
offsetup = 0.
offsetright = 0.
m = Basemap(llcrnrlon=llcrnrlon + offsetright,
            llcrnrlat=llcrnrlat + offsetup,
            urcrnrlon=urcrnrlon + offsetright,
            urcrnrlat=urcrnrlat + offsetup,
            projection=proj,
            lat_0=lat_0,
            lon_0=lon_0,
            resolution=res,
            ax=ax)