::: content
[;{.source}]{.comments} {.source}[; NOSA HEADER START{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; The contents of this file are subject to the terms of the NASA Open{.source}]{.comments} {.source}[; Source Agreement (NOSA), Version 1.3 only (the "Agreement"). You may{.source}]{.comments} {.source}[; not use this file except in compliance with the Agreement.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; You can obtain a copy of the agreement at{.source}]{.comments} {.source}[; docs/NASA_Open_Source_Agreement_1.3.txt{.source}]{.comments} {.source}[; or{.source}]{.comments} {.source}[; https://sscweb.gsfc.nasa.gov/WebServices/NASA_Open_Source_Agreement_1.3.txt.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; See the Agreement for the specific language governing permissions{.source}]{.comments} {.source}[; and limitations under the Agreement.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; When distributing Covered Code, include this NOSA HEADER in each{.source}]{.comments} {.source}[; file and include the Agreement file at{.source}]{.comments} {.source}[; docs/NASA_Open_Source_Agreement_1.3.txt. If applicable, add the{.source}]{.comments} {.source}[; following below this NOSA HEADER, with the fields enclosed by{.source}]{.comments} {.source}[; brackets "[]" replaced with your own identifying information:{.source}]{.comments} {.source}[; Portions Copyright [yyyy] [name of copyright owner]{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; NOSA HEADER END{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; Copyright (c) 2013-2021 United States Government as represented by the{.source}]{.comments} {.source}[; National Aeronautics and Space Administration. No copyright is claimed{.source}]{.comments} {.source}[; in the United States under Title 17, U.S.Code. All Other Rights {.source}]{.comments} {.source}[; Reserved.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[;+{.source}]{.comments} {.source}[; This file contains a procedure-oriented wrapper to a subset of{.source}]{.comments} {.source}[; functionality from the SpdfSsc class (IDL client interface to{.source}]{.comments} {.source}[; <a href="https://sscweb.gsfc.nasa.gov/WebServices">{.source}]{.comments} {.source}[; Satellite Situation Center Web Services</a> (SSC WSs)) library.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; @copyright Copyright (c) 2013-2021 United States Government as {.source}]{.comments} {.source}[; represented by the National Aeronautics and Space {.source}]{.comments} {.source}[; Administration. No copyright is claimed in the United States {.source}]{.comments} {.source}[; under Title 17, U.S.Code. All Other Rights Reserved.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; @author B. Harris{.source}]{.comments} {.source}[;-{.source}]{.comments} {.source}[;+{.source}]{.comments} {.source}[; This function gets basic location information for a single satellite{.source}]{.comments} {.source}[; from <a href="https://www.nasa.gov/">NASA</a>'s{.source}]{.comments} {.source}[; <a href="https://spdf.gsfc.nasa.gov/">Space Physics Data Facility</a>{.source}]{.comments} {.source}[; <a href="https://sscweb.gsfc.nasa.gov/">Satellite Situation Center</a>.{.source}]{.comments} {.source}[; More comprehensive information if available by using {.source}]{.comments} {.source}[; <code>SpdfSsc::getLocations()</code>.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; @param satellite {in} {type=string}{.source}]{.comments} {.source}[; identifies the satellite whose location is to be gotten.{.source}]{.comments} {.source}[; @param timeSpan {in} {type=strarr(2)}{.source}]{.comments} {.source}[; ISO 8601 format strings of the start and stop times of the{.source}]{.comments} {.source}[; data to get.{.source}]{.comments} {.source}[; @keyword coordinateSystem {in} {optional} {type=string} {.source}]{.comments} {.source}[; {default='Gse'}{.source}]{.comments} {.source}[; specifies the coordinate system. Must be one of the {.source}]{.comments} {.source}[; following values: Geo, Gm, Gsm, Sm, GeiTod, or GeiJ2000.{.source}]{.comments} {.source}[; @keyword resolutionFactor {in} {optional} {type=int} {default=1}{.source}]{.comments} {.source}[; resolution factor. A value of 3 will return every third{.source}]{.comments} {.source}[; point.{.source}]{.comments} {.source}[; @keyword endpoint {in} {optional} {type=string}{.source}]{.comments} {.source}[; {default='https://sscweb.gsfc.nasa.gov/WS/sscr/2'}{.source}]{.comments} {.source}[; URL of SSC web service.{.source}]{.comments} {.source}[; @keyword quiet {in} {optional} {type=boolean} {default=false}{.source}]{.comments} {.source}[; SpdfGetLocations normally prints an error message if no {.source}]{.comments} {.source}[; data is found. If QUIET is set, no error messages is {.source}]{.comments} {.source}[; printed.{.source}]{.comments} {.source}[; @keyword httpErrorReporter {in} {optional}{.source}]{.comments} {.source}[; {type=SpdfHttpErrorReporter}{.source}]{.comments} {.source}[; used to report an HTTP error.{.source}]{.comments} {.source}[; @keyword sslVerifyPeer {in} {optional} {type=int} {default=1}{.source}]{.comments} {.source}[; Specifies whether the authenticity of the peer's SSL{.source}]{.comments} {.source}[; certificate should be verified. When 0, the connection{.source}]{.comments} {.source}[; succeeds regardless of what the peer SSL certificate{.source}]{.comments} {.source}[; contains.{.source}]{.comments} {.source}[; @returns SpdfLocations object containing requested data.{.source}]{.comments} {.source}[; @examples{.source}]{.comments} {.source}[; <pre>{.source}]{.comments} {.source}[; l = spdfGetLocations('ace', {.source}]{.comments} {.source}[; ['2013-01-01T00:00:00.000Z', '2013-01-03T00:00:00.000Z']){.source}]{.comments} {.source}[; p = plot3d(l->getX(), l->getY(), l->getZ(), window_title='Orbit'){.source}]{.comments} {.source}[; </pre>{.source}]{.comments} {.source}[;-{.source}]{.comments} {.source}[]{#SpdfGetLocations:source}function SpdfGetLocations, $ satellite, $ timeSpan, $ coordinateSystem = coordinateSystem, $ resolutionFactor = resolutionFactor, $ endpoint = endpoint, $ quiet = quiet, $ httpErrorReporter = httpErrorReporter, $ sslVerifyPeer = sslVerifyPeer compile_opt idl2 if keyword_set(coordinateSystem) then begin coordinateSystem = $ spdfFixCoordinateSystemCase(coordinateSystem) if coordinateSystem eq '' then begin if ~keyword_set(quiet) then begin print, 'Invalid coordinateSystem value' endif return, obj_new() endif endif else begin coordinateSystem = 'Gse' endelse if ~keyword_set(resolutionFactor) then begin resolutionFactor = 1 endif ssc = obj_new('SpdfSsc', $ endpoint = endpoint, $ userAgent = 'SpdfGetLocations', $ sslVerifyPeer = sslVerifyPeer) timeInterval = $ obj_new('SpdfTimeInterval', timeSpan[0], timeSpan[1]) if ~keyword_set(httpErrorReporter) then begin httpErrorReporter = obj_new('SpdfHttpErrorReporter') endif sats = objarr(1) sats[0] = obj_new('SpdfSatelliteSpecification', satellite, $ resolutionFactor) coordinateOptions = objarr(5) coordinateOptions[0] = $ obj_new('SpdfCoordinateOptions', coordinateSystem, 'X') coordinateOptions[1] = $ obj_new('SpdfCoordinateOptions', coordinateSystem, 'Y') coordinateOptions[2] = $ obj_new('SpdfCoordinateOptions', coordinateSystem, 'Z') coordinateOptions[3] = $ obj_new('SpdfCoordinateOptions', coordinateSystem, 'Lat') coordinateOptions[4] = $ obj_new('SpdfCoordinateOptions', coordinateSystem, 'Lon') outputOptions = $ obj_new('SpdfOutputOptions', coordinateOptions) locationRequest = $ obj_new('SpdfSscDataRequest', $ timeInterval, $ sats, $ outputOptions, $ description = 'Locator request.') locations = $ ssc->getLocations( $ locationRequest, $ httpErrorReporter = httpErrorReporter) if ~obj_valid(locations) then begin if ~keyword_set(quiet) then begin print, 'getLocations return null' endif return, obj_new() endif statusCode = locations->getStatusCode() if statusCode eq 'Error' then begin if ~keyword_set(quiet) then begin print, 'status: ', statusCode subCode = locations->getStatusSubCode() print, 'statusSubCode: ', subCode statusText = locations->getStatusText() print, 'statusText: ', statusText endif return, obj_new() endif data = locations->getData() if ~obj_valid(data[0]) then begin if ~keyword_set(quiet) then begin print, 'No data returned' print, 'status: ', statusCode subCode = locations->getStatusSubCode() print, 'statusSubCode: ', subCode statusText = locations->getStatusText() print, 'statusText: ', statusText endif return, obj_new() endif id = data[0]->getId() time = data[0]->getTime() coordData = data[0]->getCoordinateData() coordinateSystem = coordData->getCoordinateSystem() x = coordData->getX() y = coordData->getY() z = coordData->getZ() lat = coordData->getLatitude() lon = coordData->getLongitude() localTime = coordData->getLocalTime() return, obj_new('SpdfLocations', $ id, time, coordinateSystem, $ x = x, y = y, z = z, $ latitude = lat, longitude = lon, localTime = localTime) end {.source}[;+{.source}]{.comments} {.source}[; Corrects the case of the given value.{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; @private{.source}]{.comments} {.source}[;{.source}]{.comments} {.source}[; @param coordinateSystem {in} {type=string}{.source}]{.comments} {.source}[; a coordinate system identifier.{.source}]{.comments} {.source}[; @returns a coordinate system identifier with the correct (camel){.source}]{.comments} {.source}[; case. If the input value cannot be mapped to a valid coordinate{.source}]{.comments} {.source}[; system value, then an empty string ('') is returned.{.source}]{.comments} {.source}[;-{.source}]{.comments} {.source}[]{#spdfFixCoordinateSystemCase:source}function spdfFixCoordinateSystemCase, $ coordinateSystem compile_opt idl2 case strlowcase(coordinateSystem) of 'geo' : return, 'Geo' 'gm' : return, 'Gm' 'gse' : return, 'Gse' 'gsm' : return, 'Gsm' 'sm' : return, 'Sm' 'geitod' : return, 'GeiTod' 'geij2000': return, 'GeiJ2000' else : return, '' endcase end {.source}
:::