Skip to content

Commit

Permalink
Merge 2e8cd68 into ee7b9e4
Browse files Browse the repository at this point in the history
  • Loading branch information
bwinkel committed Apr 24, 2019
2 parents ee7b9e4 + 2e8cd68 commit 48c52c1
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 61 deletions.
32 changes: 20 additions & 12 deletions notebooks/03d_more_on_srtm_data.ipynb
Expand Up @@ -148,7 +148,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"('srtm_dir', 'download', 'server', 'interp', 'spline_opts')\n"
"('srtm_dir', 'download', 'server', 'interp', 'spline_opts', 'tile_size', 'hgt_res')\n"
]
}
],
Expand Down Expand Up @@ -196,7 +196,7 @@
"source": [
"### Download missing tiles\n",
"\n",
"By default, pycraf won't download missing SRTM data:"
"By default, pycraf won't download missing SRTM data, but set the tile heights to Zero:"
]
},
{
Expand All @@ -207,10 +207,23 @@
},
"outputs": [
{
"name": "stdout",
"name": "stderr",
"output_type": "stream",
"text": [
"No hgt-file found for (7d, 45d), was looking for N45E007.hgt\n"
"/home/bwinkel/local/miniconda/envs/pycraf3.6/lib/python3.6/site-packages/pycraf/pathprof/srtm.py:482: TileNotAvailableOnDiskWarning: \n",
"No hgt-file found for (7d, 45d) - was looking for file N45E007.hgt\n",
"in directory: /tmp/tmp7vue3h7o\n",
"Will set terrain heights in this area to zero. Note, you can have pycraf\n",
"download missing tiles automatically - just use \"pycraf.pathprof.SrtmConf\"\n",
"(see its documentation).\n",
" stacklevel=1,\n",
"/home/bwinkel/local/miniconda/envs/pycraf3.6/lib/python3.6/site-packages/pycraf/pathprof/srtm.py:482: TileNotAvailableOnDiskWarning: \n",
"No hgt-file found for (7d, 46d) - was looking for file N46E007.hgt\n",
"in directory: /tmp/tmp7vue3h7o\n",
"Will set terrain heights in this area to zero. Note, you can have pycraf\n",
"download missing tiles automatically - just use \"pycraf.pathprof.SrtmConf\"\n",
"(see its documentation).\n",
" stacklevel=1,\n"
]
}
],
Expand All @@ -221,11 +234,7 @@
"lons = np.linspace(bbox[0], bbox[1], 501) * u.deg\n",
"lats = np.linspace(bbox[2], bbox[3], 501)[:, np.newaxis] * u.deg\n",
"\n",
"try:\n",
" heights = pp.srtm_height_data(lons, lats)\n",
"except OSError as e:\n",
" # avoid printing full traceback\n",
" print(e.args[0].split('\\n')[0])"
"heights = pp.srtm_height_data(lons, lats)"
]
},
{
Expand Down Expand Up @@ -370,7 +379,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To use them, we first have to clear the interpolator cache and then delete the old tile data in our temporary directory."
"To use them, we need to change the server option accordingly. Unfortunately, the 'viewpano' tiles are stored into a sub-directory, such that pycraf would find the tile twice and raise an error. Therefore, we first have to delete the old tile data in our temporary directory."
]
},
{
Expand All @@ -381,7 +390,6 @@
},
"outputs": [],
"source": [
"pp.srtm.get_tile_interpolator.cache_clear()\n",
"shutil.rmtree(temp_srtm_dir)\n",
"os.mkdir(temp_srtm_dir)"
]
Expand All @@ -406,7 +414,7 @@
" # technically, one could omit the context in this case\n",
" # as 'linear' is the default\n",
" heights_linear_vp = pp.srtm_height_data(lons, lats)\n",
" \n",
"\n",
"# since above we downloaded the missing tile already,\n",
"# we don't need the 'download' option below anymore\n",
"with pp.SrtmConf.set(interp='nearest'):\n",
Expand Down

0 comments on commit 48c52c1

Please sign in to comment.