[gradsusr] Writing a time average of 3d data in GRD format

Arlindo da Silva dasilva at alum.mit.edu
Mon Jul 5 23:54:03 EDT 2021

On Sat, Jul 3, 2021 at 2:52 PM <tanmays at barc.gov.in> wrote:

> Dear Users,
> I am trying to make a *.grd file after taking time average of 3d data
> (x,y,z). eg.
> In following step:
> >> Open ma_cexcad.ctl
> (The data is having dimensions of x=360, y=180, z=40, t=365)
> >> set z 1 40
> >>  extjan = ave(ma_cexcad, t=1, t=31)
> >> set gxout fwrite
> >> set fwrite -be extjan.grd
> >> d extjan
> This is giving error " invalid dimension environment, Looping dimension
> does not vary".
> This is because I am varying z from 1 to 40. If i fix z=1 the this will
> write.
> But I want a *.grd file (if I write in *.nc file this is going fine but
> i want *.grd file only because i can add all *grd files in simple manner
> later) which will contain the parameter extjan with its all vertical
> level.
If you have opengrads, you can accomplish this easily with lats4d:

ga-> latds4d -i max_cexcad.ctl -o extjan.grd -time 1jan2021 31jan2021
-format stream -be -mean -v

or from the OS command line,

% latds4d.sh -i max_cexcad.ctl -o extjan.grd -time 1jan2021 31jan2021
-format stream -be -mean -v

Adjust the time for whatever year you have. Type "lats4d.sh -h" for other


> How to do that?
> Please help.
> Thank you in advance.
> Regards
> Tanmay
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

Arlindo da Silva
*dasilva at alum.mit.edu <dasilva at alum.mit.edu>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20210705/a435fecf/attachment.html>

More information about the gradsusr mailing list