Space Rocks! A Python Toolbox Tool for Asteroid Hazards' Body-Fixed Coordinate Extraction · 2019....

39
Space Rocks! A Python Toolbox Tool for Asteroid Hazards' Body-Fixed Coordinate Extraction BY JON CUTTS – MS-GIST 2018

Transcript of Space Rocks! A Python Toolbox Tool for Asteroid Hazards' Body-Fixed Coordinate Extraction · 2019....

  • Space Rocks! A Python Toolbox Tool for Asteroid Hazards' Body-Fixed Coordinate Extraction

    BY JON CUTTS – MS-GIST 2018

  • Image © University of Arizona

    OSIRIS-REx: Asteroid Sample Return Mission Origins, Spectral Interpretation, Resource Identification, and Security–

    Regolith Explorer” (OSIRIS-REx)

    ◦ “Prime objective of the OSIRIS-REx mission is to return pristine

    carbonaceous regolith from [asteroid] Bennu”

    (Lauretta, et al., 2017, page 5)

    ◦ University of Arizona led with NASA as stakeholder

    ◦ Dr. Dante Lauretta is the Principal Investigator of the OSIRIS-REx Mission, and a

    University of Arizona professor

    ◦ Launched in September 2016 from Cape Canaveral, FL

  • Accomplishing the Mission High-resolution cameras will provide images of asteroid

    ◦ OSIRIS-REx Camera Suite (OCAMS) built by

    University of Arizona

    ◦ 3 cameras with different field of views (FOVs)

    ◦ 1,000 pixel-wide images will be mosaiced

    Spectrometers and a laser altimeter (LIDAR)

    will provide additional information on

    asteroid temperature, mineral composition,

    and topography

    OSIRIS-REx Camera Suite (OCAMS) Image © University of Arizona/Symeon Platts

  • OSIRIS-REx Instruments Cameras (OCAMS):

    • POLYCAM, MAPCAM, SAMCAM

    Spectrometers:

    • OVIRS, OTES, REXIS

    LIDAR:

    • OLA

    Sample Collection:

    • TAGSAM

    Image © NASA/Goddard/University of Arizona

  • Selecting a Sample-Site on the Asteroid Mission-critical decision of asteroid sample-site selection

    ◦ Mission requirement: collect at least 60 grams of regolith

    ◦ Regolith can be thought of as a carbonaceous asteroid’s “soil” layer

    ◦ Spacecraft instrument data used for four thematic maps:

    1. Deliverability map: ability for the spacecraft to be “delivered” within 25m of sample-site

    2. Safety map: safety to OSIRIS-REx’s sample-collecting instrument arm

    3. Sampleability map: ability of the site to allow collection of 60g of regolith

    4. Science Value map: ability of the site to offer a pristine, scientifically-valuable sample

    Asteroid image © NASA/Goddard/University of Arizona

  • Rock and Boulder Identification Rocks and boulders are hazardous to the OSIRIS-REx spacecraft

    ◦ Identified by users using the images taken by the onboard cameras, OCAMS

    ◦ Locations stored as

    features in shapefiles

    ◦ Locations of hazards will

    be used as one of many

    inputs to the Sampleability

    and Science Value maps

    ◦ Polyline features allow for approximation of a boulder’s center and diameter

    Example of identified rocks (point features)

    Example of identified boulders (polyline features)

  • Rock and Boulder Locations Small bodies, like asteroids, “are often

    irregularly shaped with regions that cannot

    be uniquely addressed with longitude and

    latitude” (DellaGiustina, et al., 2017, page 1)

    ◦ Identification of hazards is not relevant to

    sample-site selection until mapped to the

    body-fixed XYZ coordinates of the asteroid’s

    3D shape model

    Asteroid Bennu at 80 km distance Asteroid image © NASA/Goddard/University of Arizona

    X

    Y

    Z

    ~500 m

  • Body-fixed XYZ Coordinates Image used to identify rocks and boulders is one band of a composite

    band raster dataset

    ◦ Raster is output from United States Geological Survey’s (USGS’s) Integrated

    Software for Imagers and Spectrometers 3 (ISIS3)

    ◦ ISIS3 can project a complex-shaped 3D body’s surface, and corresponding

    attribute values, into a 2D composite band raster dataset: a “backplane”

    ISIS3 composite band raster dataset (“backplane“)

    Image © United States Geological Survey

  • Rock

    Extracting the values from

    the backplane (raster

    bands) for the rock and

    boulder locations, provides

    geometric coordinates.

    Low

    High

  • Process of Coordinate Extraction Existing process used by OSIRIS-REx Image Processing Working Group (IPWG)

    ◦ Manual; many steps where human error could be introduced

    This Master’s Project automates the workflow of body-fixed coordinate extraction from an ISIS3 backplane

    ◦ Interviewed mission’s Image Processing Engineer

    ◦ Gathered task requirements, inputs, mathematical formulas for error-checking, and required outputs

    ◦ Developed an Esri ArcMap™ Python Toolbox Tool

    ◦ 650 lines of code / 20 Esri ArcPy functions

    Image © esri: Python Toolbox

  • Test Data Used During Development During this project’s development, the OSIRIS-REx spacecraft was still en

    route to Bennu and available imagery not yet high-resolution enough for

    identifying rocks and boulders

    ◦ Used test data of comet 67P/Churyumov–Gerasimenko from European

    Space Agency’s (ESA’s) Rosetta mission as projected by ISIS3

    ~4 km 920 m

    Comet 67P/Churyumov–Gerasimenko

    Image © ESA/Rosetta

  • Outline Methods

    ◦ User parameters and input validation

    ◦ Workflow steps

    Results

    ◦ Graphical user interface

    ◦ Status output and warning/error messages

    ◦ Shapefile output

    Conclusion

    References

  • Methods WALKING THROUGH THE WORKFLOW

  • Comet 67P/Churyumov/Gerasimenko

  • Shapefile Input(s)

    Point or Polyline Features? Polyline Point

    ISIS3 Raster Dataset

    Temporary Geodatabase

    Isolate Raster Bands

    Clip Features to Match Raster

    Preserve Shapefile FIDs

    Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Join Points · New Attributes with

    Original Polylines

    Export Final Shapefiles

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Input Validation

    Export Final Shapefiles

    User Parameters and Input Validation

    Required User Parameters:

    ◦ Point and/or polyline shapefile(s)

    ◦ Corresponding ISIS3 raster backplane (.CUB file)

    ◦ Four band minimum (image + XYZ bands)

    ◦ Output folder

    Esri ArcMap™ Licensing Validation

    ◦ Available 3D Analyst & Spatial Analyst licenses

    ◦ Licenses are automatically checked in/out during

    workflow processing

  • Shapefile Input(s)

    Point or Polyline Features? Polyline Point

    ISIS3 Raster Dataset

    Temporary Geodatabase

    Isolate Raster Bands

    Clip Features to Match Raster

    Preserve Shapefile FIDs

    Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Join Points · New Attributes with

    Original Polylines

    Export Final Shapefiles

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Input Validation

    Export Final Shapefiles

    User Parameters and Input Validation

    Optional Latitude/Longitude Test

    ◦ Compares calculated latitude/longitude to

    projected latitude/longitude for error-checking

    ◦ Latitude/longitude formulas are from OSIRIS-REx

    Image Processing Engineer, Carina Bennett

    ◦ Any extraction that is beyond user-defined threshold

    is written to text file log

    ◦ ISIS3 backplane must contain projected latitude &

    longitude raster bands

  • Shapefile Input(s)

    Point or Polyline Features? Polyline Point

    ISIS3 Raster Dataset

    Temporary Geodatabase

    Isolate Raster Bands

    Clip Features to Match Raster

    Preserve Shapefile FIDs

    Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Join Points · New Attributes with

    Original Polylines

    Export Final Shapefiles

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Input Validation

    Export Final Shapefiles

    Creation of Temporary Geodatabase

    Input shapefiles are imported into a temporary

    geodatabase as feature classes

    ◦ Re-created each time Tool is used

    ◦ Workflow processing occurs within geodatabase

    ◦ Some ArcPy functions don’t take shapefiles as inputs

    ◦ More organized for handling interim feature classes

    ◦ After all processing, final output will be time-

    stamped shapefiles in user-defined directory

  • Shapefile Input(s)

    Point or Polyline Features? Polyline Point

    ISIS3 Raster Dataset

    Temporary Geodatabase

    Isolate Raster Bands

    Clip Features to Match Raster

    Preserve Shapefile FIDs

    Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Join Points · New Attributes with

    Original Polylines

    Export Final Shapefiles

    Extract Geometry Information from

    ISIS3 Raster

    Body - fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output of Feature Errors

    Input Validation

    Export Final Shapefiles

    Isolation of Raster Bands ISIS3 backplane bands isolated for processing

    ◦ Last three bands in raster dataset are used as XYZ

    bands, per ISIS3 format specification

    ◦ Optionally, if user selected latitude/longitude

    bands, those will also be isolated

    ◦ Latitude/longitude band indices aren’t fixed

    ◦ Used for the optional Latitude/Longitude Test

  • Shapefile Input(s)

    Point or Polyline Features?

    Polyline Point

    ISIS3 Raster Dataset

    Temporary Geodatabase

    Isolate Raster Bands

    Clip Features to Match Raster

    Preserve Shapefile FIDs

    Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Input Validation

    Export Final Shapefiles

    Preserving of Shapefile FID Shapefiles were imported as feature classes, and

    will be clipped in upcoming step

    ◦ Feature class OBJECTIDs will start at 1, but

    shapefile Feature IDs (FIDs) start at 0

    ◦ Clipping features to the raster footprint will also

    re-order the OBJECTIDs

    Important to preserve the original IDs of the

    features for joining functions

    ◦ “SHP_FID” field is created in feature class and

    preserves data integrity throughout processing

  • Point or Polyline Features?

    Polyline Point

    Isolate Raster Bands

    Clip Features to Match Raster

    Preserve Shapefile FIDs

    Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude / Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Clipping of Features to Raster Footprint

    During user-identification of rocks and boulders,

    point and polyline features could be “drawn”

    outside bounds of ISIS3 backplane raster

    ◦ Would result in extraction of problematic NULL

    values for those features

    Footprint is calculated for raster and used to clip

    features that extend outside its limits

    ◦ Shapefile FID is preserved

    ◦ “3D Analyst” license required for Raster Domain

    geoprocessing

  • Point or Polyline Features?

    Polyline Point

    Isolate Raster Bands

    Clip Features to Match Raster

    Preserve Shapefile FIDs

    Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude /

    Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Accounting for Polylines Coordinates will be extracted from backplane for

    points, but boulders are recorded as polylines

    ◦ Additional processing steps needed for boulders

    ◦ Not needed for rocks: are already point features

    ◦ For sake of presentation, will assume processing

    of boulder features

  • Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude /

    Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Conversion of Polylines to Point Features

    Boulders’ polyline features are converted to

    start, middle, and end vertices

    ◦ Allows for extraction of ISIS3 backplane body-

    fixed XYZ coordinates for boulders

    ◦ Stored in interim-workflow feature classes

    Illustration of polyline-to-point conversion

  • Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude /

    Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Extraction of Body-Fixed Geometry At this point in the workflow:

    ◦ Rock and boulder shapefiles were imported into the temporary geodatabase

    ◦ Shapefile FIDs were preserved

    ◦ ISIS3 backplane raster bands, containing geometric attributes, were isolated

    ◦ Features outside of raster’s footprint were clipped

    ◦ Polyline-features were converted to start, middle, and end point-features

    Extraction of body-fixed XYZ coordinates, and optional latitude/longitude, can now occur.

  • Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude /

    Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Extraction of Body-Fixed Geometry Asteroid body-fixed coordinates are extracted for each feature in the input shapefiles ◦ For rocks, attributes are extracted for a single

    point

    ◦ For boulders, attributes are extracted for the start, middle, and end points of the original polylines

    ◦ “Spatial Analyst” license required for Extract Multi-Values to Points geoprocessing

    ISIS3 composite band raster dataset (“backplane“)

  • Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude /

    Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Calculation of Latitude/Longitude

    Using the extracted body-fixed XYZ coordinates,

    the latitude/longitude of the features are

    calculated and stored as attribute data

    ◦ Formulas provided by OSIRIS-REx Image

    Processing Engineer, Carina Bennett, in SQL

    ◦ After converting them to Python, they are:

    Formula in Python

    Lat. math.asin(z / (math.sqrt((x)**2 + (y)**2 + (z)**2))) * 180 /

    math.pi

    Lon. math.atan2(y, x) * 180 / math.pi - math.floor((math.atan2(y,

    x) * 180 / math.pi) / 360) * 360 Original formulas were provided in SQL by OSIRIS-REx Image Processing Engineer, Carina Bennett

  • Convert Polylines to Start, Mid, End

    Vertices

    Extract Geometry Information from

    ISIS3 Raster

    Body-fixed XYZ

    Coordinates

    Projected Latitude /

    Longitude

    Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Joining of Data to Original Polylines

    Polyline boulder features were converted to

    point features, meaning that:

    ◦ Boulders’ coordinate extractions took place in

    interim-workflow feature classes

    ◦ Preserved, original shapefile FID is key for join to

    occur correctly

    ◦ Rock point-features do not need joining;

    coordinates were extracted directly to points

  • Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Logging of Errors from Lat/Lon Test

    Optional test occurs if user provided band

    indices for latitude/longitude

    ◦ Calculated latitude/longitude is subtracted from

    the extracted, projected latitude/longitude

    ◦ Delta is compared to user-defined threshold

    ◦ Any feature that is outside threshold is written to

    a time-stamped text file with the feature’s ID #

    ◦ Warning message is also posted to ArcMap™’s

    geoprocessing results

  • Calculate Latitude/ Longitude

    Log Output: Feature Errors

    Join Points’ New Attributes with

    Original Polylines

    Export Final Shapefiles

    Exporting of Final Shapefile Output Attribute data of rock and boulder feature classes, processed inside the temporary geodatabase, now contain asteroid body-fixed:

    ◦ X-, Y-, and Z-coordinates

    ◦ Calculated latitude & longitude coordinates

    ◦ Optional projected latitude & longitude coordinates

    Feature classes are exported as time-stamped shapefiles to user-defined output directory

    ◦ Optional Latitude/Longitude Test results will also be written here and to ArcMap™’s geoprocessing results

  • Results USER INTERFACE, STATUS MESSAGES, & SHAPEFILE OUTPUT

  • Results: Graphical User Interface

  • Status Output and Warning/Error Messages

  • Shapefile Output: New Attribute Data

  • Shapefile Output: Why Use Shapefiles? Shapefiles are the required output:

    ◦ Natively recognized by computer filesystems

    ◦ More easily programmatically-accessed by scientists’ algorithms and tools

    than feature classes in a geodatabase

    Output shapefiles are used in further processing by the OSIRIS-REx

    Image Processing Working Group to derive higher-level data products.

    Locations of rocks and boulders will ultimately reside in the mission’s

    Hazard Geodatabase to aid in selection of Bennu’s sample-site

    ◦ One of many inputs to the mission’s Sampleability and Science Value maps

  • Conclusion MISSION ACCOMPLISHED

  • Conclusion “OSIRIS-REx is unique among planetary missions in that all remote sensing is performed to support the sample return objective.” (DellaGiustina, et al., 2016, page 1)

    Critical that OSIRIS-REx scientists know the asteroid 3D body-fixed XYZ locations of hazardous features on Bennu to determine sample-site.

    Locating hazards in body-fixed coordinates achieved through unique methods:

    ◦ USGS ISIS3 software projects a composite band raster dataset that contains the body-fixed geometry information

    ◦ Extraction of these data to identified geographic features

    Image © University of Arizona Image © United States Geological Survey

    Image © esri

  • Conclusion This Master’s Project ArcMap™ Python Toolbox Tool provides:

    ◦ Automation of USGS ISIS3 backplane values extraction for input

    features’ locations;

    ◦ Employs a graphical user interface (GUI), error-trapping, input

    validation, logfile output, in-line help message dialog;

    ◦ Customizable user-defined inputs and outputs.

    Image © University of Arizona Image © United States Geological Survey

    Image © esri

  • Special thanks to: Carina Bennett, OSIRIS-REx, USGS, Esri, and Dr. Chris Lukinbeal THANK YOU!

  • References WORKS CITED

  • References D. N. DellaGiustina, O. S. Barnouin, M. C. Nolan, C. A. Johnson, L. Le Corre and D. S. Lauretta; Lunar and Planetary Laboratory,

    University of Arizona, Tucson, AZ; The Johns Hopkins University Applied Physics Laboratory, Laurel, MD; Planetary Science

    Institute, Tucson, AZ.

    ◦ 2016. Cartographic Planning for the OSIRIS-REx Asteroid Sample Return Mission.

    D.S. Lauretta, S.S. Balram-Knutson, E. Beshore, W.V. Boynton, C. Drouet d’Aubigny, D.N. DellaGiustina, H.L. Enos, D.R. Golish,

    C.W. Hergenrother, E.S. Howell, C.A. Bennett, E.T. Morton, M.C. Nolan, B. Rizk, H.L. Roper, A.E. Bartels, B.J. Bos, J.P. Dworkin, D.E.

    Highsmith, D.A. Lorenz, L.F. Lim, R. Mink, M.C. Moreau, J.A. Nuth, D.C. Reuter, A.A. Simon, E.B. Bierhaus, B.H. Bryan, R. Ballouz,

    O.S. Barnouin, R.P. Binzel, W.F. Bottke, V.E. Hamilton, K.J. Walsh, S.R. Chesley, P.R. Christensen, B.E. Clark, H.C. Connolly, M.K.

    Crombie, M.G. Daly, J.P. Emery, T.J. McCoy, J.W. McMahon, D.J. Scheeres, S. Messenger, K. Nakamura-Messenger, K. Righter, S.A.

    Sandford.

    ◦ 2017. OSIRIS-REx: Sample Return from Asteroid (101955) Bennu.

    D. N. DellaGiustina, C. A. Bennett, D. R. Golish and N. Habib; Lunar and Planetary Laboratory, University of Arizona, Tucson, AZ.

    ◦ 2017. Generating Photomosaics of Small Bodies in Preparation for the OSIRIS-REx Encounter with Asteroid Bennu.

    All images copyright of their respective owners: citations are in-line and appear next to images.