[ncl-talk] 答复: How to print zero before the decimal point with "write_matrix" function

Wan Jianghua wanjianghua at mail.iap.ac.cn
Thu Sep 12 04:34:34 MDT 2019


Hi Karin,

Thank you for your reply. I tried several versions of ncl (6.1.2, 6.2.0,
6.3.0). They all got the same results. 

But I run the same script on other two Linux machines with ncl V6.1.2 and
V6.2.0, and  the zero appear.  

I guess the problem might be related to the IBM_AIX machine I was using. 

 

Best,

Jianghua

 

Karin Meier-Fleischer via ncl-talk
发送时间: 2019年9月12日 17:30



Hi Jianghua,

which NCL version are you running? Using version 6.6.2 works quite well:

> ncl
 Copyright (C) 1995-2019 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.6.2
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> a=new((/2,2/),float,-999.)
ncl 1> a=0.1
ncl 2> a(0,0)=-0.1
ncl 3> write_matrix(a,"2f5.2",True)
  
-0.10 0.10
 0.10 0.10
  
ncl 4> quit

-Karin

Am 12.09.19 um 10:32 schrieb Wan Jianghua via ncl-talk:

Hi all,

I try to print a nicely formatted text file with “write_matrix” function,
but the result is not satisfactory.

When the absolute value of the number is less than 1, the zero before the
decimal point is omitted. Is there any possible way to print it out? Thanks!

 

My test script:

a=new((/2,2/),float,-999.)

a=0.1

a(0,0)=-0.1

write_matrix(a,"2f5.2",True)

 

the result:

-.10   .10

.10   .10



 

Sincerely,

Jianghua





_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu> 
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190912/c57f1362/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 2833 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190912/c57f1362/attachment.png>


More information about the ncl-talk mailing list