Skip to content

Commit

Permalink
Updated S2 notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
gomezzz committed Jul 10, 2023
1 parent 2c6361b commit 8b459f6
Showing 1 changed file with 14 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"import os\n",
"sys.path.insert(1, os.path.join(\"..\",\"..\"))\n",
"import pykep as pk\n",
"import numpy as np\n",
"import paseos\n",
"from paseos import ActorBuilder, SpacecraftActor\n",
"from utils import s2pix_detector, acquire_data\n",
Expand Down Expand Up @@ -55,8 +54,12 @@
"metadata": {},
"outputs": [],
"source": [
"#Define today as pykep epoch (27-10-22)\n",
"#please, refer to https://esa.github.io/pykep/documentation/core.html#pykep.epoch\n",
"today = pk.epoch_from_string('2022-10-27 12:00:00.000')\n",
"\n",
"# Define local actor\n",
"S2B = ActorBuilder.get_actor_scaffold(name=\"Sentinel2-B\", actor_type=SpacecraftActor, epoch=pk.epoch(0))"
"S2B = ActorBuilder.get_actor_scaffold(name=\"Sentinel2-B\", actor_type=SpacecraftActor, epoch=today)"
]
},
{
Expand All @@ -65,30 +68,7 @@
"metadata": {},
"source": [
"#### 1.a) - Add an orbit for S2B\n",
"\n",
"Since **S2B** is orbiting around Earth, let's define `earth` as `pykep.planet` object. \n",
"\n",
"Internally, paseos uses pykep.planet objects to model gravitational acceleration and Keplerian orbits."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "30691b25",
"metadata": {},
"outputs": [],
"source": [
"# Define central body\n",
"earth = pk.planet.jpl_lp(\"earth\")"
]
},
{
"cell_type": "markdown",
"id": "013bf2e2",
"metadata": {},
"source": [
"To find realistic orbits for **S2B**, we can exploit `Two Line Elements (TLEs)` (Downloaded on 27-10-2022). This would allow finding their ephemerides at time = 27-10-2022 12:00:00.\n",
"Please, refer to [Two-line_element_set](https://en.wikipedia.org/wiki/Two-line_element_set) to know more about TLEs."
"We can make use of the [two-line element](https://en.wikipedia.org/wiki/Two-line_element_set) actor creation [inside PASEOS](https://github.com/aidotse/PASEOS/tree/allow_using_TLE#sgp4--two-line-element-tle) for set the orbit of the PASEOS actor (TLE Downloaded on 27-10-2022)."
]
},
{
Expand All @@ -98,38 +78,10 @@
"metadata": {},
"outputs": [],
"source": [
"#Define today as pykep epoch (27-10-22)\n",
"#please, refer to https://esa.github.io/pykep/documentation/core.html#pykep.epoch\n",
"today = pk.epoch_from_string('2022-10-27 12:00:00.000')\n",
"\n",
"sentinel2B_line1 = \"1 42063U 17013A 22300.18652110 .00000099 00000+0 54271-4 0 9998\"\n",
"sentinel2B_line2 = \"2 42063 98.5693 13.0364 0001083 104.3232 255.8080 14.30819357294601\"\n",
"sentinel2B = pk.planet.tle(sentinel2B_line1, sentinel2B_line2)\n",
"\n",
"#Calculating S2B ephemerides.\n",
"sentinel2B_eph=sentinel2B.eph(today)\n"
]
},
{
"cell_type": "markdown",
"id": "8eab58f6",
"metadata": {},
"source": [
"Now we define the actor's orbit for **S2B**."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3567ebb8",
"metadata": {},
"outputs": [],
"source": [
"#Adding orbit around Earth based on previously calculated ephemerides\n",
"ActorBuilder.set_orbit(actor=S2B, \n",
" position=sentinel2B_eph[0], \n",
" velocity=sentinel2B_eph[1], \n",
" epoch=today, central_body=earth)"
"ActorBuilder.set_TLE(S2B, sentinel2B_line1, sentinel2B_line2)"
]
},
{
Expand Down Expand Up @@ -463,7 +415,9 @@
"source": [
"### 3.d) - Showing detected volcanic eruptions\n",
"\n",
"The next plot will show an example of onboard coarse volcanic eruptions detection on some Sentinel-2 L1C tiles. The different eruptions will be surrounded a bounding box, and their coordinates will be printed to raise an alert."
"The next plot will show an example of onboard coarse volcanic eruptions detection on some Sentinel-2 L1C tiles. The different eruptions will be surrounded a bounding box, and their coordinates will be printed to raise an alert.\n",
"\n",
"The execution and rendering of the images may take a few minutes."
]
},
{
Expand All @@ -480,7 +434,9 @@
"cell_type": "code",
"execution_count": null,
"id": "85bbd3ac",
"metadata": {},
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"fig, ax=plt.subplots(1,3,figsize=(10,4))\n",
Expand All @@ -502,7 +458,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 ('paseos')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down

0 comments on commit 8b459f6

Please sign in to comment.