Re: Overwriting a value of a variable in a file - and it is written as a different number

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 05 2011 - 14:09:42 MDT

Try specifying as double.
Maybe it defaulted as float.

On Oct 5, 2011, at 3:06 PM, Madeleine Patterson wrote:

> Hi,
>
> I am using the script on http://www.ncl.ucar.edu/Applications/change_netCDF.shtml to overwrite one value of a variable (i.e. just for one year).
>
> I change the value of this variable for one year to 478.919898945933, and get the value 478.919891357422 when I check the file for the new value (via ncdump).
>
> Similarly, the rest of the values for this variable have changed, e.g.
>
> in my script:
>
> CO2 = (/289.263, 289.263, 289.41739141755, 289.579855588959, 289.749383419994,\
> ....
> 533.483333333333/)
>
>
> But in the ncdump of the altered file (where I changed just one value of this variable):
>
> CO2 = 289.263000488281, 289.263000488281, 289.417388916016,
> ...
> 533.483337402344, 533.483337402344, 533.483337402344 ;
>
> Can anyone tell me what is happening? And how I can fix the script so that the overwritten variable has exactly the same values as the original variable except for the value that my script wants to change?
>
> My script is included below...
>
> Thanks
>
> Madeleine.
>
>
> **********************************************
> **********************************************
> begin
>
> ; loading libraries
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> ;*******************************************************************
>
> in = addfile("./ghgfile","w")
>
> CO2 = (/289.263, 289.263, 289.41739141755, 289.579855588959, 289.749383419994,\
>
> ...
> 533.483333333333/)
>
> in->CO2=(/CO2/)
>
> end
> *****************************************************
> *****************************************************
>
>
> _______________________________________________
> 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 Wed Oct 5 14:09:54 2011

This archive was generated by hypermail 2.1.8 : Sun Oct 09 2011 - 13:05:26 MDT