1
$\begingroup$

This is a rather obscure question, but perhaps someone has the answer. I am trying to read/interpret a number stored in NASA's CDF Epoch format. That's the number of milliseconds past Jan 1, year zero. When I read NASACDF files with Mathematica, it converts the date into a "nice" date format, but the text file I have is in native format (milliseconds past...). I have no software that goes back to the year zero, so I can't convert between CDF Epoch format and other formats. If I had just one known date translated to CDF Epoch format, I could write a converter, but I cannot find such an example anywhere. All the examples I find use "nice" date formats. I have not seen the native format alongside another date format so I can do the conversion.

Is there a way to tell Mathematica "don't convert the internal date format to a date list. Leave it as a number of milliseconds"?

Here is some code that might illustrate what I mean:

Import["SWARM_A.CDF"]

Produces:

{"Timestamp", "Latitude", "Longitude", "Radius", "GPS_Position", \
"LEO_Position", "PRN", "L1", "L2", "P1", "P2", "S1", "S2", \
"Absolute_STEC", "Relative_STEC", "Relative_STEC_RMS", "DCB", \
"DCB_Error"}

The format of the Timestamp data is "Date":

Import["SWARM_A.CDF", "DataFormat"]

Returns

{"Date", "Real64", "Real64", "Real64", "Real64", "Real64", \
"UnsignedInteger16", "Real64", "Real64", "Real64", "Real64", \
"Real64", "Real64", "Real64", "Real64", "Real64", "Real64", "Real64"}

Read the Timestamp data:

ts = Import["SWARM_A.CDF", {"Datasets", "Timestamp"}];
ts[[1]]

Produces a Mathematica date:

{2013, 11, 26, 0, 0, 3.999}

Internally, that date is stored as number of milliseconds past Jan-01-0000 (year zero), but I don't know how to access the "raw" form of the Timestamp data, stored as a float.

Thank you.

$\endgroup$
  • $\begingroup$ Please provide sample data and references to the format(s) you describe to facilitate helping you. $\endgroup$ – Yves Klett Oct 27 '16 at 6:29
  • $\begingroup$ I cannot provide sample data. That is in fact the problem. However, I can provide references. The NASA CDF format is described here: link . Mathematica provides documentation on the format if you search for NASACDF. Thank you! $\endgroup$ – Anthony Mannucci Oct 27 '16 at 6:33
  • 2
    $\begingroup$ You should consider providing a tiny bit of (fake) data anyway. This will get you answers much more reliably than counting on users reverse-engineering your problem. Also, please add any relevant info to the question via an edit, comments are not well suited for that and non-permanent. $\endgroup$ – Yves Klett Oct 27 '16 at 7:20
  • $\begingroup$ you might try some of the other tools on that site to convert to a form you can use. $\endgroup$ – george2079 Oct 27 '16 at 12:53
  • 2
    $\begingroup$ If we assume mathematica did the conversion correctly it may be as simple as doing (AbsoluteTime[{2013, 11, 26, 0, 0, 3.999}] -AbsoluteTime[{0, 1, 1, 0, 0, 0}]) 1000. without a known value to validate against that's a bit of a wag though. $\endgroup$ – george2079 Oct 27 '16 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.