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

Michael Langguth mlangguth at uni-bonn.de
Tue Sep 12 06:32:01 MDT 2017


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