[Thread Prev][Thread Next][Index]

Re: [ferret_users] Viewport and color_vector.jnl



Hi,
I'm glad to hear it was that simple to solve. That color vector script is complicated itself.

Just for general interest, there's another option for coloring vectors according to any variable, using color-filled polygons.  See

   yes? go poly_vector_demo

On 3/4/2013 11:18 AM, Otacilio Leandro wrote:
Hi Ansley,

You solved the problem. Moving the "set view full" outside the loop make it work just fine.

I've made that loop so i can easily fill the wind among several expertiments but i guess i will have to reduce its complexity.

By the way, "go brasil" its a script that i made to update the borders of the Brazilian states (using KML from google earth...)

Thank you very much.


2013/3/4 Ansley Manke <ansley.b.manke@xxxxxxxx>
Hi Otacilio,
It's difficult to debug the problem when it's such a complex script, without having your data.

I tried a simple script doing similar things, and the use of viewports itself doesn't seem to cause what you are seeing.  Based on the example from color_vector_demo.jnl, my script sets a region, sets viewports, calls the scripts margins.jnl, color_vector.jnl, and land.jnl, and writes some labels.  My test is below.

I would suggest you move the frame command and the main label outside the repeat loops. Does that change the problem? If not then gradually simplify your script to see if you can see which part of it is causing the vector arrows to disappear.  What is in the script 'go brasil' ?  If you comment out that command does it change anything?  If you don't use viewports, but just put a pause statement in the inner loop so you see each plot as it's made, do they have vector arrows? 

Here is my script.

   can mode logo
   set win/siz=0.5

   set data monthly_navy_winds
   let uu = uwnd[d=1]
   let vv = vwnd[d=1]
   set reg/x=160:360/y=-30:70/t=15-JUL-1989

!--define color_vector fields as in the demo

   define symbol vec_cmd      = VECTOR/hlimits=160:360:20/ vlimits=-30:70:10/nolab
   define symbol vec_u        = uu                    ! u var name, no [],(),*,/,+,-, ^ stuff
   define symbol vec_v        = vv                    ! v var name, no [],(),*,/,+,-, ^ stuff
   define symbol vec_len      = 10                    ! value for /LENGTH qualifier
   define symbol vec_xskip    = 2                     ! value for /XSKIP qualifier
   define symbol vec_yskip    = 2                     ! value for /YSKIP qualifier
   define symbol vec_arrowkey = YES                   ! YES or NO, for scale/key vector
   define symbol vec_veckey   = 325,78,,(f4.1, " m/s")! arguments to "PPL VECKEY" command
   define symbol vec_lo       = 0                     ! low   value for color levels
   define symbol vec_hi       = 9                     ! high  value for color levels
   define symbol vec_delta    = 0.5                   ! delta value for color levels
   define symbol vec_pal      = rainbow                ! palette file name
   define symbol vec_colorkey = YES                   ! YES or NO, for color bar/key
   define symbol vec_shakey   = 1,1,0.12,2            ! arguments to "PPL SHAKEY" command
   define symbol vec_otherppl = none                  !other ppl commands (should start with "ppl"),
                                                      !   for example
                                                      !   ppl xfor (f5.1, ''lonE'')

   set view upper
   go margins 1 0.9 0.9 1.2
   go color_vector
   go land
   label/nouser `($PPL$XLEN)/2`, -.8, 0, 0, .2, @ASlabel1

   set view lower
   go margins 1 0.9 0.9 1.2
   go color_vector
   go land
   label/nouser `($PPL$XLEN)/2`, -.8, 0, 0, .2, @ASlabel2

   set view full
   label/nou `($PPL$XLEN)/2`, 7.3, 0, 0, .18, @C07  Wind Speed xx mbar
   frame/file=color_vec_2.gif


On 3/4/2013 4:34 AM, Otacilio Leandro wrote:
Dear ferret users,

I am trying to analise a six month wind climatlogy over South America. 

For this i made a loop to make easy to make the figures for several experiments that i'm runing. 

The problem is: 

When combining viewport with the script color_vector, Ferret is clearing the first viewport when the second is filled and so on and the result is attached.


Thank you!

====================  My script   =============


! Script to analise the wind speed at pressure levels

!go startup.jnl

set window/aspect=.8

let modo = "$1"

IF `$1 eq 200` THEN
let alt = 8 
ELIF `$1 eq 500` THEN
let alt = 12
ELIF `$1 eq 700` THEN
let alt = 14
ELIF `$1 eq 850` THEN
let alt = 15
ELIF `$1 eq 925` THEN
let alt = 16
ELIF `$1 eq 1000` THEN
let alt = 17
else 
say "Inform the correct level.... quitting" 
exit
ENDIF


use uv_aabnra.pm.nc ! HPR 50%
use uv_aabnxa.pm.nc ! HPR 100%
use uv_aabnva.pm.nc ! HPR OFF
use uv_aabnsa.pm.nc ! CONTROLE
use uv_aabwua.pm.nc ! BIOMASS OFF 50%


let imes = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}

define region/x=85W:32W/y=15N:55S/k=`alt` SA
set region/@SA

def axis/calendar=360_day/t="16-JAN-1979":"16-NOV-2005":1/unit=month tax

! Several experiments

let exp_name = {"hpr_50","hpr_100","hpr_off","control","biomass_off"}

repeat/range=1:5/name=a (\
let var = exp_name[i=`a`] ;\
let u_`var` = u_1[d=`a`,gt=tax] ;\
let v_`var` = v_1[d=`a`,gt=tax,gxy=u_1] ;\
)

! Climatologies

use climatological_axes

repeat/range=1:5/name=a (\
let var = exp_name[i=`a`] ;\
let u_`var`_clim = u_`var`[gt=month_360_day@mod] ;\
let v_`var`_clim = v_`var`[gt=month_360_day@mod] ;\
)


go landscape3x2.jnl
let posicao = {"ul6", "um6", "ur6","ll6", "lm6", "lr6"}

ppl color,6,80,80,80 
ppl axlsze .16 .16

let marg = "1   1.2   1.2   .4"


let variavel1 = {"HPR_50","HPR_100","HPR_OFF","CONTROL","BIOMASS_OFF"}
let nome_var1 = {"HPR 50","HPR 100","HPR OFF","CONTROL","BIOMASS OFF"}


! COLOR VECTOR


define symbol vec_cmd      = VECTOR/nolab/set
define symbol vec_u        = uu
define symbol vec_v        = vv
define symbol vec_len      = 10
define symbol vec_xskip    = 1
define symbol vec_yskip    = 1
define symbol vec_arrowkey = YES
!define symbol vec_veckey   = 325,78,(f4.1, " m/s")
define symbol vec_veckey   = 310,19,,(f4.1, " m s^-^1")
define symbol vec_lo       = 0
define symbol vec_hi       = 20
define symbol vec_delta    = 1
define symbol vec_pal      = padrao
define symbol vec_colorkey = YES
define symbol vec_shakey   = 1,1,0.12,2
define symbol vec_otherppl = none
   PPL AXNMTC 3,3
   PPL AXLINT 2,2


! Test for the 1st experiment    ===> "m" loop on experiments and "a" loop for months
repeat/range=1:1/name=m ( \
repeat/range=6:11/name=a ( \
let var1 = variavel1[i=`m`] ;\
let nome1 = nome_var1[i=`m`] ;\
;\
let mes = imes[i=`a`] ;\
let pos = posicao[i=`a-5`] ;\
;\ ! MONTH ;\ 
set view `pos` ; go margins 1 .9 .9 1.2 ;\
;\
let uu=U_`var1`_CLIM[l=`a`] ; let vv=V_`var1`_CLIM[l=`a`] ;\
go color_vector ; go brasil ; go land 1 " " 1 ;\
label/nou `($PPL$XLEN)/2`, -.8, 0, 0, .2, @AS`mes` ;\
;\
set view full ;\
label/nou `($PPL$XLEN)/2`, 7.3, 0, 0, .18, @C07  Wind Speed `modo` mbar ;\ 
;\ 
frame/file=color-vec-exemple.gif ;\ 
 ))


exit




--
Otacilio Leandro de Menezes Neto
Instituto Nacional de Pesquisas Espaciais
Doutorando em Meteorologia
Contato: (12) 3186-9537 / (12) 8194-1455
Email alternativo: otacilio.neto@xxxxxxxxxxxxx




--
Otacilio Leandro de Menezes Neto
Instituto Nacional de Pesquisas Espaciais
Doutorando em Meteorologia
Contato: (12) 3186-9537 / (12) 8194-1455
Email alternativo: otacilio.neto@xxxxxxxxxxxxx


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement