Example #1
0
def test_fetch(tmpdir):
    new_south = numpy.mean(
        [Topography.DEFAULT["south"], Topography.DEFAULT["north"]])
    new_west = numpy.mean(
        [Topography.DEFAULT["west"], Topography.DEFAULT["east"]])
    with tmpdir.as_cwd():
        topo = Topography(
            dem_type=Topography.DEFAULT["dem_type"],
            output_format=Topography.DEFAULT["output_format"],
            south=new_south,
            west=new_west,
            north=Topography.DEFAULT["north"],
            east=Topography.DEFAULT["east"],
            cache_dir=".",
        )
        topo.fetch()
        assert len(tmpdir.listdir(fil=lambda f: f.ext == ".tif")) == 1
"""An example used in the README and documentation."""
import matplotlib.pyplot as plt

from bmi_topography import Topography

params = Topography.DEFAULT.copy()
params["south"] = 39.93
params["north"] = 40.00
params["west"] = -105.33
params["east"] = -105.26

boulder = Topography(**params)

boulder.fetch()
boulder.load()

boulder.da.plot()
plt.show()