[Thread Prev][Thread Next][Index]

Re: [ferret_users] How to find the number of seconds in a timestep



Hi Billy and Russ,

On Mon, Dec 2, 2019 at 8:50 AM Fiedler, Russell (O&A, Hobart) <Russell.Fiedler@xxxxxxxx> wrote:

How about using the embedded _expression_ `var,return=tunits`? You'd have to do your own conversion from days-seconds or whatever via an IF-ELSE block.

Or you can ask an external program to do the conversion:

let seconds_in_string = {SPAWN:"gdate '+%s' -d '04-MAR-2014 20:00'"}
let seconds = `seconds_in_string`  ! convert string to number

using the GNU version of the date command.  In this case, the time is counted from a predefined point.

[On Linux, the command is usually just "date".  On Mac, you can choose to override the system's date command and call it "date"; otherwise, it's (often? always?) installed as "gdate".]

Cheers,
Ryo


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement