Menu

#2378 data tab operations need equivalents in Jython

nextrelease
open-fixed
nobody
None
5
2021-09-17
2021-08-18
No

Sadie noticed that the data operation "|setDepend0Units('ms since 1970-01-01T00:00')" doesn't have an obvious analog in scripting. This makes me realize there are a number of functions in the data operations which are implemented with three or fours lines of code, which are easily composed in a script by me, but not by others who aren't so familiar with the libraries. The goal should be that any operation "|doXXX(arg)" should have a Jython function "doXXX(ds,arg)".

Short of that, script authors can work around this problem by calling the OperationsProcessor themselves, like so:

ds= dataset( findgen(40), sin( linspace( 0, 2*PI, 40 ) ) )

from org.das2.qds import OperationsProcessor
ds= OperationsProcessor.process( ds, "|setDepend0Units('ms since 1970-01-01T00:00')", None )

plot( ds )

(See https://github.com/autoplot/dev/demos/2021/20210818/demoOperationsProcessor.jy)

Discussion

  • Jeremy Faden

    Jeremy Faden - 2021-08-18

    It's ironic that sprocess is sprocess( str, ds ) not sprocess( ds, str )! Whoops...

     
  • Jeremy Faden

    Jeremy Faden - 2021-08-18

    I've gone ahead and added process( ds, str ) and deprecated sprocess. I'll update the above example to use this.

     

    Last edit: Jeremy Faden 2021-08-18
  • Jeremy Faden

    Jeremy Faden - 2021-08-18
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -6,7 +6,7 @@
     ds= dataset( findgen(40), sin( linspace( 0, 2*PI, 40 ) ) )
    
     from org.das2.qds import OperationsProcessor
    -ds= OperationsProcessor.sprocess( "|setDepend0Units('ms since 1970-01-01T00:00')", ds, None )
    +ds= OperationsProcessor.process( ds, "|setDepend0Units('ms since 1970-01-01T00:00')", None )
    
     plot( ds )
     ~~~~~
    
     
  • Jeremy Faden

    Jeremy Faden - 2021-08-23

    I made new setDepend0Units, setDepend1Units, and setValidRange in Ops (which is imported automatically into Jython scripts). Other functions are fairly simple wrappers around existing code.

     
  • Jeremy Faden

    Jeremy Faden - 2021-08-23
    • status: open --> open-fixed
     
  • Jeremy Faden

    Jeremy Faden - 2021-09-17

    I see setDepend0Cadence but not setDepend0Units.

     
  • Jeremy Faden

    Jeremy Faden - 2021-09-17

    We also saw that netcdf didn't allow "hrs+since+2020-01-01" for units, but does allow "hr since 2020-01-01T00:00Z"

     
  • Jeremy Faden

    Jeremy Faden - 2021-09-17

    Also another script showed where the timetags are dropped in some operations.

     
MongoDB Logo MongoDB