コード例 #1
0
def make_nysm_map(etime, time1, dropzeros=True):
    precip = []
    for i in range(0, len(STN)):
        if (etime == 0):
            precip.append(np.nanmax(prcp_evol[i, 0]))
        else:
            precip.append(np.nanmax(prcp_evol[i, 0:etime]))

    if dropzeros:
        wh = [i for i, x in enumerate(precip) if x == 0.]
        for i in reversed(
                wh
        ):  #needs to be reversed so we don't mess up the original indexing in the list
            del precip[i]
            del lons[i]
            del lats[i]
            del stns[i]
    nys = add_shape_coord_from_data_array()

    #plt.figure(figsize=(10,10))
    ax = gplt.polyplot(nys,
                       figsize=(8, 8),
                       facecolor='None',
                       edgecolor='black',
                       projection=gcrs.LambertConformal())
    levels = [
        0., 1., 2., 6., 10., 15., 20., 30., 40., 50., 70., 90., 110., 130.,
        150., 200., 300.
    ]
    norm = BoundaryNorm(levels, 16)
    c1 = ax.scatter(lons,
                    lats,
                    c=precip,
                    norm=norm,
                    marker='o',
                    s=200,
                    transform=ccrs.PlateCarree(),
                    zorder=2,
                    alpha=1.,
                    edgecolor='black',
                    cmap=precip_colormap)
    ax.text(0.95,
            0.01,
            'Plot by L. Gaudet',
            verticalalignment='bottom',
            horizontalalignment='right',
            transform=ax.transAxes,
            color='grey',
            fontsize=10)
    cbar = plt.colorbar(c1, ticks=levels)
    cbar.set_label('Precipitation (mm)', rotation=90)
    plt.title(
        f'{str(time1.hour).zfill(2)} UTC {time1.day}-{time1.month}-{time1.year}',
        fontsize=18)
コード例 #2
0
ファイル: proj_tests.py プロジェクト: tianchi03/geoplot
@pytest.mark.parametrize("proj", [
    gcrs.PlateCarree(),
    gcrs.LambertCylindrical(),
    gcrs.Mercator(),
    gcrs.Miller(),
    gcrs.Mollweide(),
    gcrs.Robinson(),
    gcrs.Sinusoidal(),
    pytest.param(gcrs.InterruptedGoodeHomolosine(), marks=pytest.mark.xfail),
    pytest.param(gcrs.Geostationary(), marks=pytest.mark.xfail),
    gcrs.NorthPolarStereo(),
    gcrs.SouthPolarStereo(),
    gcrs.Gnomonic(),
    gcrs.AlbersEqualArea(),
    gcrs.AzimuthalEquidistant(),
    gcrs.LambertConformal(),
    gcrs.Orthographic(),
    gcrs.Stereographic(),
    pytest.param(gcrs.TransverseMercator(), marks=pytest.mark.xfail),
    gcrs.LambertAzimuthalEqualArea(),
    gcrs.WebMercator()
])
def test_basic_global_projections(proj, countries):
    gplt.polyplot(countries, proj)
    ax = plt.gca()
    ax.set_global()
    return plt.gcf()


@pytest.mark.mpl_image_compare
@pytest.mark.parametrize("proj", [