lterp in os x

Ken Takahashi ken at ATMOS.WASHINGTON.EDU
Mon Dec 18 16:42:27 EST 2006


Hi
I've tried to compile lterp in a mac with OS X 10.4.8, but it is not
reading correctly the header in the udf input file produced by grads.
First, I had to modify lterp.c by replacing the include of malloc.h by
stdio.h, since there is no malloc.h in this OS X.

The following C program mimicks the lterp problem:

#include <stdio.h>
#include <stdlib.h>
main () {
  FILE * ifile;
  float vv[20];
ifile = fopen("udf.lterp.gfi","rb");
fread (vv,sizeof(float),20,ifile);
printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\n",vv); }

I compiled it with
 i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build
5250)
and produces:
0.000000,0.000000,-0.000000,699471016143264789146213277712597
946432024952222206321680911864296958302591340536370942704582
315384261026130449661836367383842351487964685681788511238106
224063975670086286172769015233083827269395165565083080742613
47104438390138117029888.000000,0.000000,-0.000000,-0.000000,
-18800912370575128944394267062180712092366567837297248367908
667602057474020457810961186148820746029917303982103957071903
248908607062589111221684268100088207704582256884357269959172
8913379639227842560.000000,0.000000,0.000000,0.000000,0.0000
00,0.000000,0.000000,-1.998085,0.000000,-1.998124,0.000000,0
.000000,0.000000
The first number should've been 2., which is the number of arguments I
used in the call to lterp in grads which generated udf.lterp.gfi
(attached).

On the other hand, the fortran program:
program test
real,dimension(20)  ::  vv
open (1,file='udf.lterp.gfi',form="unformatted",access="direct",recl=20*4)
read(1,rec=1) vv
print *,vv
end
!
produces
 2. -1.9991894 -9.403993E-38 -2.844844E-29 0.082602374
-1.9991913 0.08587048 0.10755291 0.08056926 2.929016E-39
-1.9991989 0. 0. 0. 0. 0. 0. 0. 0. 5.30051E-38
for the same input file, which is correct.

I would appreciate any help.
Thanks
Ken Takahashi

Ps. 'q config' produces
Config: v1.9b4 32-bit big-endian readline sdf/xdf netcdf dods dods-stn
lats printim

Grid Analysis and Display System (GrADS) Version 1.9b4
Copyright (c) 1988-2005 by Brian Doty and IGES
Center for Ocean-Land-Atmosphere Studies (COLA)
Institute for Global Environment and Society (IGES)
This program is distributed WITHOUT ANY WARRANTY
See file COPYRIGHT for more information.

Built Mon May 23 11:56:46 EDT 2005 for powerpc-apple-darwin7.9.0

This version of GrADS has been configured with the following options:

   o This is a 32-bit BIG ENDIAN machine version.
   o Command line editing (readline) ENABLED.
   o CIRES/CDC (http://www.cdc.noaa.gov) SDF/XDF interface ENABLED.
     Use sdfopen/xdfopen to read NetCDF files.
   o DTYPE netcdf is ENABLED; DTYPE hdfsds is DISABLED.
   o OPeNDAP (a.k.a. DODS) gridded data interface ENABLED.
(http://opendap.org)
     This version is configured to access gridded data on OPeNDAP servers
via the sdfopen or xdfopen commands, or using DTYPE netcdf.
   o OPeNDAP (a.k.a. DODS) station data interface (gadods) ENABLED.
     This version is configured to access station data on OPeNDAP servers
via the open command.
   o PCMDI (http://www-pcmdi.llnl.gov) LATS interface ENABLED.
     This version is configured to write GRIB and NetCDF files.
   o DAO (http://dao.gsfc.nasa.gov) Athena Widget GUI DISABLED.
   o NRL/DAO/PCMDI XA or ImageMagick Image Output DISABLED.
   o printim command for direct png/gif output ENABLED.
     (via the GD Library -- http://www.boutell.com/gd)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: udf.lterp.gfi
Type: application/octet-stream
Size: 86080 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20061218/029d0b09/attachment.obj 


More information about the gradsusr mailing list