-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: planetary name resolvers (openstreetmap and gazetteer of planet…
…ary features) (#103) * feat: Add support for planetary body objects for target property * 🐛 Add error when target object is unknown * ✅ Add tests for planetary coordinates * 📝 Update changelog * 🥅 Improve error management with new '_ready' traitlets * 🎨 Replace 200 constant by requests value * 🎨 Make target property return BaseBodycentricRepresentation when survey body is a planetary body * docs: Add warning when planetary body fetching is not returning the same object as expected * 🐛 Try fixing planetary coordinate as target * ✨ Allow target setting using a tuple of two floats * 🚑 Fix missing line because of rebase * ✅ Fix tests * 🚑 Fix un-raised NameResolveError and improve comments * 📝 Add new notebook 12 to show how to use ipyaladin with planetary body * feat: add support for earth, return longitude and latitude objects instead of floats * docs: document name resolvers * fix: make tests pass --------- Co-authored-by: MARCHAND MANON <[email protected]>
- Loading branch information
1 parent
244e702
commit 8123c49
Showing
9 changed files
with
490 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8b1a9d152f4e1c7f", | ||
"metadata": {}, | ||
"source": [ | ||
"# Planetary surveys\n", | ||
"\n", | ||
"With `ipyaladin`, you can also display planetary surfaces." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "initial_id", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from ipyaladin import Aladin\n", | ||
"from astropy.table import Table" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "60b133f13ce59125", | ||
"metadata": {}, | ||
"source": [ | ||
"First, let's create an Aladin Lite widget with the Mars Viking MDIM21 survey." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "85d284fd3f5cc7bd", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"mars = Aladin(\n", | ||
" target=\"159.2135528 -58.6241989\",\n", | ||
" survey=\"https://alasky.u-strasbg.fr/Planets/Mars_Viking_MDIM21\",\n", | ||
" fov=10,\n", | ||
")\n", | ||
"mars" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "35ea9256", | ||
"metadata": {}, | ||
"source": [ | ||
"The target does not return a `SkyCoord` object anymore, since we don't represent the sky here. It is a couple of `Longitude` and `Latitude`." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "43c34b52", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"mars.target" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e6f17ff7", | ||
"metadata": {}, | ||
"source": [ | ||
"The WCS are also defined on planetary surfaces (in [Marmo *et.al.* 2018](https://doi.org/10.1029/2018EA000388)). This is why you see a CTYPE starting with `MA` for Mars." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "59bcf84c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"mars.wcs" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "34747eb38e0db450", | ||
"metadata": {}, | ||
"source": [ | ||
"Let's change the center of the view to Olympus Mons." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "dbe012440a30b6fe", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"mars.target = \"Olympus Mons\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "879f484a", | ||
"metadata": {}, | ||
"source": [ | ||
"Any name recognized by the [Gazetter of Planetary Nomenclature](https://planetarynames.wr.usgs.gov/Nomenclature) will work. \n", | ||
"\n", | ||
"We can also add tables:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5461264f0485d880", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"longitudes = [\n", | ||
" 226.2,\n", | ||
" 70.5,\n", | ||
" 250.4,\n", | ||
" -59.2,\n", | ||
" 147.21,\n", | ||
" 316.0,\n", | ||
" 32.53,\n", | ||
" -112.58,\n", | ||
" 298.0,\n", | ||
" 30.0,\n", | ||
" 70.5,\n", | ||
" 280.0,\n", | ||
" 87.0,\n", | ||
" 117.5,\n", | ||
" 350.0,\n", | ||
"]\n", | ||
"latitudes = [\n", | ||
" 18.65,\n", | ||
" -42.4,\n", | ||
" 40.5,\n", | ||
" -13.9,\n", | ||
" 25.02,\n", | ||
" -49.7,\n", | ||
" 70.0,\n", | ||
" 1.57,\n", | ||
" 25.0,\n", | ||
" 19.79,\n", | ||
" -42.4,\n", | ||
" 45.0,\n", | ||
" 12.9,\n", | ||
" 46.7,\n", | ||
" -45.0,\n", | ||
"]\n", | ||
"names = [\n", | ||
" \"Olympus Mons\",\n", | ||
" \"Hellas Planitia\",\n", | ||
" \"Alba Mons\",\n", | ||
" \"Valles Marineris\",\n", | ||
" \"Elysium Mons\",\n", | ||
" \"Argyre Basin\",\n", | ||
" \"Vastitas Borealis\",\n", | ||
" \"Tharsis Montes\",\n", | ||
" \"Outflow channels\",\n", | ||
" \"Arabia Terra\",\n", | ||
" \"Hellas Basin\",\n", | ||
" \"Tempe Terra\",\n", | ||
" \"Isidis Basin\",\n", | ||
" \"Utopia Basin\",\n", | ||
" \"Noachis Terra\",\n", | ||
"]\n", | ||
"\n", | ||
"table = Table([longitudes, latitudes, names], names=(\"Longitude\", \"Latitude\", \"Name\"))\n", | ||
"mars.add_table(\n", | ||
" table, color=\"#67d38d\", source_size=15, shape=\"cross\", name=\"Mars_features\"\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4af1422b", | ||
"metadata": {}, | ||
"source": [ | ||
"## Surveys of Earth" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "479ddc87", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"earth = Aladin(\n", | ||
" survey=\"CDS/P/Earth/DEM/elevation\",\n", | ||
" fov=100,\n", | ||
")\n", | ||
"earth" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "983e6c40", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"earth.target" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4609cf6b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"earth.wcs" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3b887792", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"earth.target = \"Strasbourg\" # ipyaladin's home" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d042bb57", | ||
"metadata": {}, | ||
"source": [ | ||
"Any name recognized by OpenStreetMaps will work." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"nbsphinx": { | ||
"execute": "never" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__version__ = "0.4.0" | ||
__aladin_lite_version__ = "3.4.4-beta" | ||
__aladin_lite_version__ = "3.5.1-alpha" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.