示例#1
0
def plotAWAP_original(var_time, Dict):
    """
    Plot uninterpolated AWAP data.
    """
    m

    [lonall, latall] = np.meshgrid((Dict['lon']), (Dict['lat']))
    x, y = m(lonall, latall)

    cs = m.pcolor(x, y, var_time, vmin=Dict['vmin'], vmax=Dict['vmax'])

    cbar = m.colorbar(cs, location='right', pad="1%")
    cbarLabel = "%s" % (Dict['var_units'])
    cbar.set_label(cbarLabel)

    return plt
示例#2
0
def plotAWAP_original(var_time,Dict):
    """
    Plot uninterpolated AWAP data.
    """
    m

    [lonall,latall] = np.meshgrid((Dict['lon']),(Dict['lat']))
    x,y = m(lonall,latall)

    cs = m.pcolor(x,y,var_time,vmin=Dict['vmin'],vmax=Dict['vmax'])

    cbar = m.colorbar(cs, location='right', pad="1%")
    cbarLabel = "%s" %(Dict['var_units'])
    cbar.set_label(cbarLabel)

    return plt
示例#3
0
def plot(var_time, Dict, labels=False, grid=False, oceans=False, cbar=True):
    """
    A function to plot and display a basic plot of ACCESS,
    AWAP, or HadISST datasets.

    Parameters:
    -----------
    var_time : The variable to be plotted.  Use the imported
            data from access_prepare_ts, hadisst_prepare,
            awap_prepare, access_prepare_pr or access_trimmed.
    Dict :  a dictionary defining various
            variables needed for the dataset to be plotted.
            The dictionaries are defined above in the
            mapAWAP(), mapACCESSpr(), mapACCESSts(), mapACCESSpr_tr() and
            mapHadisst() functions.
    labels : (default = False)
            Adds axis labels for longitude/latitude if "True".
    grid : (default = False)
            If set to "True", the a grid is superimposed over
            the map at the 1.25 (lat) by 1.875 (lon) degree
            resolution.  If set to "False", only the latitudes/
            longitudes that show the dimensions of the box are
            plotted.
            If set to "Simple", only the boundary lat/lon
            values for the map are shown (no grid-lines).
    oceans : (default = False)
            If set to "True", ocean regions remain unmaskeded
            and are plotted; if set to "False", the oceans are
            not plotted.
    cbar : (default = True)
            Plots a colour-bar if set to "True".
    """
    m

    [lonall, latall] = np.meshgrid((Dict['lon']), (Dict['lat']))
    x, y = m(lonall, latall)

    if grid == True:
        gridWhole(-47.5, -7.5, 1.25, 112.5, 157.5, 1.875)
        gridLabels(-47.5, -7.5, 2.5, 112.5, 159.375, 7.5)
    elif grid == 'Simple':
        gridLabels(-40.0, 0.0, 10.0, 110.0, 160.0, 10.0)
    elif grid == 'Ticks':
        gridLabels(-40.0, 0.0, 10.0, 110.0, 160.0, 10.0)
    else:
        pass

    if labels == True and grid == True:
        plt.xlabel("Longitude ($^\circ$E)", labelpad=25)
        plt.ylabel("Latitude ($^\circ$S)", labelpad=50)
    elif labels == True and not grid == True:
        plt.xlabel("Longitude ($^\circ$E)", labelpad=25)
        plt.ylabel("Latitude ($^\circ$S)", labelpad=30)
    else:
        pass

    if oceans == False:
        var_time_land = maskoceans(lonall, latall, var_time)
        cs = m.pcolor(x,
                      y,
                      var_time_land,
                      vmin=Dict['vmin'],
                      vmax=Dict['vmax'],
                      cmap=plt.cm.get_cmap('RdBu'))
    else:
        cs = m.pcolor(x, y, var_time, vmin=Dict['vmin'], vmax=Dict['vmax'])

    if cbar == True:
        cbar = m.colorbar(cs, location='right', pad="1%")
        cbarLabel = "%s" % (Dict['var_units'])
        cbar.set_label(cbarLabel)
    else:
        pass

    return plt
    A function to replace empty longitudinal values in the resampled
    AWAP dataset with actual longitudinal values.
    """
    start_lon = 112.925  # Check value.  Should be 112.5?
    newlist_lon = []
    for i in range(0, 813):
        i = start_lon
        newlist_lon.append(i)
        start_lon += 0.05
    data.variables["longitude"][:] = newlist_lon[:]
    return data.variables["longitude"][:]


dict1 = {}
dict1["var_units"] = "Precipitation (mm/day)"
dict1["lat"] = lat()
dict1["lon"] = lon()
dict1["vmin"] = 0.0  # mm/day
dict1["vmax"] = 3.0  # mm/day


[lonall, latall] = np.meshgrid((dict1["lon"]), (dict1["lat"]))
x, y = m(lonall, latall)

# Plots an image of mean precipitation for 1900 (Jan-Dec).
cs = m.pcolor(x, y, awap_data[0, :, :], vmin=dict1["vmin"], vmax=dict1["vmax"])
cbar = m.colorbar(cs, location="right", pad="1%")
cbarLabel = "%s" % (dict1["var_units"])
cbar.set_label(cbarLabel)
plt.show()
示例#5
0
    """
    A function to replace empty longitudinal values in the resampled
    AWAP dataset with actual longitudinal values.
    """
    start_lon = 112.925 #Check value.  Should be 112.5?
    newlist_lon = []
    for i in range(0,813):
        i = start_lon
        newlist_lon.append(i)
        start_lon += 0.05
    data.variables['longitude'][:] = newlist_lon[:]
    return data.variables['longitude'][:]

dict1 = {}
dict1['var_units'] = "Precipitation (mm/day)"
dict1['lat'] = lat()
dict1['lon'] = lon()
dict1['vmin'] = 0.0 # mm/day
dict1['vmax'] = 3.0 # mm/day


[lonall,latall] = np.meshgrid((dict1['lon']),(dict1['lat']))
x,y = m(lonall,latall)

#Plots an image of mean precipitation for 1900 (Jan-Dec).
cs = m.pcolor(x,y,awap_data[0,:,:],vmin=dict1['vmin'],vmax=dict1['vmax'])
cbar = m.colorbar(cs, location='right', pad="1%")
cbarLabel = "%s" %(dict1['var_units'])
cbar.set_label(cbarLabel)
plt.show()
示例#6
0
def plot(var_time,Dict,labels=False,grid=False,oceans=False,cbar=True):
    """
    A function to plot and display a basic plot of ACCESS,
    AWAP, or HadISST datasets.

    Parameters:
    -----------
    var_time : The variable to be plotted.  Use the imported
            data from access_prepare_ts, hadisst_prepare,
            awap_prepare, access_prepare_pr or access_trimmed.
    Dict :  a dictionary defining various
            variables needed for the dataset to be plotted.
            The dictionaries are defined above in the
            mapAWAP(), mapACCESSpr(), mapACCESSts(), mapACCESSpr_tr() and
            mapHadisst() functions.
    labels : (default = False)
            Adds axis labels for longitude/latitude if "True".
    grid : (default = False)
            If set to "True", the a grid is superimposed over
            the map at the 1.25 (lat) by 1.875 (lon) degree
            resolution.  If set to "False", only the latitudes/
            longitudes that show the dimensions of the box are
            plotted.
            If set to "Simple", only the boundary lat/lon
            values for the map are shown (no grid-lines).
    oceans : (default = False)
            If set to "True", ocean regions remain unmaskeded
            and are plotted; if set to "False", the oceans are
            not plotted.
    cbar : (default = True)
            Plots a colour-bar if set to "True".
    """
    m
    
    [lonall,latall] = np.meshgrid((Dict['lon']),(Dict['lat']))
    x,y = m(lonall,latall)

    if grid == True:
        gridWhole(-47.5,-7.5,1.25,112.5,157.5,1.875)
        gridLabels(-47.5,-7.5,2.5,112.5,159.375,7.5)
    elif grid == 'Simple':
        gridLabels(-40.0,0.0,10.0,110.0,160.0,10.0)
    elif grid == 'Ticks':
        gridLabels(-40.0,0.0,10.0,110.0,160.0,10.0)
    else:
        pass

    if labels == True and grid==True:
        plt.xlabel("Longitude ($^\circ$E)",labelpad=25)
        plt.ylabel("Latitude ($^\circ$S)",labelpad=50)
    elif labels == True and not grid==True:
        plt.xlabel("Longitude ($^\circ$E)",labelpad=25)
        plt.ylabel("Latitude ($^\circ$S)",labelpad=30)
    else:
        pass

    if oceans == False:
        var_time_land = maskoceans(lonall,latall,var_time)
        cs = m.pcolor(x,y,var_time_land,vmin=Dict['vmin'],vmax=Dict['vmax'],cmap=plt.cm.get_cmap('RdBu'))
    else:
        cs = m.pcolor(x,y,var_time,vmin=Dict['vmin'],vmax=Dict['vmax'])

    if cbar == True:
        cbar = m.colorbar(cs, location='right', pad="1%")
        cbarLabel = "%s" %(Dict['var_units'])
        cbar.set_label(cbarLabel)
    else:
        pass

    return plt