FW: Incorrect values in places of decimals

From: 김미애 <toa0710_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 13 2014 - 09:04:22 MDT

Hello,
 
Actually, I tried "double" at first. But, it was same.
Although I tried "float" and "double", the results were wrong. How can I resolve this problem?
 
Thank you

-------------------------------------------------
Miae Kim
School of Urban and Environment Engineering
Ulsan National Institute of Science and Technology (UNIST)
UNIST-gil 50, Ulsan 689-798, South Korea
Mobile: +82-10-9421-8287
E-mail: toa0710@naver.com
-----Original Message-----
From: "Mary Haley"&lt;haley@ucar.edu&gt;
To: "김미애"&lt;toa0710@naver.com&gt;;
Cc: "ncl-talk"&lt;ncl-talk@ucar.edu&gt;;
Sent: 2014-03-13 (목) 23:17:27
Subject: Re: [ncl-talk] Incorrect values in places of decimals

Try reading the data in double precision rather than float. Replace the “float” with “double”.

—Mary
On Mar 13, 2014, at 2:51 AM, 김미애 &lt;toa0710@naver.com&gt; wrote:
Hello,
  I attempted to combine 3 text files into 1 text file.
One is data values, and the others are longitude and latitude.
I made the final text file including the three data, but those values were incorrect.
As shown in down below, those values have too long places of decimals.
I don't know why, but the output text file has different .. incorrect values.
Let's see the first line of it.
139.998825073242188 49.993419647216797 1.028651834
The last 11 digits are incorrect in longitude and latitude.
The last 2 digits are incorrect in data values.
....
  The following is my code.
Where am I doing wrong? How can I get the correct values
  &lt;My code&gt;
   lonlat_data=asciiread("mosaic_lonlat.txt", (/1373413,2/), "float")
   predict_data=asciiread("rf_image_prediction1_revised.txt", (/1373413,1/), "float")
;print(lonlat_data(0:9,1))
     dims=dimsizes(predict_data)
   ny=dims(0) ;1373413
     predict_data_new=new((/ny,3/),float)
   do i=0,ny-1
     predict_data_new(i,0)=lonlat_data(i,0)
     predict_data_new(i,1)=lonlat_data(i,1)
     predict_data_new(i,2)=predict_data(i,0)
   end do
   predict_data_new@_FillValue=-9999
;print(predict_data_new(0:9,0:2))
;exit
  fmtx="f23.15,f23.15,f15.9"
opt=True
opt@fout="prediction.txt"
write_matrix(predict_data_new,fmtx,opt)
   &lt;The fraction of the output text file with the 3 text files&gt;
139.998825073242188 49.993419647216797 1.028651834
140.012084960937500 49.993419647216797 1.051712275
140.025360107421875 49.993419647216797 0.991534710
140.038635253906250 49.993419647216797 1.164933443
140.051895141601563 49.993419647216797 1.189701200
....
  &lt;The fraction of data values&gt;
1.028651821
1.051712292
0.991534726
1.164933449
1.189701191
1.110428796
....
    &lt;The fraction of longitude and latitude&gt;
139.998818623999990,49.993421150400003
140.012089035999990,49.993421150400003
140.025359450000000,49.993421150400003
140.038629861999990,49.993421150400003
140.051900275000010,49.993421150400003
140.065170687999990,49.993421150400003
...
  

Thank you so much
  Miae

-------------------------------------------------
Miae Kim
School of Urban and Environment Engineering
Ulsan National Institute of Science and Technology (UNIST)
UNIST-gil 50, Ulsan 689-798, South Korea
Mobile: +82-10-9421-8287
E-mail: toa0710@naver.com

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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 13 09:04:37 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 14 2014 - 15:08:52 MDT