NOAA-PMEL/Ferret

variable parsing issue

Closed this issue · 2 comments

#I'm trying to fetch the time axis start and end of a variable and use it to create a time axis for a new dataset that is to be saved.

yes? let ts = "u_1205,return=t0"
!-> DEFINE VARIABLE ts = "06-JAN-2016 10:00:00"
yes? let te = "u_1205,return=tend"
!-> DEFINE VARIABLE te = "12-NOV-2016 06:00:00"
yes? define axis/T="ts":"te":1/unit=hours/T0="ts" TIME
**ERROR: invalid command: delta values may only modify variable names

#when I tried running without giving T0, the time axis is generated successfully.

yes? define axis/T="te":"ts":1/unit=hours tax2
!-> define axis/T="12-NOV-2016 06:00:00":"06-JAN-2016 10:00:00":1/unit=hours tax2

#can anyone tell me how can I give T0 in correct syntax.

This does seem to be a bug in command parsing.

The text formatting in github is apparently removing the grave-accents from the commands you showed. I will use the <> code tag to show your definitions and a workaround for the problem.

yes? let ts = "06-JAN-2016 10:00:00"
yes? let te = "12-NOV-2016 06:00:00"
yes? define axis/T="`ts`":"`te`":1/unit=hours/T0="`ts`" TIME
**ERROR: invalid command: delta values may only modify variable names

If I change the order of the qualifiers, then it works. This should not be the case; the ordering of qualifiers does not matter in Ferret command syntax.

yes? define axis/T0="`ts`"/T="`ts`":"`te`":1/unit=hours time
 !-> define axis/T0="06-JAN-2016 10:00:00"/T="06-JAN-2016 10:00:00":"12-NOV-2016 06:00:00":1/unit=hours time

Another way to do this, which does not trigger this parsing bug, is to use symbols:

yes? define symbol ts = `u_1205,return=t0`
yes? define symbol te = `u_1205,return=tend`
yes? define axis/T="($ts)":"($te)":1/unit=hours/T0="($ts)" TIME

Thank you.
I found out that changing the order of the qualifier worked out for me.