[ncl-talk] how can I write large float value with e scientific notation?

Beáta Szabó-Takács szabo.b at czechglobe.cz
Tue Sep 12 07:17:31 MDT 2017


Dear Michael,
Thank you for your response. Unfortunately it does not work because the values can be only numeric in taylor_metric_table.ncl.
Best regards,
Beáta

-----Original Message-----
From: Michael Langguth [mailto:mlangguth at uni-bonn.de] 
Sent: Tuesday, September 12, 2017 2:32 PM
To: Beáta Szabó-Takács <szabo.b at czechglobe.cz>; ncl-talk at ucar.edu
Subject: Re: [ncl-talk] how can I write large float value with e scientific notation?

Dear Beáta,

I suppose, the sprintf-function can help you here. It's a function to convert floats (and doubles) to formatted strings.
For example, an appropriate format for your bias-values may be

sprintf("%10.5g",bias)

where the exponential notation is used as long as the precision being defined by the number 5.

For further examples, you can also consult the attached
link:
https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml

Best regards
Michael

  On Tue, 12 Sep 2017 11:18:59 +0000
  Beáta Szabó-Takács <szabo.b at czechglobe.cz> wrote:
> Dear NCL Users,
> I created a table about precipitation bias values in JJA and DJF with 
>taylor_metric_table.ncl. I changed the bias calculation to
> bias    = tmean-rmean in taylor_stats.ncl. I got a very 
>large bias value in HIRHAM model in JJA and this value covers the bias 
>value in DJF column on the table. I attached the table. The values are 
>in float form. Could someone let me know how I can write the large 
>float number with scientific notation? I mean if the value is e.g 
>larger than 100000 it will be written 1e5.
> Thank you for your help in advance!
> Beáta



More information about the ncl-talk mailing list