pro SpdfPrintDataResult, $
dataResult
compile_opt idl2
data = dataResult->getData()
if ~obj_valid(data[0]) then begin
print, 'No data returned'
print, 'status: ', statusCode
subCode = locations->getStatusSubCode()
print, 'statusSubCode: ', subCode
statusText = locations->getStatusText()
print, 'statusText: ', statusText
return
endif
for i = 0, n_elements(data) - 1 do begin
id = data[i]->getId()
print, "Satellite: ", id
time = data[i]->getTime()
coordData = data[i]->getCoordinateData()
coordinateSystem = coordData->getCoordinateSystem()
x = coordData->getX()
y = coordData->getY()
z = coordData->getZ()
lat = coordData->getLatitude()
lon = coordData->getLongitude()
localTime = coordData->getLocalTime()
bTraceData = data[i]->getBTraceData()
radialLength = data[i]->getRadialLength()
magneticStrength = data[i]->getMagneticStrength()
bGseX = data[i]->getBGseX()
bGseY = data[i]->getBGseY()
bGseZ = data[i]->getBGseZ()
neutralSheetDistance = data[i]->getNeutralSheetDistance()
bowshockDistance = data[i]->getBowShockDistance()
magnetoPauseDistance = data[i]->getMagnetoPauseDistance()
dipoleLValue = data[i]->getDipoleLValue()
dipoleInvariantLatitude = data[i]->getDipoleInvariantLatitude()
spacecraftRegions = data[i]->getSpacecraftRegion()
radialTracedFootpointRegions = $
data[i]->getRadialTracedFootpointRegions()
northBTracedFootpointRegions = $
data[i]->getNorthBTracedFootpointRegions()
southBTracedFootpointRegions = $
data[i]->getSouthBTracedFootpointRegions()
print, ''
print, 'Coordinate System: ', strupcase(coordinateSystem)
print, 'Time X Y Z'
for j = 0, n_elements(time) - 1 do begin
caldat, time[j], month, day, year, hour, min, sec
print, $
format='(%"%d-%02d-%02dT%02d:%02d:%02dZ %f, %f, %f")', $
year, month, day, hour, min, sec, x[j], y[j], z[j]
endfor
print, ''
print, 'Coordinate System: ', strupcase(coordinateSystem)
print, 'Time Latitude Longitude Local Time'
for j = 0, n_elements(time) - 1 do begin
caldat, time[j], month, day, year, hour, min, sec
print, $
format='(%"%d-%02d-%02dT%02d:%02d:%02dZ %f, %f, %f")', $
year, month, day, hour, min, sec, lat[j], lon[j], $
localTime[j]
endfor
for k = 0, n_elements(bTraceData) - 1 do begin
print, ''
print, 'Magnetic Field Trace Information'
print, 'Coordinate System: ', $
strupcase(bTraceData[k]->getCoordinateSystem())
print, 'Hemisphere: ', bTraceData[k]->getHemisphere()
lat = bTraceData[k]->getLatitude()
lon = bTraceData[k]->getLongitude()
arcLen = bTraceData[k]->getArcLength()
print, 'Time Latitude Longitude Arc Length'
for j = 0, n_elements(lat) - 1 do begin
caldat, time[j], month, day, year, hour, min, sec
print, format='(%"%d-%02d-%02dT%02d:%02d:%02dZ %f %f %f")', $
year, month, day, hour, min, sec, $
lat[j], lon[j], arcLen[j]
endfor
endfor
print, ''
print, ' Footpoint Regions'
print, ' Space Magnetic Field'
print, 'Time Region Radial North South'
for j = 0, n_elements(time) - 1 do begin
caldat, time[j], month, day, year, hour, min, sec
print, format='(%"%d-%02d-%02dT%02d:%02d:%02dZ %s %s %s %s")', $
year, month, day, hour, min, sec, $
spacecraftRegions[j], radialTracedFootpointRegions[j], $
northBTracedFootpointRegions[j], $
southBTracedFootpointRegions[j]
endfor
print, ''
print, ' Radial Dipole Invariant '
print, 'Time Length L Value Latitude'
for j = 0, n_elements(time) - 1 do begin
caldat, time[j], month, day, year, hour, min, sec
print, format='(%"%d-%02d-%02dT%02d:%02d:%02dZ %e %e %e")', $
year, month, day, hour, min, sec, $
radialLength[j], $
dipoleLValue[j], dipoleInvariantLatitude[j]
endfor
print, ''
print, ' Magnetic Field '
print, ' GSE'
print, 'Time Strength X Y Z
for j = 0, n_elements(time) - 1 do begin
caldat, time[j], month, day, year, hour, min, sec
print, format='(%"%d-%02d-%02dT%02d:%02d:%02dZ %f %f %f %f")', $
year, month, day, hour, min, sec, $
magneticStrength[j], bGseX[j], bGseY[j], bGseZ[j]
endfor
print, ''
print, ' Distances to '
print, ' Neutral Magneto'
print, 'Time Sheet Bowshock Pause'
for j = 0, n_elements(time) - 1 do begin
caldat, time[j], month, day, year, hour, min, sec
print, format='(%"%d-%02d-%02dT%02d:%02d:%02dZ %e %e %e %e %e %e %e")', $
year, month, day, hour, min, sec, $
neutralSheetDistance[j], bowshockDistance[j], $
magnetoPauseDistance[j]
endfor
endfor
end
pro SpdfPrintFileResult, $
fileResult
compile_opt idl2
files = fileResult->getFiles()
for i = 0, n_elements(files) - 1 do begin
localFile = files[i]->getFile()
print, 'File downloaded to ', localFile
endfor
end
pro SpdfSscWsExample, $
endpoint = endpoint, $
sslVerifyPeer = sslVerifyPeer
compile_opt idl2
if n_elements(sslVerifyPeer) eq 0 then begin
sslVerifyPeer = 1
endif
ssc = $
obj_new('SpdfSsc', $
endpoint=endpoint, $
sslVerifyPeer=sslVerifyPeer, $
userAgent = 'WsExample')
errReporter = obj_new('SpdfHttpErrorReporter')
observatories = $
ssc->getObservatories(httpErrorReporter = errReporter)
print, 'Observatories:'
for i = 0, n_elements(observatories) - 1 do begin
id = (observatories[i])->getId()
name = (observatories[i])->getName()
spaseId = (observatories[i])->getResourceId()
print, ' ', id, ' ', name, ' ', spaseId
spaseGroupIds = (observatories[i])->getGroupIds()
for j = 0, n_elements(spaseGroupIds) - 1 do begin
if strlen(spaseGroupIds[j]) gt 0 then begin
print, ' ', spaseGroupIds[j]
endif
endfor
endfor
print
obj_destroy, observatories
groundStations = $
ssc->getGroundStations(httpErrorReporter = errReporter)
print, 'Ground Stations:'
for i = 0, n_elements(groundStations) - 1 do begin
location = (groundStations[i])->getLocation()
latitude = location->getLatitude()
longitude = location->getLongitude()
print, ' ', (groundStations[i])->getId(), ' ', $
(groundStations[i])->getName(), ' ', latitude, $
' ', longitude
endfor
print
obj_destroy, groundStations
timeInterval = $
obj_new('SpdfTimeInterval', $
julday(1, 2, 2008, 11, 0, 0), $
julday(1, 2, 2008, 11, 30, 0))
sats = objarr(2)
sats[0] = obj_new('SpdfSatelliteSpecification', 'themisa', 2)
sats[1] = obj_new('SpdfSatelliteSpecification', 'themisb', 2)
locationFilter = $
obj_new('SpdfLocationFilter', $
minimum = 0b, maximum = 0b, $
lowerLimit = -36000.0d, upperLimit = -35000.0d)
coordinateOptions = objarr(6)
coordinateOptions[0] = $
obj_new('SpdfCoordinateOptions', 'Gse', 'X')
coordinateOptions[1] = $
obj_new('SpdfCoordinateOptions', 'Gse', 'Y')
coordinateOptions[2] = $
obj_new('SpdfCoordinateOptions', 'Gse', 'Z')
coordinateOptions[3] = $
obj_new('SpdfCoordinateOptions', 'Gse', 'Lat')
coordinateOptions[4] = $
obj_new('SpdfCoordinateOptions', 'Gse', 'Lon')
coordinateOptions[5] = $
obj_new('SpdfCoordinateOptions', 'Gse', 'Local_Time')
regionOptions = $
obj_new('SpdfRegionOptions', $
/spacecraft, /radialTracedFootpoint, $
/northBTracedFootpoint, /southBTracedFootpoint)
valueOptions = $
obj_new('SpdfValueOptions', $
/radialDistance, /bFieldStrength, $
/dipoleLValue, /dipoleInvLat)
distanceFromOptions = $
obj_new('SpdfDistanceFromOptions', $
/neutralSheet, /bowShock, /mPause, /bGseXYZ)
bFieldTraceOptions = objarr(2)
bFieldTraceOptions[0] = $
obj_new('SpdfBFieldTraceOptions', $
coordinateSystem = 'Geo', $
hemisphere = 'North', $
/footpointLatitude, /footpointLongitude, /fieldLineLength)
bFieldTraceOptions[1] = $
obj_new('SpdfBFieldTraceOptions', $
coordinateSystem = 'Geo', $
hemisphere = 'South', $
/footpointLatitude, /footpointLongitude, /fieldLineLength)
outputOptions = $
obj_new('SpdfOutputOptions', $
coordinateOptions, $
/allLocationFilters, $
regionOptions = regionOptions, $
valueOptions = valueOptions, $
distanceFromOptions = distanceFromOptions, $
minMaxPoints = 2, $
bFieldTraceOptions = bFieldTraceOptions)
bFieldModel = obj_new('SpdfTsyganenko96BFieldModel')
formatOptions = $
obj_new('SpdfFormatOptions', cdf=0b)
locationRequest = $
obj_new('SpdfSscDataRequest', $
timeInterval, $
sats, $
outputOptions, $
description = 'Simple locator request.', $
bFieldModel = bFieldModel)
locations = $
ssc->getLocations( $
locationRequest, $
httpErrorReporter = errReporter)
if ~obj_valid(locations) then begin
print, 'getLocations returned an invalid object'
return
endif
statusCode = locations->getStatusCode()
if statusCode eq 'Error' then begin
print, 'status: ', statusCode
subCode = locations->getStatusSubCode()
print, 'statusSubCode: ', subCode
statusText = locations->getStatusText()
print, 'statusText: ', statusText
endif
if obj_isa(locations, 'SpdfSscDataResult') then begin
SpdfPrintDataResult, locations
endif else begin
SpdfPrintFileResult, locations
endelse
obj_destroy, locations
obj_destroy, locationRequest
obj_destroy, formatOptions
obj_destroy, bFieldModel
obj_destroy, outputOptions
for i = 0, n_elements(bFieldTraceOptions) - 1 do $
obj_destroy, bFieldTraceOptions[i]
obj_destroy, distanceFromOptions
obj_destroy, valueOptions
obj_destroy, regionOptions
for i = 0, n_elements(coordinateOptions) - 1 do $
obj_destroy, coordinateOptions[i]
obj_destroy, locationFilter
for i = 0, n_elements(sats) - 1 do obj_destroy, sats[i]
obj_destroy, timeInterval
obj_destroy, errReporter
obj_destroy, ssc
end