Re: Can NCL read 'binary-punch' format?

From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Wed Jul 20 2005 - 15:37:10 MDT


>I am trying to read the output from the GEOS-CHEM model, which writes out
>data in a 'binary-punch' format for subsequent analyses/visualization.
>Please see
>
>http://www-as.harvard.edu/chemistry/trop/gamap/documentation/gamap_5.html#5
>
>Their analyses package called GAMAP uses IDL to read this format and can
>then write out in HDF, netCDF, etc.
>
>I was wondering if NCL can handle binary-punch format. I looked up the NCL
>documentation, and didnt find it. Thought I might as well ask this group

---

Hello,

IDL has the capability to read the mixed types [character, integer, real and double] contained in the header. NCL does not have this capability.

Personally, I would just write a fortran subroutine and invoke it from NCL. It is pretty simple. let the following schematic be called gamap.f [There are additional variable but this illustrates the approach.]

C NCLFORTSTART subroutine rdpunch1 (fname + ,modelname, modelres, halfpolar + ,center180, category + ,tau0, tau1, clm, skip) character*(*) fname character*20 modelname character*40 category, unit real modelres(2) integer halfpolar, center180, tracer, skip, clm(6) double tau0, tau1 C NCLEND open (11,file=fname,....) read (11,..) ... close(11) ! optional... depends on what u want to do return end ====== Next

WRAPIT gamap.f [will produce gamap.so only done once]

======

external GAMAP "./gamap.so"

begin fname = "foo.model" ; name of input file ; preallocate space for return variables modelname = new(20,"character") category = new(40,"character") unit = new(40,"character") modelres = new( 2,"float") halfpolar = -999 center180 = -999 tracer = -999 tau0 = -999.d0 tau1 = -999.d0 clm = new (6,"integer") skip = -999 GAMAP::rdpunch1 (fname,modelname, modelres, halfpolar \ ,center180, category,tau0, tau1, clm, skip) fnc = addfile("./foo.nc", "c") fnc@title = "DEMO" fnc@modelname = chartostring( modelname ) ; make type string : [etc]

end

You can have additional subroutines in gamap.f that read data etc.

---- I am not sure why the GEOS-CHEM model did not choose netCDF or HDF-SDS or HDF-EOS (grid) for archival. These are self-describing formats that are portable. Ascii files are *large* and binary files have big/little-endian issues.

Regards

Dennis Shea

_______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Wed Jul 27 2005 - 07:55:09 MDT