Exemple #1
0
def test_geogrid_simulator():
    from salem.wrftools import geogrid_simulator
    g, maps = geogrid_simulator(get_demo_file('namelist_mercator.wps'),
                                do_maps=True)
    assert len(g) == 4

    fig, axs = plt.subplots(2, 2)
    axs = np.asarray(axs).flatten()
    for i, (m, ax) in enumerate(zip(maps, axs)):
        m.set_rgb(natural_earth='lr')
        m.plot(ax=ax)
    return fig
Exemple #2
0
def test_geogrid_simulator():

    from salem.wrftools import geogrid_simulator
    g, maps = geogrid_simulator(get_demo_file('namelist_mercator.wps'),
                             do_maps=True)
    assert len(g) == 4

    fig, axs = plt.subplots(2, 2)
    axs = np.asarray(axs).flatten()
    for i, (m, ax) in enumerate(zip(maps, axs)):
        m.set_rgb(natural_earth='lr')
        m.plot(ax=ax)
    return fig
Exemple #3
0
    def test_polar(self):

        from salem.wrftools import geogrid_simulator

        g, m = geogrid_simulator(get_demo_file('namelist_polar.wps'))

        assert len(g) == 2

        for i in [1, 2]:
            fg = get_demo_file('geo_em_d0{}_polarstereo.nc'.format(i))
            ds = netCDF4.Dataset(fg)
            lon, lat = g[i - 1].ll_coordinates
            assert_allclose(lon, ds['XLONG_M'][0, ...], atol=5e-3)
            assert_allclose(lat, ds['XLAT_M'][0, ...], atol=5e-3)
Exemple #4
0
    def test_lambert_tuto(self):

        from salem.wrftools import geogrid_simulator

        g, m = geogrid_simulator(get_demo_file('namelist_tutorial.wps'))

        assert len(g) == 1

        fg = get_demo_file('geo_em.d01_tutorial.nc')
        with netCDF4.Dataset(fg) as nc:
            nc.set_auto_mask(False)
            lon, lat = g[0].ll_coordinates
            assert_allclose(lon, nc['XLONG_M'][0, ...], atol=1e-4)
            assert_allclose(lat, nc['XLAT_M'][0, ...], atol=1e-4)
Exemple #5
0
    def test_mercator(self):

        from salem.wrftools import geogrid_simulator

        g, m = geogrid_simulator(get_demo_file("namelist_mercator.wps"))

        assert len(g) == 4

        for i in [1, 2, 3, 4]:
            fg = get_demo_file("geo_em_d0{}_mercator.nc".format(i))
            ds = netCDF4.Dataset(fg)
            lon, lat = g[i - 1].ll_coordinates
            assert_allclose(lon, ds["XLONG_M"][0, ...], atol=1e-4)
            assert_allclose(lat, ds["XLAT_M"][0, ...], atol=1e-4)
Exemple #6
0
    def test_mercator(self):

        from salem.wrftools import geogrid_simulator

        g, m = geogrid_simulator(get_demo_file('namelist_mercator.wps'))

        assert len(g) == 4

        for i in [1, 2, 3, 4]:
            fg = get_demo_file('geo_em_d0{}_mercator.nc'.format(i))
            with netCDF4.Dataset(fg) as nc:
                nc.set_auto_mask(False)
                lon, lat = g[i - 1].ll_coordinates
                assert_allclose(lon, nc['XLONG_M'][0, ...], atol=1e-4)
                assert_allclose(lat, nc['XLAT_M'][0, ...], atol=1e-4)