## org.das2.datum.Orbits

Orbits are a map of string identifiers to DatumRanges, typically used to enumerate the orbits a spacecraft makes. For example, Cassini orbit "C" was from 2004-366T07:03 to 2005-032T03:27 and "33" was from 2006-318T23:34 to 2006-330T22:23. There are two types of orbits: canonical, which have an identifier like "cassini" and can be used by the community, and user which have identifiers like https://raw.githubusercontent.com/autoplot/orbits/main/psp/psp-aa25.txt. In either case, these refer to a file. The canonical ones are stored on the das2 website at http://das2.org/Orbits/<id>.dat. This file is a three-column ASCII file with the orbit id in either the first or last column. Note any line not meeting this spec is ignored, so that orbit files can contain additional documentation (and can sit within a wiki).

## compare

compare( String a, String b ) → int

return -1 if a is before b, 0 if they are equal, and 1 if a is after b.

### Parameters

a - a String
b - a String

### Returns:

an int
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## first

first( ) → String

return the first orbit id, so that we can iterate through all

### Returns:

a String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getDatumRange

getDatumRange( String orbit ) → DatumRange

return the DatumRange for this orbit number. Note this IS NOT an OrbitDatumRange.

### Parameters

orbit - a String

### Returns:

a DatumRange
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getOrbit

getOrbit( Datum d ) → String

returns the first orbit containing the time, or null if none do.

### Parameters

d - a Datum

### Returns:

the orbit number or null
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getOrbitOnOrBefore

getOrbitOnOrBefore( Datum d ) → String

return the closest orbit on or before datum d.

### Parameters

d - the datum

### Returns:

the id of the closest orbit before, or null.

### See Also:

http://jfaden.net/~jbf/autoplot/script/demos/jeremy/onOrBefore.jy
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getOrbitsFor

getOrbitsFor( String sc ) → org.das2.datum.Orbits

Return the orbits for the named spacecraft, or those described in the file pointed to the URL when the "sc" identifier is a URL. Example files may be on the wiki page http://das2.org/wiki/index.php/Orbits.<SC%gt;, or on the classpath in /orbits/<SC>.dat The orbits file will be read by ignoring any line that does not contain three non-space blobs, and either the first two or last two should parse as an ISO8601 string. The ISO8601 strings must start with 4-digit years, either Note the input can then be html, with a pre section containing the orbits. Note the wiki page is the source for cassini and crres, but other missions may come from special places encoded here. Mediawiki introduced two problems: first, that typos were not identified clearly because a 200 (ok) code is returned for any URL. Second, it's not trivial to set up mirrors that put data into the wiki. For this reason, the wiki should only be used as a reference for humans and other use is discouraged. This now uses special code for rbspb-pp and rbspa-pp that looks at UIowa, LANL and at virbo.org. This should not be called from the event thread, because it may block briefly while the orbits are loaded.

### Parameters

sc - the string identifier for the spacecraft, such as "rbspa-pp", or URL to orbit file.

### Returns:

the Orbits file which can be used to query orbits.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getSpacecraft

getSpacecraft( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getSpacecraftIdExamples

getSpacecraftIdExamples( ) → java.util.Map

return examples of spacecraft ids which can be used, and a human-readable label in a linked hash map. This may fall out-of-sync with the list of IDs which would work (see https://das2.org/Orbits/), but this should be considered a bug.

### Returns:

map from id to description.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getURL

getURL( ) → java.net.URL

return the URL used to populate the orbits.

### Returns:

a java.net.URL
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## isOrbitsFile

isOrbitsFile( String sc ) → boolean

provide method for clients to see if the URI represents an orbits file, without constantly going into the synchronized block, which was causing things to hang for Masafumi.

### Parameters

sc - the string identifier for the spacecraft, such as "rbspa-pp", or URL to orbit file.

### Returns:

true if the uri refers to orbits.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## last

last( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## main

main( String[] args ) → void

### Parameters

args - a java.lang.String[]

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## next

next( String orbit ) → String

return the next orbit number, or null if there are no more orbit numbers.

### Parameters

orbit - a String

### Returns:

the orbit number or null.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## prev

prev( String orbit ) → String

return the previous orbit number, or null if there are no more orbit numbers.

### Parameters

orbit - a String

### Returns:

the orbit number or null.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## reset

reset( ) → void

reset the loaded missions.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## resetOrbitsFor

resetOrbitsFor( String sc ) → org.das2.datum.Orbits

force a reload of the orbits file. TODO: ideally the freshness of the orbits file would be checked every ten seconds, but there's quite a bit of coding to do that properly. This will force the reload, for example when the green play button is pressed on the Autoplot Events List.

### Parameters

sc - the string identifier for the spacecraft, such as "rbspa-pp", or URL to orbit file.

### Returns:

reread Orbits.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## trimOrbit

trimOrbit( String orbit ) → String

Orbit numbers are typically just a number, but some missions like Cassini had letter names for orbits as well. This encapsulates the code to identify the canonical orbit from the string, by removing trailing _'s and 0's.

### Parameters

orbit - a String

### Returns:

a String
[search for examples] [view on GitHub] [view on old javadoc] [view source]