Re: my god, it's full of stars.... [message #77213] |
Wed, 17 August 2011 05:05  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
If I don't know what the size of the numbers will be (or if their range is many orders of magnitude), I use exponential
formats, e.g. e13.6.
cheers,
paulv
polystethylene wrote:
> On Aug 16, 10:29 pm, Paul van Delst <paul.vande...@noaa.gov> wrote:
>> The format used to output the number can't "fit it in". E.g.
>>
>> IDL> x=0.631398
>> IDL> print, format='(f10.6)', x
>> 0.631398
>> IDL> x=1000.0
>> IDL> print, format='(f10.6)', x
>> **********
>>
>> So, if the number being output in your file is >= 1000, you'll get stars.
>>
>> The ">=" is subject to precision of course:
>>
>> IDL> x=999.9999
>> IDL> print, format='(f10.6)', x
>> 999.999878
>> IDL> x=999.99999
>> IDL> print, format='(f10.6)', x
>> **********
>>
>> cheers,
>>
>> paulv
>>
>>
>
>
> Hi Paul, thanks for the swift reply.
>
> Does this mean the solution for situations where the number is unknown
> is to print with format D0.6, and not D10.6?
>
>
|
|
|
Re: my god, it's full of stars.... [message #77217 is a reply to message #77213] |
Tue, 16 August 2011 16:34   |
polystethylene
Messages: 28 Registered: February 2009
|
Junior Member |
|
|
On Aug 16, 10:58 pm, David Fanning <n...@idlcoyote.com> wrote:
> polystethylene writes:
>> Does this mean the solution for situations where the number is unknown
>> is to print with format D0.6, and not D10.6?
>
> It will depend on how anal you are. If you like things
> lined up in nice columns this may not work as well
> as you hoped. :-)
>
> Cheers,
>
> David
>
> P.S. On the other hand, if you don't mind wide columns,
> adding a couple more digits probably wouldn't hurt. You
> might also want to leave some room for negative numbers,
> with their extra minus sign, if you are expecting any.
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks David, that clears things up - I opted for the large number to
maintain the straight columns :)
|
|
|
Re: my god, it's full of stars.... [message #77219 is a reply to message #77217] |
Tue, 16 August 2011 14:58   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
polystethylene writes:
> Does this mean the solution for situations where the number is unknown
> is to print with format D0.6, and not D10.6?
It will depend on how anal you are. If you like things
lined up in nice columns this may not work as well
as you hoped. :-)
Cheers,
David
P.S. On the other hand, if you don't mind wide columns,
adding a couple more digits probably wouldn't hurt. You
might also want to leave some room for negative numbers,
with their extra minus sign, if you are expecting any.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: my god, it's full of stars.... [message #77220 is a reply to message #77219] |
Tue, 16 August 2011 14:42   |
polystethylene
Messages: 28 Registered: February 2009
|
Junior Member |
|
|
On Aug 16, 10:29 pm, Paul van Delst <paul.vande...@noaa.gov> wrote:
> The format used to output the number can't "fit it in". E.g.
>
> IDL> x=0.631398
> IDL> print, format='(f10.6)', x
> 0.631398
> IDL> x=1000.0
> IDL> print, format='(f10.6)', x
> **********
>
> So, if the number being output in your file is >= 1000, you'll get stars.
>
> The ">=" is subject to precision of course:
>
> IDL> x=999.9999
> IDL> print, format='(f10.6)', x
> 999.999878
> IDL> x=999.99999
> IDL> print, format='(f10.6)', x
> **********
>
> cheers,
>
> paulv
>
>
Hi Paul, thanks for the swift reply.
Does this mean the solution for situations where the number is unknown
is to print with format D0.6, and not D10.6?
|
|
|
Re: my god, it's full of stars.... [message #77221 is a reply to message #77220] |
Tue, 16 August 2011 14:29   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
The format used to output the number can't "fit it in". E.g.
IDL> x=0.631398
IDL> print, format='(f10.6)', x
0.631398
IDL> x=1000.0
IDL> print, format='(f10.6)', x
**********
So, if the number being output in your file is >= 1000, you'll get stars.
The ">=" is subject to precision of course:
IDL> x=999.9999
IDL> print, format='(f10.6)', x
999.999878
IDL> x=999.99999
IDL> print, format='(f10.6)', x
**********
cheers,
paulv
polystethylene wrote:
> Quick question - some of my data files are being written with the
> likes of:
>
> 5484.487603 0.533930 1.274879
> 5484.488112 1.378365 0.433342
> 5484.488610 0.631398 1.682024
> 5484.489131 ********** 0.913028
> 5484.489628 0.968477 0.610894
> 5484.490126 0.819817 0.674836
> 5484.490635 1.502081 0.369167
>
>
> I rarely see this, but due to the nature of searching for '*********'
> - I can't google this one at all...
>
>
> Any ideas?
|
|
|
|