**To**:**mick spillane <Mick.Spillane@xxxxxxxx>****Subject**:**Re: [ferret_users] Vector plot: force maximum?****From**:**Steve Cousins <cousins@xxxxxxxxxxxxxx>**- Date: Tue, 05 May 2009 18:00:39 -0400 (EDT)
- Cc: Ferret Mailing list <ferret_users@xxxxxxxx>, Ansley Manke <Ansley.B.Manke@xxxxxxxx>
- In-reply-to: <fc.004c4d193d06f4883b9aca00e58863b0.3d06f489@xxxxxxxxxxxxxx>
- References: <alpine.LFD.0.999.0905051331320.17728@xxxxxxxxxxxxxxxxxxxxxx> <fc.004c4d193d06f4883b9aca00e58863b0.3d06f489@xxxxxxxxxxxxxx>
- Reply-to: cousins@xxxxxxxxxxxxxx
- Sender: owner-ferret_users@xxxxxxxx

Hi Mick,

If I do: vector/nolab/length=.2 ulo,vlo vector/over/nolab/length uhi,vhi

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

**References**:**[ferret_users] Vector plot: force maximum?***From:*Steve Cousins

- Previous by thread:
**Re: [ferret_users] Vector plot: force maximum?** - Next by thread:
**Re: [ferret_users] Vector plot: force maximum?**

Contact Us

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement