problem with fwrite

Arindam Chakraborty arch at IO.MET.FSU.EDU
Tue Feb 22 00:36:21 EST 2005


hi Sandeep,
        it appears that your problem is in specifying the correct
undef value to the descriptor file. Usually (in the new version of
GrADS) the missing_value of the netcdf file is embedded as the undef
value in the data file you generate. So, make sure that you specify
the same one in your ctl as in your netcdf file. In this connection,
I'm providing you few basic and necessary steps to write down data
from a netcdf file to another plain binary file:

1) choose the region in terms of grid coordinates (x,y): you can do
this by setting (lon,lat) and then using q dims. then choose the
nearest integer values of (x,y) and reset the region in terms of
(x,y). Again use q dims to find the world coordinate (this will be useful to
write the descriptor file).

2) write down the data to a new file.

3) check the file size.

4) use q file to find what is the value of undef grads is considering.

5) write down the .ctl file with the information you've already
obtained (world coordinates, undef, variable name and units).

6) make sure you use the same type of machine to use this data where
you generated it. Otherwise an 'options byteswapped' (or
little_endian/big_endian) should be specified in the ctl file.




----------------------------
 ARINDAM CHAKRABORTY
 Department of Meteorology
 Florida State University
 Tallahassee, FL-32306, USA
 Tel: +001-850-6443524 (Off)
      +001-850-5758550 (Res)
 Fax: +001-850-6449642
____________________________

On Tue, 22 Feb 2005, sandeep s wrote:

> Dear users
> i downloaded soil temperature(0-10cm)data(netcdf) for
> the year 2002 from the website www.cdc.noaa.gov. I
> opened it using sdfopen and fwrite it to a new file
> "test.dat" (for time 00z21nov 2002). the problem is
> that when i opened "test.dat" and displayed the
> variable "tmp" it is showing very high values in the
> range 3000-30000 (actual value is in the range
> 270-310). if anybody knows the reason for this error
> please help me.
>
> thanks
> sandeep
>
> =====
> S.SANDEEP
> JUNIOR RESEARCH FELLOW
> DEPARTMENT OF PHYSICS & METEOROLOGY
> INDIAN INSTITUTE OF TECHNOLOGY
> KHARAGPUR,INDIA
>
> ________________________________________________________________________
> Yahoo! India Matrimony: Find your life partner online
> Go to: http://yahoo.shaadi.com/india-matrimony
>



More information about the gradsusr mailing list