[Thread Prev][Thread Next][Index]

Re: [ferret_users] string composition



I agree this seems like a bug, and I'll have a look at this. Addition of strings is one way to work with them, but for combining two strings, the STRCAT function is the most reliable:


yes? list/nohead strcat(v1.units, v2.units)
        "m/smmol C m-3"

A variation on your last command could be this, creating a single string.

yes? list/nohead "`v1.units` + `v2.units`"
        "m/s + mmol C m-3"


On 2/19/2020 1:15 AM, Marco van Hulten wrote:
Hi Ferreters—

When I was composing unit strings from a product of variables, I found
an unexpected behaviour:

yes? let/units="m/s" v1 = 1.1
yes? let/units="mmol C m-3" v2 = 2.2
yes? list/nohead v1.units + "XYZ"
         "m/sXYZ"
yes? list/nohead v1.units + v2.units
         "m/sm/s"
yes? list/nohead "`v1.units`" + "`v2.units`"
         "m/smmol C m-3"

I expected that the result of the panultimate command would be the same
as that of the last command.

(The last command can be used as a solution or workaround to this issue.)

—Marco


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

Privacy Policy | Disclaimer | Accessibility Statement