Re: Write_matrix question

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 04 Apr 2008 07:01:46 -0600

Dave,

I am not aware of any fortran format edit descriptor that would drop
the decimal point. *Some* fortran compilers will do this. I do not think
the fortran standard specifies the behavior of (say, f4.0).

I think that the comp.lang.fortran news group, which is very responsive,
could answer your question.

D
Dave Allured wrote:
> In write_matrix, I would like to suppress the decimal point on some of
> the numbers printed. Is there a trick with the Fortran-style format
> string that would do this?
>
> I am trying to simulate a mix of integers and reals to display a mask
> array like this:
>
> fmtf = "f6.1, 2x, 12f2"
> write_matrix (index_plus_mask, fmtf, option)
>
> 12.0 1 1 1 0 0 0 0 0 0 0 0 0
> 11.5 1 1 1 1 1 0 0 0 0 0 0 0
> 11.0 0 1 1 1 1 1 0 0 0 0 0 0
> 10.5 0 0 1 1 1 1 1 0 0 0 0 0
> 10.0 0 0 0 1 1 1 1 1 0 0 0 0
> 9.5 0 0 0 0 1 1 1 1 1 0 0 0
> 9.0 0 0 0 0 0 1 1 1 1 1 0 0
>
> But this is what I actually get, because the format "f2" or "f2.0"
> always inserts a decimal point:
>
> 12.0 1.1.1.1.1.0.0.0.0.0.0.0.
> 11.5 0.1.1.1.1.1.0.0.0.0.0.0.
>
> "i2" format does not work; it is illegal use with my floating point
> numeric array.
>
> I can get the display I want with a more complicated string
> algorithm. I am just wondering whether there is a simple formatting
> trick for this in write_matrix. Thanks for any insights.
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
> http://www.cdc.noaa.gov/
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 04 2008 - 07:01:46 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 04 2008 - 08:43:08 MDT