Coda Class Reference

Main Page Classes

Static Public Member Functions | List of all members
Coda Class Reference

## Static Public Member Functions
static int | c_index_to_fortran_index (int[] dim, int index) throws CodaException
static int | isNaN (double x)
static double | NaN ()
static int | isInf (double x)
static int | isPlusInf (double x)
static int | isMinInf (double x)
static double | PlusInf ()
static double | MinInf ()
static double | time_parts_to_double (int year, int month, int day, int hour, int minute, int second, int musec) throws CodaException
static double | time_parts_to_double_utc (int year, int month, int day, int hour, int minute, int second, int musec) throws CodaException
static int[] | time_double_to_parts (double datetime) throws CodaException
static int[] | time_double_to_parts_utc (double datetime) throws CodaException
static String | time_parts_to_string (int year, int month, int day, int hour, int minute, int second, int musec, String format) throws CodaException
static int[] | time_string_to_parts (String format, String str) throws CodaException
static String | time_double_to_string (double datetime, String format) throws CodaException
static String | time_double_to_string_utc (double datetime, String format) throws CodaException
static double | time_string_to_double (String format, String str) throws CodaException
static double | time_string_to_double_utc (String format, String str) throws CodaException
static void | set_option_bypass_special_types (int enable) throws CodaException
static int | get_option_bypass_special_types ()
static void | set_option_perform_boundary_checks (int enable) throws CodaException
static int | get_option_perform_boundary_checks ()
static void | set_option_perform_conversions (int enable) throws CodaException
static int | get_option_perform_conversions ()
static void | set_option_use_fast_size_expressions (int enable) throws CodaException
static int | get_option_use_fast_size_expressions ()
static void | set_option_use_mmap (int enable) throws CodaException
static int | get_option_use_mmap ()
static void | setDefinitionPath (String path) throws CodaException
static void | setDefinitionPathConditional (String file, String searchpath, String relativeLocation) throws CodaException
static void | init () throws CodaException
static void | done ()
static String | version ()

## Detailed Description

CODA General class.

The CODA general class 'Coda' contains the global CODA utility functions that do not require a specific CODA data structure.

It is not possible or necessary to construct an instance of the Coda class. All methods in this class are static class methods, and can be invoked as 'Coda.methodName()'.

## Member Function Documentation

## ◆ c_index_to_fortran_index()

static int c_index_to_fortran_index | ( | int[] | dim,
|  | int | index
| ) |  | throws CodaException
| static

Convert an index for a multidimensional array that is stored in C-style order to an index for an identical array stored in Fortran-style order.

Parameters

  dim | Number of dimensions of the multidimensional array.
  index | `C` style index.

Returns
  `Fortran` style index.

Exceptions

  CodaException | If an error occurred.

## ◆ done()

static void done | ( |  | ) |
| static

Finalizes CODA.

## ◆ get_option_bypass_special_types()

static int get_option_bypass_special_types | ( |  | ) |
| static

Retrieve the current setting for the special types bypass option.

Returns
  - `0`, Bypassing of special types is disabled.
  - `1`, Bypassing of special types is enabled.

## ◆ get_option_perform_boundary_checks()

static int get_option_perform_boundary_checks | ( |  | ) |
| static

Retrieve the current setting for the boundary check option.

Returns
  - `0`, Boundary checking is disabled.
  - `1`, Boundary checking is enabled.

## ◆ get_option_perform_conversions()

static int get_option_perform_conversions | ( |  | ) |
| static

Retrieve the current setting for the value/unit conversion option.

Returns
  - `0`, Unit/value conversions are disabled.
  - `1`, Unit/value conversions are enabled.

## ◆ get_option_use_fast_size_expressions()

static int get_option_use_fast_size_expressions | ( |  | ) |
| static

Retrieve the current setting for the use of fast size expressions option.

Returns
  - `0`, Unit/value conversions are disabled.
  - `1`, Unit/value conversions are enabled.

## ◆ get_option_use_mmap()

static int get_option_use_mmap | ( |  | ) |
| static

Retrieve the current setting for the use of memory mapping of files.

Returns
  - `0`, Memory mapping of files is disabled.
  - `1`, Memory mapping of files is enabled.

## ◆ init()

static void init | ( |  | ) | throws CodaException
| static

Initializes CODA.

Exceptions

  CodaException | If an error occurred.

## ◆ isInf()

static int isInf | ( | double | x | ) |
| static

Find out whether a double value equals inf (either positive or negative infinity).

Parameters

  x | A double value.

Returns
  - `1`, The double value equals inf.
  - `0`, The double value does not equal inf.

## ◆ isMinInf()

static int isMinInf | ( | double | x | ) |
| static

Find out whether a double value equals -inf (negative infinity).

Parameters

  x | A double value.

Returns
  - `1`, The double value equals -inf.
  - `0`, The double value does not equal -inf.

## ◆ isNaN()

static int isNaN | ( | double | x | ) |
| static

Find out whether a double value equals NaN (Not a Number).

Parameters

  x | A double value.

Returns
  - `1`, The double value equals NaN.
  - `0`, The double value does not equal NaN.

## ◆ isPlusInf()

static int isPlusInf | ( | double | x | ) |
| static

Find out whether a double value equals +inf (positive infinity).

Parameters

  x | A double value.

Returns
  - `1`, The double value equals +inf.
  - `0`, The double value does not equal +inf.

## ◆ MinInf()

static double MinInf | ( |  | ) |
| static

Retrieve a double value that respresents -inf (negative infinity).

Returns
  The double value '-inf'.

## ◆ NaN()

static double NaN | ( |  | ) |
| static

Retrieve a double value that respresents NaN (Not a Number).

Returns
  The double value 'NaN'.

## ◆ PlusInf()

static double PlusInf | ( |  | ) |
| static

Retrieve a double value that respresents +inf (positive infinity).

Returns
  The double value '+inf'.

## ◆ set_option_bypass_special_types()

static void set_option_bypass_special_types | ( | int | enable | ) | throws CodaException
| static

Enable/Disable the use of special types.

Parameters

  enable | 0: Disable bypassing of special types. 1: Enable bypassing of special types.

Exceptions

  CodaException | If an error occurred.

## ◆ set_option_perform_boundary_checks()

static void set_option_perform_boundary_checks | ( | int | enable | ) | throws CodaException
| static

Enable/Disable boundary checking.

Parameters

  enable | 0: Disable boundary checking. 1: Enable boundary checking.

Exceptions

  CodaException | If an error occurred.

## ◆ set_option_perform_conversions()

static void set_option_perform_conversions | ( | int | enable | ) | throws CodaException
| static

Enable/Disable unit/value conversions.

Parameters

  enable | 0: Disable unit/value conversions. 1: Enable unit/value conversions.

Exceptions

  CodaException | If an error occurred.

## ◆ set_option_use_fast_size_expressions()

static void set_option_use_fast_size_expressions | ( | int | enable | ) | throws CodaException
| static

Enable/Disable the use of fast size expressions.

Parameters

  enable | 0: Disable the use of fast size expressions. 1: Enable the use of fast size expressions.

Exceptions

  CodaException | If an error occurred.

## ◆ set_option_use_mmap()

static void set_option_use_mmap | ( | int | enable | ) | throws CodaException
| static

Enable/Disable the use of memory mapping of files.

Parameters

  enable | 0: Disable the use of memory mapping. 1: Enable the use of memory mapping.

Exceptions

  CodaException | If an error occurred.

## ◆ setDefinitionPath()

static void setDefinitionPath | ( | String | path | ) | throws CodaException
| static

Set the searchpath for CODA product definition files.

Parameters

  path | Search path for .codadef files

Exceptions

  CodaException | If an error occurred.

## ◆ setDefinitionPathConditional()

static void setDefinitionPathConditional | ( | String | file,
|  | String | searchpath,
|  | String | relativeLocation
| ) |  | throws CodaException
| static

Set the location of CODA product definition file(s) based on the location of another file.

Parameters

  file | Filename of the file to search for
  searchpath | Search path where to look for the file
  relativeLocation | Filepath relative to the directory from searchpath where file was found that should be used to determine the CODA definition path

Exceptions

  CodaException | If an error occurred.

## ◆ time_double_to_parts()

static int[] time_double_to_parts | ( | double | datetime | ) | throws CodaException
| static

Retrieve the decomposed date corresponding with the given amount of seconds since Jan 1st 2000.

Warning
  This function does not perform any leap second correction. The returned value is just a straightforward conversion using 86400 seconds per day.

Parameters

  datetime | Floating point value representing the number of seconds since January 1st, 2000 00:00:00.000000.

Returns
  A 7-element array containing the following representation of the date:
  - ``[0] year - The year.
  - ``[1] month - The month of the year (1 - 12)
  - ``[2] day - The day of the month (1 - 31)
  - ``[3] hour - The hour of the day (0 - 23)
  - ``[4] minute - The minute of the hour (0 - 59)
  - ``[5] second - The second of the minute (0 - 59)
  - ``[6] musec - The microseconds of the second (0 - 999999)

Exceptions

  CodaException | If an error occurred.

## ◆ time_double_to_parts_utc()

static int[] time_double_to_parts_utc | ( | double | datetime | ) | throws CodaException
| static

Retrieve the decomposed UTC date corresponding with the given amount of TAI seconds since Jan 1st 2000. This function assumes the input to by the number of seconds since 2000-01-01 in the TAI system. The returned date/time components will be the corresponding UTC datetime (using proper leap second handling for the TAI to UTC conversion). For example: -88361290 will be 1972-01-01 00:00:00 UTC 0 will be 1999-31-12 23:59:28 UTC 284083232 will be 2008-12-31 23:59:59 UTC 284083233 will be 2008-12-31 23:59:60 UTC 284083234 will be 2009-01-01 00:00:00 UTC

Warning
  For dates before 1972-01-01 UTC a fixed leap second offset of 10 is used.

Note
  CODA has a built in table of leap seconds. To use a more recent leap second table, download the most recent file from ftp://maia.usno.navy.mil/ser7/tai-utc.dat and set the environment variable CODA_LEAP_SECOND_TABLE with a full path to this file.

Parameters

  datetime | Floating point value representing the number of seconds since January 1st, 2000 00:00:00.000000.

Returns
  A 7-element array containing the following representation of the date:
  - ``[0] year - The year.
  - ``[1] month - The month of the year (1 - 12)
  - ``[2] day - The day of the month (1 - 31)
  - ``[3] hour - The hour of the day (0 - 23)
  - ``[4] minute - The minute of the hour (0 - 59)
  - ``[5] second - The second of the minute (0 - 59)
  - ``[6] musec - The microseconds of the second (0 - 999999)

Exceptions

  CodaException | If an error occurred.

## ◆ time_double_to_string()

static String time_double_to_string | ( | double | datetime,
|  | String | format
| ) |  | throws CodaException
| static

Convert a floating point time value to a string using a specified format. The string will be formatted using the format that is provided as second parameter. The time string will be stored in the str parameter. This parameter should be allocated by the user and should be long enough to hold the formatted time string and a 0 termination character.

The specification for the time format parameter is the same as the date/time format patterns in coda expressions.

Parameters

  datetime | Floating point value representing the number of seconds since January 1st, 2000 00:00:00.000000.
  format | Date/time format to use for the string representation of the datetime value.

Returns
  String representation of the floating point time value.

Exceptions

  CodaException | If an error occurred.

## ◆ time_double_to_string_utc()

static String time_double_to_string_utc | ( | double | datetime,
|  | String | format
| ) |  | throws CodaException
| static

Convert a floating point TAI time value to a UTC string. The string will be formatted using the format that is provided as second parameter. The time string will be stored in the str parameter. This parameter should be allocated by the user and should be long enough to hold the formatted time string and a 0 termination character.

The specification for the time format parameter is the same as the date/time format patterns in coda expressions.

This function performs proper leap second correction in the conversion from TAI to UTC (see also time_double_to_parts_utc()).

Parameters

  datetime | Floating point value representing the number of seconds since January 1st, 2000 00:00:00.000000.
  format | Date/time format to use for the string representation of the datetime value.

Returns
  String representation of the floating point time value.

Exceptions

  CodaException | If an error occurred.

## ◆ time_parts_to_double()

static double time_parts_to_double | ( | int | year,
|  | int | month,
|  | int | day,
|  | int | hour,
|  | int | minute,
|  | int | second,
|  | int | musec
| ) |  | throws CodaException
| static

Retrieve the number of seconds since Jan 1st 2000 for a certain date and time.

Warning
  This function does not perform any leap second correction. The returned value is just a straightforward conversion using 86400 seconds per day.

Parameters

  year | The year.
  month | The month of the year (1 - 12).
  day | The day of the month (1 - 31).
  hour | The hour of the day (0 - 23).
  minute | The minute of the hour (0 - 59).
  second | The second of the minute (0 - 59).
  musec | The microseconds of the second (0 - 999999).

Returns
  Variable where the amount of seconds since Jan 1st 2000 will be stored.

Exceptions

  CodaException | If an error occurred.

## ◆ time_parts_to_double_utc()

static double time_parts_to_double_utc | ( | int | year,
|  | int | month,
|  | int | day,
|  | int | hour,
|  | int | minute,
|  | int | second,
|  | int | musec
| ) |  | throws CodaException
| static

Retrieve the number of TAI seconds since Jan 1st 2000 for a certain UTC date and time using leap second correction. This function assumes the input to be an UTC datetime. The returned value will be the seconds since 2000-01-01 in the TAI time system (using proper leap second handling for the UTC to TAI conversion). For example: 1972-01-01 00:00:00 UTC will be -883612790 2000-01-01 00:00:00 UTC will be 32 2008-12-31 23:59:59 UTC will be 284083232 2008-12-31 23:59:60 UTC will be 284083233 2009-01-01 00:00:00 UTC will be 284083234

Warning
  For dates before 1972-01-01 UTC a fixed leap second offset of 10 is used.

Note
  CODA has a built in table of leap seconds. To use a more recent leap second table, download the most recent file from ftp://maia.usno.navy.mil/ser7/tai-utc.dat and set the environment variable CODA_LEAP_SECOND_TABLE with a full path to this file.

Parameters

  year | The year.
  month | The month of the year (1 - 12).
  day | The day of the month (1 - 31).
  hour | The hour of the day (0 - 23).
  minute | The minute of the hour (0 - 59).
  second | The second of the minute (0 - 59).
  musec | The microseconds of the second (0 - 999999).

Returns
  Variable where the amount of seconds since Jan 1st 2000 will be stored.

Exceptions

  CodaException | If an error occurred.

## ◆ time_parts_to_string()

static String time_parts_to_string | ( | int | year,
|  | int | month,
|  | int | day,
|  | int | hour,
|  | int | minute,
|  | int | second,
|  | int | musec,
|  | String | format
| ) |  | throws CodaException
| static

Create a string representation for a specific data and time. The string will be formatted using the format that is provided as first parameter. The time string will be stored in the str parameter. This parameter should be allocated by the user and should be long enough to hold the formatted time string and a 0 termination character.

The specification for the time format parameter is the same as the date/time format patterns in coda expressions.

Parameters

  year | The year.
  month | The month of the year (1 - 12).
  day | The day of the month (1 - 31).
  hour | The hour of the day (0 - 23).
  minute | The minute of the hour (0 - 59).
  second | The second of the minute (0 - 59).
  musec | The microseconds of the second (0 - 999999).
  format | Date/time format to use for the string representation of the datetime value.

Returns
  Variable where the amount of seconds since Jan 1st 2000 will be stored.

Exceptions

  CodaException | If an error occurred.

## ◆ time_string_to_double()

static double time_string_to_double | ( | String | format,
|  | String | str
| ) |  | throws CodaException
| static

Convert a time string to a floating point time value. The string will be parsed using the format that is provided as first parameter. This can be a '|' separated list of formats that will be tried in sequence until one succeeds.

The specification for the time format parameter is the same as the date/time format patterns in coda expressions.

Parameters

  format | Date/time format to use for the string representation of the datetime value.
  str | String containing the time in one of the supported formats.

Returns
  datetime Floating point value representing the number of seconds since January 1st, 2000 00:00:00.000000.

Exceptions

  CodaException | If an error occurred.

## ◆ time_string_to_double_utc()

static double time_string_to_double_utc | ( | String | format,
|  | String | str
| ) |  | throws CodaException
| static

Convert a UTC time string to a TAI floating point time value. The string will be parsed using the format that is provided as first parameter. This can be a '|' separated list of formats that will be tried in sequence until one succeeds.

The specification for the time format parameter is the same as the date/time format patterns in coda expressions.

This function performs proper leap second correction in the conversion from UTC to TAI (see also time_parts_to_double_utc()).

Parameters

  format | Date/time format to use for the string representation of the datetime value.
  str | String containing the time in one of the supported formats.

Returns
  datetime Floating point value representing the number of seconds since January 1st, 2000 00:00:00.000000.

Exceptions

  CodaException | If an error occurred.

## ◆ time_string_to_parts()

static int[] time_string_to_parts | ( | String | format,
|  | String | str
| ) |  | throws CodaException
| static

Convert a time string to a date and time using a specified format. The string will be parsed using the format that is provided as first parameter. This can be a '|' separated list of formats that will be tried in sequence until one succeeds.

The specification for the time format parameter is the same as the date/time format patterns in coda expressions.

Parameters

  format | Date/time format to use for the string representation of the datetime value.
  str | String representation of the floating point time value.

Returns
  A 7-element array containing the following representation of the date:
  - ``[0] year - The year.
  - ``[1] month - The month of the year (1 - 12)
  - ``[2] day - The day of the month (1 - 31)
  - ``[3] hour - The hour of the day (0 - 23)
  - ``[4] minute - The minute of the hour (0 - 59)
  - ``[5] second - The second of the minute (0 - 59)
  - ``[6] musec - The microseconds of the second (0 - 999999)

Exceptions

  CodaException | If an error occurred.

## ◆ version()

static String version | ( |  | ) |
| static

Current version of CODA as a string.

Returns
  The CODA version.