Skip to content

Commit

Permalink
4a mostly finish
Browse files Browse the repository at this point in the history
  • Loading branch information
mlinds committed Nov 30, 2021
1 parent 24de526 commit fa3d6ac
Showing 1 changed file with 100 additions and 9 deletions.
109 changes: 100 additions & 9 deletions assignment2/Assignment2Template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -846,17 +846,25 @@
"\n",
"# loop over all the satelites and add each one to the kml file\n",
"for sat in gpsERS:\n",
" # find the location in ECEF coords\n",
" xsat,vsat = tle.tle2vec(gpsERS,t,sat.name)\n",
" xsate,vsate = crs.eci2ecef(t,xsat=xsat,vsat=vsat)\n",
" # find the lat, long coordinates for kml use\n",
" coords = xyz2coords(xsate)\n",
"\n",
" # add the line string and set the parameters\n",
" linsat = kml.newlinestring(name = sat.name,coords=coords)\n",
" linsat.style.linestyle.color = simplekml.Color.blue\n",
" linsat.altitudemode = 'absolute'\n",
"\n",
" \n",
"###------------------------------------------###\n",
"# ADD THE LINE OF SIGHT\n",
"###------------------------------------------###\n",
"# this variable selects the timestep that will be used\n",
"\n",
"t_select = tle.tledatenum(['2021-11-28 0:00:00'])\n",
"\n",
"# where is iss at this time step? we find it here\n",
"iss_xvalse,iss_vvalse = calculate_iss_ecef(t_select)\n",
"\n",
"for sat in gpsERS:\n",
Expand All @@ -870,13 +878,20 @@
" # add them together for use in satlookangesp function\n",
" combined = np.concatenate((xsate,vsate),axis=1)\n",
"\n",
" # calculate the look angles array and the flags. We only need to use the flags\n",
" lookangle,flags = crs.satlookanglesp(t_select,xsat=combined,xobj=observer_position,swathdef=['VIS', 0, 80, ''])\n",
"\n",
" # check the 'VIS' parameter, if it is there, then add the line to the kml\n",
" if flags[0][2]=='VIS':\n",
" # create a ndarray of tuples in xyz coordinates for the line of sight between the ISS and the GPS sat\n",
" iss_to_sat = np.concatenate((observer_position,xsat),axis=0)\n",
" # convert the xyz coordinates to latlongs\n",
" coords_LOS = xyz2coords(iss_to_sat)\n",
" # create the kml line\n",
" linview = kml.newlinestring(name=sat.name,coords=coords_LOS)\n",
" # set the color\n",
" linview.style.linestyle.color = simplekml.Color.darkred\n",
" # make sure the height displays correctly\n",
" linview.altitudemode = 'absolute'\n",
" \n",
"\n",
Expand All @@ -894,31 +909,107 @@
"\n",
"a.\tMake a function to compute the position of the specular reflection points that are within the field of view (opening angle) of the down looking GPS antenna on board the ISS at a specified moment in time. \n",
"\n",
"Input for this function is: the position of the ISS and GPS satellite positions at a specific time (one epoch only), and the opening angle of the downward looking antenna (40 or 100 degrees). The output should be the position of the specular reflection points (zero, one or more) that fall within the opening angle. For the actual computation you may call the function `specularpoint` from the `specularpoint.py` module that is part of the `CIE4604_M2_Python.zip` distribution. This is also explained in more detail in exercise 8 `CIE4604_M2_Example8_sp.ipynb` notebook.\n",
"Input for this function is: the position of the ISS and GPS satellite positions at a specific time (one epoch only), and the opening angle of the downward looking antenna (40 or 100 degrees). The output should be the position of the specular reflection points (zero, one or more) that fall within the opening angle. For the actual computation you may call the function `specularpoint` from the `specularpoint.py` module that is part of the `CIE4604_M2_Python.zip` distribution. This is also explained in more detail in exercise 8 `CIE4604_M2_Example8_sp.ipynb` notebook.\n"
]
},
{
"cell_type": "code",
"execution_count": 167,
"metadata": {},
"outputs": [],
"source": [
"def find_pts(t,gpssatxe, issxe, opening_angle=40):\n",
" \"\"\"\n",
" accepts a tuple of positions of all 30 GPS satellits, a tuple of the station station position, and an opening angle\n",
"\n",
" returns a tuple of (angle,x,y,z) in cartesian coordinates\n",
"\n",
"b.\tMake a plot with the specular reflection points, ISS and GPS ground tracks in Python for a period of several minutes for two different values of the opening angle.\n",
" \"\"\"\n",
" validspecularpts = []\n",
" for sat in gpssatxe:\n",
" # calculate the look angles array and the flags. We only need to use the flags\n",
" sat1 = (sat[:, None].T)\n",
"\n",
"c.\tVisualize the specular reflection points and reflected signals in Google Earth for two different values of the opening angle (40 degrees and 100 degrees), and add this to the kmz file of question 3c. Make a new kml folder (within the same kmz file) for each opening angle. \n",
" lookangle, flags = crs.satlookanglesp(\n",
" t, xsat=sat1, xobj=issxe, swathdef=['VIS', 0, 80, ''])\n",
" # check the 'VIS' parameter, if it is there,\n",
" if flags[0][2] == 'VIS':\n",
" transmit_sat_coord = sat1[0][:3]\n",
" xp = sp.specularpoint(issxe[0], transmit_sat_coord)\n",
" zrp, arp, _ = sp.xyz2zas(issxe[0], xp)\n",
" ztp, atp, _ = sp.xyz2zas(transmit_sat_coord, xp)\n",
" nadir_to_pt = 180-zrp*180/np.pi\n",
" # check the nadier is within the range\n",
" if nadir_to_pt < opening_angle:\n",
" # unpack xp into a tuple\n",
" nadir_and_pt = (nadir_to_pt, *xp)\n",
" # add it to the list\n",
" validspecularpts.append(nadir_and_pt)\n",
"\n",
"Include in your report a screenshot of Google Earth showing the ISS, GPS and specular reflection point trajectories for a period of several minutes, while showing the direct and reflected signals only for a single epoch."
" return validspecularpts\n",
"\n",
"\n",
"\n",
"\n",
"def find_pts_over_time(t_array):\n",
" \n",
" for t in t_array:\n",
" a = crs.num2datetime(t)\n",
" t = tle.tledatenum(a.isoformat())\n",
" iss_xvalse,iss_vvalse = calculate_iss_ecef(t)\n",
" satpos = np.zeros((len(gpsERS), 6))\n",
" for i, sat in enumerate(gpsERS):\n",
" xsat, vsat = tle.tle2vec(gpsERS, t, sat.name)\n",
" xsate, vsate = crs.eci2ecef(t, xsat=xsat, vsat=vsat)\n",
" iss_xvalse, iss_vvalse = calculate_iss_ecef(t)\n",
" satpos[i] = np.concatenate((xsate, vsate), axis=1)\n",
"\n",
" pts = find_pts(t,satpos,iss_xvalse)\n",
"\n",
" print(pts)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 169,
"metadata": {},
"outputs": [],
"source": [
"# enter here your code and run the cell to produce the result, if you wish you can use more cells"
"find_pts_over_time(tle.tledatenum(['2021-11-28 0:00:00', 24*60 ,1]))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"b.\tMake a plot with the specular reflection points, ISS and GPS ground tracks in Python for a period of several minutes for two different values of the opening angle.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Enter here your answer using markdown. Use one cell for each sub-question. For question 3c do not forget to include the screenshot, you can do this with syntax like `![](screenshot.png)`*."
"\n",
"c.\tVisualize the specular reflection points and reflected signals in Google Earth for two different values of the opening angle (40 degrees and 100 degrees), and add this to the kmz file of question 3c. Make a new kml folder (within the same kmz file) for each opening angle. \n",
"\n",
"Include in your report a screenshot of Google Earth showing the ISS, GPS and specular reflection point trajectories for a period of several minutes, while showing the direct and reflected signals only for a single epoch."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit fa3d6ac

Please sign in to comment.