예제 #1
0
def plotBasic(
    title,
    labels=True,
    grid=True,
):
    """
    A function to plot and display a basic plot of ACCESS,
    AWAP, or HadISST datasets.

    Parameters:
    -----------
    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).
    title : enter a string
    """
    m

    if grid == True:
        gridWhole(-43.75, -8.75, 1.25, 114.375, 155.625, 1.875)
        gridLabels(-43.75, -8.75, 2.5, 114.375, 155.625, 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

    plt.title(title)

    return plt
예제 #2
0
def plotBasic(title,labels=True,grid=True,):
    """
    A function to plot and display a basic plot of ACCESS,
    AWAP, or HadISST datasets.

    Parameters:
    -----------
    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).
    title : enter a string
    """
    m
    

    if grid == True:
        gridWhole(-43.75,-8.75,1.25,114.375,155.625,1.875)
        gridLabels(-43.75,-8.75,2.5,114.375,155.625,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

    plt.title(title)

    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
예제 #4
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