#52 datamodel.toCDF required a variable named Epoch


datamodel objects should not have to have a variable named Epoch in order to use the toCDF() method.

812                 else:
813                     shape_tup = SDobject[key].shape

--> 814 if shape_tup[0] != len(SDobject['Epoch']): #naive check for 'should-be' NRV
815 try:
816 foo = outdata.new(key, SDobject[key][...], recVary=False)

KeyError: 'Epoch'


  • Steve Morley

    Steve Morley - 2014-06-30

    Ticket moved from /p/spacepy/bugs/70/

  • Steve Morley

    Steve Morley - 2014-07-17

    This check was, as noted in the code, a "naive check" on whether a variable should be stored as non-record-varying.

    Since Epoch is the de-facto standard name for the time variable in NASA CDFs that's what I had used as my check. Obviously this is very restrictive.

    I've replaced this check with a test of the most common length of variable. If Epoch is present it uses the length of that, otherwise it checks that variables are the same length as the most common variable length. If so, they're stored as RV, if not then NRV.

    It's not bulletproof, but should work in the majority of cases. Documenting this is on the to-do list.

  • Steve Morley

    Steve Morley - 2014-07-17

    Left as pending until confirmation from someone else that this upgrade seems to work...

  • Steve Morley

    Steve Morley - 2014-07-17
    • status: open --> pending

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks