{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Constructing the Geometry" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "What is the Geometry?\n", "---------------------\n", "\n", "Along with the :py:class:`Atmosphere `, the :py:class:`Geometry ` object is one of the fundamental inputs required for a radiative transfer calculation. \n", "\n", "At its core the :py:class:`Geometry ` object is just a list of :py:class:`LineOfSight `. Each :py:class:`LineOfSight ` represents the geometry of a single measurements and is made up by three things:\n", "\n", "* The observer position in geocentric coordinates. For example, [3.676013154788849600e+005, 1.009976313640051500e+006, -6.871601202127538600e+006].\n", "\n", "* A unit look vector also in geocentric coordinates. For example, [2.884568631765662100e-001, 7.925287180643269000e-001, 5.372996083468238900e-001].\n", "\n", "* The time of the measurement, represented as a Modified Julian Date, for example, 54832.5. The time field is used to calculate the solar position.\n", "\n", "Putting these three things together we can create the :py:class:`LineOfSight `" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import sasktran as sk\n", "\n", "line_of_sight = sk.LineOfSight(observer=[3.676013154788849600e+005, 1.009976313640051500e+006, -6.871601202127538600e+006],\n", " look_vector=[2.884568631765662100e-001, 7.925287180643269000e-001, 5.372996083468238900e-001],\n", " mjd=54832.5)\n", "\n", "print(line_of_sight)" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "For lines of sight that are limb viewing, each line of sight is often referred to from its tangent point" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(line_of_sight.tangent_location())" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Multiple lines of sights can be created in the same fashion" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "line_of_sight_2 = sk.LineOfSight(observer=[3.692808540679614500e+005, 1.014590807988641800e+006, -6.870844156040793300e+006],\n", " look_vector=[2.884568631765662100e-001, 7.925287180643269000e-001, 5.372996083468238900e-001],\n", " mjd=54832.5)\n", "\n", "print(line_of_sight_2.tangent_location())" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The :py:class:`Geometry ` object is just a collection of these :py:class:`LineOfSight `" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geometry = sk.Geometry()\n", "\n", "geometry.lines_of_sight = [line_of_sight, line_of_sight_2]\n", "\n", "print(geometry)" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Convenience Classes\n", "-------------------\n", "The default input for the :py:class:`Geometry ` are physical positions and time, which is easy to use if you are trying to model actual measurements from an actual instrument. However, for most simulation work calculating these raw physical lines of sight can be tedious, especially if it is desired to change parameters such as the solar position (which by default is set by the average time of the measurements). For this reason some convenience classes are provided which make geometry calculations simpler in many cases. For limb viewing the most useful convenience class is :py:class:`VerticalImage `, which constructs a vertical set of measurements at a single instant in time based upon the tangent altitudes and solar angles" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from sasktran.geometry import VerticalImage\n", "\n", "geometry = VerticalImage()\n", "geometry.from_sza_saa(sza=60, saa=60, lat=0, lon=0, tanalts_km=[10, 20, 30, 40], mjd=54372, locallook=0,\n", " satalt_km=600, refalt_km=20)\n", "\n", "print(geometry)" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "This creates a :py:class:`Geometry ` object with lines of sight that match the desired solar angles and tangent point information. There is an additional message saying that the sun position is forced to a specific vector, this indicates that the sun is no longer set by the time. The object is still made up of a list of :py:class:`LineOfSight ` objects that we can access directly." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(geometry.lines_of_sight[0])\n", "print('-------------------------------------')\n", "print(geometry.lines_of_sight[0].tangent_location())" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "In cases where there is not a convenience class such as :py:class:`VerticalImage ` that matches your specific use case, there is also a low level :py:class:`Geodetic ` object that can be used to help with constructing lines of sight." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Using the Geodetic Object\n", "-------------------------\n", "The :py:class:`Geodetic ` is a class that is designed to aid with various Earth coordinate systems. One of its major uses is to from geocentric (3 element x,y,z) to latitude, longitude, height, referenced to a specific Earth geoid (by default, IAU 1976). For example, we can convert our observer position used above," ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geo = sk.Geodetic()\n", "\n", "geo.from_xyz([3.692808540679614500e+005, 1.014590807988641800e+006, -6.870844156040793300e+006])\n", "\n", "print(geo)" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Or, we could convert our tangent point above to geocentric coordinates" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geo.from_lat_lon_alt(latitude=-57.49967218373388, longitude=70.0, altitude=12000.000104637467)\n", "\n", "print(geo.location)" ] } ], "metadata": { "celltoolbar": "Raw Cell Format", "kernelspec": { "display_name": "Python [default]", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.2" } }, "nbformat": 4, "nbformat_minor": 2 }