[Thread Prev][Thread Next][Index]

Re: [ferret_users] Vector plot: force maximum?




Hi Mick,

Great! I think this will do most of what I want. I'm just a little unclear about the use of the /length option. I had been using it to scale the vectors but I'm not sure it is scaling the red ones down to the threshold the way I am using it. I'd use it the way you are (just /length as opposed to /length=.15) except when I do that it makes all of the vectors too small.

If I do:

	vector/nolab/length=.2 ulo,vlo
	vector/over/nolab/length uhi,vhi

should that scale the hi's back correctly? Is that the same as having them both be length=.2 :

	vector/nolab/length=.2 ulo,vlo
	vector/over/nolab/length=.2 uhi,vhi


Thanks very much.

Steve
______________________________________________________________________
 Steve Cousins, Ocean Modeling Group    Email: cousins@xxxxxxxxxxxxxx
 Marine Sciences, 452 Aubert Hall       http://rocky.umeoce.maine.edu
 Univ. of Maine, Orono, ME 04469        Phone: (207) 581-4302

On Tue, 5 May 2009, mick spillane wrote:

Hi Steve,
   Perhaps a better, or more easily explainable in a caption, version
of the figure would be to do an overlay plot with two colors (or
thicknesses) of arrow.  The first set of arrows (say black ones)  would
be those associated with speeds below the threshold (8cm/s), the second
set (say in red) would be those with speeds above the threshold and
forced to have the length associated with the threshold value but the
true direction.

let spd=(u^2+v^2)^0.5
let threshold=0.08
! define components of "low" speed cases to exclude speeds above threshold
let ulo=if(spd le threshold)then u
let vlo=if(spd le threshold)then v
! rescale components of "high" speed cases to have fixed length (and
exclude low speed ones)
let uhi=if(spd gt threshold)then u*threshold/spd
let vhi=if(spd gt threshold)then v*threshold/spd

! then ...
vector/nolab ulo,vlo
vector/over/nolab/length uhi,vhi

NOTE: There is one wrinkle I forgot in the first test -- you need to
force the second (overlay) vector plot to share the same scale as the
first. That is achieved by the "/length" option which draws the new
vector field with the same scale length as the previous one.

Attached is a graphic of a quick demo using random numbers for u,v.  The
upper panel shows the vectors without a threshold; the lower illustrates
what it would look like with red arrows where speed exceeds the threshold.

Mick
-------

let u=0.08*randn(i+j) ; let v=0.08*randu(i+j)
set view upper
vector/nolab/i=1:10/j=1:8 u,v

let spd=(u^2+v^2)^0.5
let threshold=0.08
! define components of "low" speed cases to exclude speeds above threshold
let ulo=if(spd le threshold)then u
let vlo=if(spd le threshold)then v
! rescale components of "high" speed cases to have fixed length (and
exclude low speed ones)
let uhi=if(spd gt threshold)then u*threshold/spd
let vhi=if(spd gt threshold)then v*threshold/spd

set view lower
vector/nolab/i=1:10/j=1:8/length ulo,vlo
vector/over/nolab/i=1:10/j=1:8/length uhi,vhi
frame/file=forsteve.gif


Steve Cousins wrote:

Long time!

I have a dataset with U and V velocity components. There is a river
that comes into the domain that has high values that I want to limit.
What I have done so far is:

let wind_mask = IF ABS( (u^2 + v^2)^.5) LT .08 THEN 1
let u2 = u * wind_mask
let v2 = v * wind_mask

vector/xskip=2/yskip=2 u2,v2

This works but it puts holes in the data. What we'd like is to have it
so if a speed is greater than 8 cm/sec we scale it down to 8 cm/sec so
the grid doesn't have holes in it and we can still see the direction.

Thinking about this as I type (don't try this at home!) I think I need
something like:

let wind_mask = IF ABS( (u^2 + v^2)^.5) LT .08 THEN 1 ELSE
                  (.08 /  ABS( (u^2 + v^2)^.5))

... testing ...

It works! Ferret is Great! Hold on. I think it is working. It fills in
the gaps. It *looks* like the scaling is correct...

Is there a better way to do this?

Thanks,

Steve
______________________________________________________________________
 Steve Cousins, Ocean Modeling Group    Email: cousins@xxxxxxxxxxxxxx
 Marine Sciences, 452 Aubert Hall       http://rocky.umeoce.maine.edu
 Univ. of Maine, Orono, ME 04469        Phone: (207) 581-4302






[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement