|
55 | 55 | "source": [ |
56 | 56 | "nrays = 360\n", |
57 | 57 | "nbins = 150\n", |
58 | | - "range_res = 1000.0\n", |
| 58 | + "range_res = 500.0\n", |
59 | 59 | "ranges = np.arange(nbins) * range_res\n", |
60 | 60 | "elevs = [28.0, 18.0, 14.0, 11.0, 8.2, 6.0, 4.5, 3.1, 2.0, 1.0]\n", |
61 | | - "sitecoords = (7.07, 50.73, 100.0)\n", |
| 61 | + "sitecoords = (-28.1, 38.42, 450.0)\n", |
62 | 62 | "beamwidth = 1.0" |
63 | 63 | ] |
64 | 64 | }, |
|
132 | 132 | " vert_res=1000.0,\n", |
133 | 133 | " maxalt=15000.0,\n", |
134 | 134 | " range_res=5000.0,\n", |
135 | | - " maxrange=200000.0,\n", |
| 135 | + " maxrange=75000.0,\n", |
136 | 136 | " units=\"km\",\n", |
137 | 137 | ")" |
138 | 138 | ] |
|
181 | 181 | "\n", |
182 | 182 | "A terrain profile can be added to the plot by specifying keyword argument `terrain=True` which automatically downloads neccessary SRTM DEM data and calculates the terrain profile. Additionally the azimuth angle need to be set via keyword argument `az` (it would default to `0`, pointing due north).\n", |
183 | 183 | "\n", |
184 | | - "For this to work the `WRADLIB_DATA` environment variable has to point a writable folder." |
| 184 | + "For this to work the `WRADLIB_DATA` environment variable has to point a writable folder. Aditionally users need an [earthdata account](https://urs.earthdata.nasa.gov/) with bearer token." |
185 | 185 | ] |
186 | 186 | }, |
187 | 187 | { |
|
193 | 193 | "# only run if environment variables are set\n", |
194 | 194 | "import os\n", |
195 | 195 | "\n", |
196 | | - "has_data = os.environ.get(\"WRADLIB_EARTHDATA_USER\", False)" |
| 196 | + "has_data = os.environ.get(\"WRADLIB_EARTHDATA_BEARER_TOKEN\", False)" |
197 | 197 | ] |
198 | 198 | }, |
199 | 199 | { |
|
204 | 204 | "source": [ |
205 | 205 | "if has_data:\n", |
206 | 206 | " ax = wrl.vis.plot_scan_strategy(\n", |
207 | | - " ranges, elevs, sitecoords, units=\"km\", terrain=True, az=165\n", |
| 207 | + " ranges, elevs, sitecoords, units=\"km\", terrain=True, az=10\n", |
208 | 208 | " )" |
209 | 209 | ] |
210 | 210 | }, |
211 | 211 | { |
212 | 212 | "cell_type": "markdown", |
213 | 213 | "metadata": {}, |
214 | 214 | "source": [ |
215 | | - "Instead of downloading the SRTM data a precomputed terrain profile can be plotted. Just for the purpose to show this, the data is extracted from the previous axes.\n", |
216 | | - "The profile should be fed via the same keyword argument `terrain`." |
| 215 | + "Instead of downloading the SRTM data a precomputed terrain profile can be plotted. Just for the purpose to show this, the terrain data is calculated via the same mechanism as in plot_scan_strategy. The profile should be fed via the same keyword argument `terrain`." |
| 216 | + ] |
| 217 | + }, |
| 218 | + { |
| 219 | + "cell_type": "code", |
| 220 | + "execution_count": null, |
| 221 | + "metadata": {}, |
| 222 | + "outputs": [], |
| 223 | + "source": [ |
| 224 | + "xyz, rad = wrl.georef.spherical_to_xyz(ranges, [10.0], elevs, sitecoords, squeeze=True)\n", |
| 225 | + "ll = wrl.georef.reproject(xyz, projection_source=rad)\n", |
| 226 | + "# (down-)load srtm data\n", |
| 227 | + "ds = wrl.io.get_srtm(\n", |
| 228 | + " [ll[..., 0].min(), ll[..., 0].max(), ll[..., 1].min(), ll[..., 1].max()],\n", |
| 229 | + ")\n", |
| 230 | + "rastervalues, rastercoords, proj = wrl.georef.extract_raster_dataset(\n", |
| 231 | + " ds, nodata=-32768.0\n", |
| 232 | + ")\n", |
| 233 | + "# map rastervalues to polar grid points\n", |
| 234 | + "terrain = wrl.ipol.cart_to_irregular_spline(\n", |
| 235 | + " rastercoords, rastervalues, ll[-1, ..., :2], order=3, prefilter=False\n", |
| 236 | + ")" |
217 | 237 | ] |
218 | 238 | }, |
219 | 239 | { |
|
223 | 243 | "outputs": [], |
224 | 244 | "source": [ |
225 | 245 | "if has_data:\n", |
226 | | - " terrain = np.ma.masked_equal(\n", |
227 | | - " ax.collections[0].get_paths()[0].vertices[..., 1], 0\n", |
228 | | - " ).compressed()[2:-1][::-1]\n", |
229 | 246 | " ax = wrl.vis.plot_scan_strategy(\n", |
230 | 247 | " ranges, elevs, sitecoords, units=\"km\", terrain=terrain\n", |
231 | 248 | " )" |
|
256 | 273 | " beamwidth=1.0,\n", |
257 | 274 | " vert_res=500.0,\n", |
258 | 275 | " range_res=5000.0,\n", |
259 | | - " maxrange=100000.0,\n", |
| 276 | + " maxrange=75000.0,\n", |
260 | 277 | " units=\"km\",\n", |
261 | 278 | " terrain=None,\n", |
262 | 279 | " ax=ax1,\n", |
|
269 | 286 | " beamwidth=1.0,\n", |
270 | 287 | " vert_res=100.0,\n", |
271 | 288 | " maxalt=1000.0,\n", |
272 | | - " range_res=500.0,\n", |
273 | | - " maxrange=10000.0,\n", |
| 289 | + " range_res=1000.0,\n", |
| 290 | + " maxrange=30000.0,\n", |
274 | 291 | " units=\"km\",\n", |
275 | 292 | " terrain=None,\n", |
276 | 293 | " ax=ax2,\n", |
|
283 | 300 | " beamwidth=1.0,\n", |
284 | 301 | " vert_res=500.0,\n", |
285 | 302 | " range_res=5000.0,\n", |
286 | | - " maxrange=100000.0,\n", |
| 303 | + " maxrange=75000.0,\n", |
287 | 304 | " units=\"km\",\n", |
288 | 305 | " terrain=True,\n", |
289 | | - " az=165,\n", |
| 306 | + " az=10,\n", |
290 | 307 | " ax=ax3,\n", |
291 | 308 | " )\n", |
292 | 309 | " ax4 = 224\n", |
|
297 | 314 | " beamwidth=1.0,\n", |
298 | 315 | " vert_res=100.0,\n", |
299 | 316 | " maxalt=1000.0,\n", |
300 | | - " range_res=500.0,\n", |
301 | | - " maxrange=10000.0,\n", |
| 317 | + " range_res=1000.0,\n", |
| 318 | + " maxrange=30000.0,\n", |
302 | 319 | " units=\"km\",\n", |
303 | 320 | " terrain=True,\n", |
304 | | - " az=165,\n", |
| 321 | + " az=10,\n", |
305 | 322 | " ax=ax4,\n", |
306 | 323 | " )\n", |
307 | 324 | " pl.tight_layout()" |
|
319 | 336 | { |
320 | 337 | "cell_type": "code", |
321 | 338 | "execution_count": null, |
322 | | - "metadata": {}, |
| 339 | + "metadata": { |
| 340 | + "tags": [] |
| 341 | + }, |
323 | 342 | "outputs": [], |
324 | 343 | "source": [ |
325 | 344 | "if has_data:\n", |
|
341 | 360 | "name": "python", |
342 | 361 | "nbconvert_exporter": "python", |
343 | 362 | "pygments_lexer": "ipython3", |
344 | | - "version": "3.9.0" |
| 363 | + "version": "3.10.5" |
345 | 364 | } |
346 | 365 | }, |
347 | 366 | "nbformat": 4, |
|
0 commit comments