[gradsusr] Plot images by using two different .ctl files (different lat long steps)

Qian Hao yoru.007 at gmail.com
Fri Apr 1 08:30:03 EDT 2011


Well, hello Paolo,
I found that 'set dfile' could not change the dimension configuration of
grads.When you open a file for the first time, grads will set up its
dimensional coordinates accordingly.When you open a second file, the
dimensional coordinates do not change. You may check this with the 'q dims'
command.
And that's the problem. So you have to close the first opened file first if
you want to display another variable from a second data file with a
different coordinate settings. You my change you .gs file like this:

'open suolo.ctl'
...
'close 1'
'open msg.ctl'
...

I think this would work.
2011/4/1 Paolo Boi <pboi at arpa.sardegna.it>

>  Thanks Quian Hao,
>
> The .gs script contains the lines 'd file1' and 'd file2', but it plots
> only the first data file, no matter it is. I tried to exchange the two
> files, but it plots only the first one.
> Here is the script .gs:
>
> 'reinit'
>
> * Palette colori
> * --------------
>
> 'run /opt/grads-1.8sl11/lib/colors/BYR-02'
>
> * Apertura file .ctl
> * ------------------
>
> 'open suolo.ctl'
> 'open msg.ctl'
>
>
> * Mappa
> * -----
>
> 'set mpdraw on'
> 'set display color black'
> 'set mproj nps'
> 'set mpdset hires'
> 'set map 13'
> 'set lon 0 20'
> 'set lat 35 45'
>
> *
> i=1
> *ntime=1
> *while (i<=ntime)
> 'clear'
> 'set t 'i
> *
> * Non riesce a passare da un grafico all'altro.
> * Grafica il primo file (sia esso mslp o msg) ma il secondo no
> * se i due grib hanno la stessa risoluzione (vedi geop e temp 850)
> * allora li grafica
> * perch??
> *
> * Traccia le isolinee di mslp
> * -------------------
> 'set dfile 1'
>
> 'set gxout contour'
> 'set cint 4 '
> 'set ccolor 0'
> 'set csmooth on'
> 'set clopts 1 1 0.08'
> 'set cthick 6'
> 'd MSLsfc/100'
>
>
> 'set dfile 2'
>
> * Plot shading
> * ------------
> 'set gxout shaded'
> *'set ccols  13  5   10    3  2   6   9   8   16  18   20  22   24   26
> 28   30  40  42   44  46  48  50  52  54   56  58    60   62  64  66  68  70
> 72  74  76 '
> *'set clevs -80  -70 -65 -60 -58 -56 -54 -52 -50 -48 -46 -44 -42 -40 -38
> -36 -34 -32 -30 -28 -26 -24 -22 -20  -15 -10  -5   0   2   4   6   8   10
> 12   14   16  18  20  22  24  26   30 40 '
> 'set clevs  0  3   9    15 21  27 30 36 41 47 50 60 66  70 75 80 86  90 95
> 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190
> 195 200 205 210 215 220 225 230 235 240 245 250 255'
> 'set ccols   5  13   10   3  80 79 78 77 76 75 74 73 72 71  70 69  68   67
> 66  65   64   63  62 61 54   52  50   48  46  44 42  40  38  36   34   32
> 30  28 26 24   22  20   18  16'
> 'd IMGD/4 '
>
>
> * legenda
>
> 'run cbarn 1 1'
>
> 'q time'
> res = subwrd(result,3)
> data=substr(res,1,15)
>
> 'set string 1 tc 8'
> 'set strsiz 0.13 0.16'
> 'draw title IR T(C)   'data''
> *'draw title IR T(C)   'day' 'month' 'year' 'hour''
> 'draw string 8.2 0.5 Dati EUMETSAT   Elaborazioni SAR'
> *'draw string 1.2 0.5 Analisi'
>
>
> 'enable print msg.gm'
> 'print'
> 'disable print'
> *i=i+1
> *endwhile
> 'quit'
>
>
>
>
> On Fri, 2011-04-01 at 02:28, Qian Hao wrote:
>
> *Please also provide your .gs script file. I suggest you 'set dfile' to
> the corresponding file you are going to dispaly. Hope this may help.
>
> 2011/3/30 Paolo Boi <**pboi at arpa.sardegna.it* <pboi at arpa.sardegna.it>>
>
> Hi,
>
> I tried to plot two different set of data in GRIB format. Here are the two
> .ctl files, with different step in lat long:
>
> dset ^12140800.w73.grb
> index ^12140800.w73.grb.idx
> undef 9.999E+20
> title 12140800.w73.grb
> *  produced by grib2ctl v0.9.12.5p16
> dtype grib 255
> options yrev
> ydef 1024 linear 28.108000 0.0269494
> xdef 1280 linear -4.311000 0.0269494
> tdef 1 linear 08Z14dec2009 1mo
> zdef 1 linear 1 1
> vars 1
> IMGD  0 127,122,22  ** Image data []
> ENDVARS
>
> dset ^suolo.grb
> index ^suolo.grb.idx
> undef 9.999E+20
> title suolo.grb
> *  produced by grib2ctl v0.9.12.5p16
> dtype grib 255
> options yrev
> ydef 25 linear 20.000000 2.5
> xdef 65 linear -90.000000 2.5
> tdef 14 linear 12Z21mar2011 12hr
> zdef 1 linear 1 1
> vars 2
> MSLsfc  0 151,1,0  ** Mean Sea Level (MSL) Pressure [Pa]    Pa
> Tprs  0 130,100,850  ** Temperature [K]
> ENDVARS
>
> The two data set have a completely different step in lat long.
> Here is the output error. I' using grads-1.8sl11.
>
> Data Request Error: Invalid grid coordinates
>   World coordinates convert to non-integer grid coordinates
>     Variable = imgd  Dimension = 3
>   Error ocurred at column 1
> DISPLAY error:  Invalid expression
>   Expression = imgd/4
> Cannot plot color bar: No shading information
> Hardcopy output file is closed
> No hardcopy metafile open
> GX package terminated
>
>
>
> Many thanks
> Paolo
>
>
>        ---------------------------------------------------
> *Paolo Boi*
>
> ARPAS- Agenzia Regionale per la Protezione dell'Ambiente della Sardegna
> Dipartimento Specialistico Regionale Idrometeoclimatico
> Servizio Idrometeoclimatico
>
> Viale Porto Torres 119 - 07100 Sassari
> Tel + 39 079 258600
> Fax + 39 079 262681
>
>
> *_______________________________________________
> gradsusr mailing list*
> *gradsusr at gradsusr.org* <gradsusr at gradsusr.org>
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
> --
> 此致
>         敬礼!
>
> ------------------------------
>
> _______________________________________________
> gradsusr mailing listgradsusr at gradsusr.org*http://gradsusr.org/mailman/listinfo/gradsusr* <http://gradsusr.org/mailman/listinfo/gradsusr>
>
>
> ---------------------------------------------------
> *Paolo Boi*
>
>
> ARPAS- Agenzia Regionale per la Protezione dell'Ambiente della Sardegna
>
> Dipartimento Specialistico Regionale Idrometeoclimatico
>
> Servizio Idrometeoclimatico
>
> Viale Porto Torres 119 - 07100 Sassari
>
> Tel + 39 079 258600
>
> Fax + 39 079 262681
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
此致
        敬礼!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110401/988fffa8/attachment-0003.html 


More information about the gradsusr mailing list