[gradsusr] doubt in cat command in grads

Lee Byerle lbyerle at yahoo.com
Sun Nov 27 19:11:10 EST 2011


Hi Dipak and Eric,
To follow up, here is an example using "-no_header" where the file  
UV.dat consists of u- and v- wind on 17 levels and is result of CAT  
command.  The data are de-gribbed first (ugrd.out, vgrd.out) from the  
grib2 file ${mod}:


wgrib2 ${NCEP}/${mod} | egrep "(:UGRD:1000 mb:|:UGRD:925 mb:|:UGRD:850  
mb:|:UGRD:700 mb:|:UGRD:600 mb:|:UGRD:500 mb:|:UGRD:400 mb:|:UGRD:300  
mb:|:UGRD:250 mb:|:UGRD:200 mb:|:UGRD:150 mb:|:UGRD:100 mb:|:UGRD:70  
mb:|:UGRD:50 mb:|:UGRD:30 mb:|:UGRD:20 mb:|:UGRD:10 mb:)" | wgrib2 - 
no_header -i ${NCEP}/${mod} -ieee $NCEP/ugrd.out

wgrib2 ${NCEP}/${mod} | egrep "(:VGRD:1000 mb:|:VGRD:925 mb:|:VGRD:850  
mb:|:VGRD:700 mb:|:VGRD:600 mb:|:VGRD:500 mb:|:VGRD:400 mb:|:VGRD:300  
mb:|:VGRD:250 mb:|:VGRD:200 mb:|:VGRD:150 mb:|:VGRD:100 mb:|:VGRD:70  
mb:|:VGRD:50 mb:|:VGRD:30 mb:|:VGRD:20 mb:|:VGRD:10 mb:)" | wgrib2 - 
no_header -i ${NCEP}/${mod} -ieee $NCEP/vgrd.out

cat $NCEP/ugrd.out $NCEP/vgrd.out  > $NCEP/UV.dat

Lee

On Nov 26, 2011, at 10:24 PM, Eric Altshuler wrote:

> Dipak,
>
> As far as I know, the only type of binary files you can 'cat'  
> correctly are GRIB files. In general, if you cat two binary (or  
> netcdf) files to make a third file, the output file will contain a  
> spurious end-of-file (EOF) character that causes it to be corrupted.  
> You're better off keeping the two files separate:
>
> 'open rainc.ctl'
> 'open rainnc.ctl'
> 'set t 9'
> 'd rainc.1+rainnc.2'
>
> Eric
>
> ----- Original Message -----
> From: "dipak sahu" <dipakmath at gmail.com>
> To: gradsusr at gradsusr.org
> Sent: Saturday, November 26, 2011 6:37:54 AM
> Subject: [gradsusr] doubt in cat command in grads
>
>
>
> Dear grads user
> I have some doubt in cat command in grads. I have two sets of ctl  
> and dat files in grads one is RAINC.ctl, RAINC.dat and another one  
> is RAINNC.ctl, RAINNC.dat. And I tried to make these two .ctl file  
> to one .ctl file. so I tried the following command to creat one .dat  
> file
> $ cat RAINC.dat RAINNC.dat > RAIN.dat
> and also make one .ctl file RAIN.ctl containing both the parameters  
> RAINC (1st variable)and RAINNC (2nd variable)
>
> for verification I tried two cases in grads
> case-1
> open RAIN.ctl
> set t 9
> d rainc+rainnc (it gives value 0 90)
>
> case-2
> open RAINC.ctl
> open RAINNC.ctl
> set t 9
> d rainc.1+rainnc.2 (it gives value 0 35)
>
> So, is there anything wrong with the cat command in grads. If so  
> what is the alternate procedure to combine two .ctl and .dat files  
> to make one file?
>
> welcome for your suggestion
> dipak
>
> -- 
> ********************************************
> Dipak kumar Sahu,
> Research Scholar,
> Centre for Atmospheric Sciences.,
> Indian Institute of Technology,Delhi
> email:- dipak_math at yahoo.com
> **********************************************
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr




More information about the gradsusr mailing list