[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #BVE-541882]: vector divided by data



Hi Alberto-

> Dearest Don... Our University mail server was down for the whole week
> (we have a large eastern holiday in Spain)... so, if you have sent me
> something I might not have received it.

No, I had to go out of town on a family emergency and am just back
in the office today.  Sorry for the delay in responding.

Again, the basic problem is one of units.  When  you divide the
u and v components by V0, you are dividing m/sec by m/sec so you
end up with dimensionless units.  When you try to add vector2
and -vector, you'll get a Unit exception because one has no
units and the other has m/sec.  The only way I know around this
is to fake the system by changing the units (but not the values)
of V0 to be m2/sec2 so when you divide that into the vector, you'll
end up with components with m/sec for units.  So, here's the
code:

def ekmanVector(U10,V10,HGT):
  W=sqrt(U10*U10+V10*V10)
  V0=0.0127*W/sqrt(sin(latr(U10)))
  vector=makeTrueVector(V0*0.707,V0*0.707)
  vector2=makeTrueVector(U10,V10)
  V1 = newUnit(V0,"offset","m2/s2")
  u = newName(ur(vector2)/V1,"U")
  v = newName(vr(vector2)/V1,"V")
  vector2=vecr(u,v)
  sum=add(vector2,-vector)
  return sum


however, when I plot this, I get very high values for the resulting
vectors, so I think there's some problem with the math logic of
what you are trying to accomplish.  All my fix does is correct the
units.  I'll try to check with some of our experts here on the logic,
but I'll be out the rest of this week.

> I'd also like to know your work position (department, commission,
> field of research etc.) inside Unidata in order to rightly cite your
> name/job in my diploma thesis manuscript. It's the least I can do in
> order to thank your help.

Here's my vita:

Don Murray is a meteorologist/software engineer at the Unidata Program Center 
in Boulder, Colorado.  He is currently the lead developer of Unidata’s 
Integrated Data Viewer (IDV).  His interests include geoscience visualization, 
remote data access, glacial geology and gardening.  He has a M.S. in Earth 
Sciences from Montana State University and is a member of the American 
Meteorological Society.  You can contact him at address@hidden.

You can modify that to suit your needs.  Thanks for including me.

> Best regards from sunny Spain.

Same from snowy Colorado.

Don


> El 11/03/2008, a las 17:41, Unidata IDV Support escribió:
> 
> > Hi Alberto-
> >
> > Thanks Don... take your time. You've already got to deserve being
> >> cited/thanked on my manuscript.
> >>
> >> Regards form the still un-iphoned Spain.
> >
> > No progress on this yet and I'll be out until next week.  I'll
> > get back to it then.
> >
> > Don
> >> Alberto.
> >>
> >> El 07/03/2008, a las 13:41, Unidata IDV Support escribió:
> >>
> >>> Hi Alberto-
> >>>
> >>> I will get back to you next week on this.
> >>>
> >>> Don
> >>>
> >>>> Dearest Don (Ok... I guess it's always Don Murray behind the
> >>>> curtains :-) ). Thanks God.
> >>>>
> >>>> Seriously, thanks for your offer beforehand... I definitely think I
> >>>> need your help... Let me tell you I'm planning to include your name
> >>>> on
> >>>> the citations, references and thanks chapters of my research
> >>>> work...
> >>>> If you kindly allow me to :-) You can eventually include a
> >>>> reference
> >>>> to my work in your CV if you like.
> >>>>
> >>>> Ok...I'm trying to derive the Ekman vectors of the very first Ekman
> >>>> layer. Winds blowing over the sea induce water currents which are
> >>>> always 45º to the right of the wind forcing vector: that simple.
> >>>> The
> >>>> module (induced water current speed) is obtained with this simple
> >>>> expression:
> >>>>
> >>>> V0 = 0.0127·W/sqrt(sen(L))   where
> >>>>
> >>>> 0.0127 is a dimensionless parameter
> >>>> W is the wind vector module, W=sqrt(U10*U10+V10*V10)  in m/s
> >>>> sqrt(sen(L)) is the sine of the Latitude, square rooted
> >>>> (dimensionless)
> >>>>
> >>>> The Ekman vector (water current speed) is then builded in this
> >>>> simply
> >>>> way: V = (V0*cos(45), V0*sin(45))   (just a 45º vector bended to
> >>>> the
> >>>> right with respect to to the origin of coordinates and with module
> >>>> V0). V is build with makeTrueVector().
> >>>>
> >>>> BUT... V must always be 45º bended to the right of the wind vector
> >>>> W(U10,V10)  (and not the origin of coordinates), that's why I must
> >>>> finally add both vectors V+W. BUT as W is ~100 times greater than
> >>>> V,
> >>>> if I add the two vectors, I'll end up with a sum vector which will
> >>>> almost be like W... that's why I had the idea of reducing W's
> >>>> module
> >>>> to V0. I'm just interested in angle sum... I already know the water
> >>>> current vector intensity (V0).
> >>>>
> >>>> I don't know if I'm explaining myself... the induced water current
> >>>> speed vector is just a vector with module V0 and bended 45º to the
> >>>> right of the forcing wind vector. Example: if the W is 60º, then
> >>>> V is
> >>>> 45º to the right of that (that's 105º) and module V0.
> >>>>
> >>>> The reasoning is extremely simple but somehow awkward for me to
> >>>> program it on jythoon/IDV. If you could help I'd be strongly and
> >>>> eternally thankful. If I could make this simple calculation
> >>>> directly
> >>>> on IDV I'll be able to paint and animate water currents very
> >>>> easily.
> >>>> And on the fantastic IDV.
> >>>>
> >>>> Best regards from Spain,
> >>>> Alberto.
> >>>>
> >>>> PS: the reason why I'm including HGT (terrain height) on the
> >>>> formula
> >>>> is just a trick planned for later. I was planning to multiply the
> >>>> sum
> >>>> vector by a power of cos(HGT)... Why? Very simple: is just a quick
> >>>> trick to faint V0 module when terrain height goes up (on land)...
> >>>> because I don't want sea surface current speed vector to be painted
> >>>> on
> >>>> land :-) I guess IDV doesn't understand that V is water current and
> >>>> it's not to paint anything on land. IDV is smart, but not so
> >>>> smart as
> >>>> to understand that.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> El 06/03/2008, a las 16:53, Unidata IDV Support escribió:
> >>>>
> >>>>> Hi Alberto-
> >>>>>
> >>>>>> (If you're Don Murray replying me, thanks for your previous
> >>>>>> help!)
> >>>>>
> >>>>> Glad to help.
> >>>>>
> >>>>>> Hi... My name is Alberto Corbí and I'm a PhD Student happily
> >>>>>> using
> >>>>>> IDV
> >>>>>> to analyze WRF netCDF output. Here's my question.
> >>>>>>
> >>>>>> I'd like to have a wind vector (composed with makeTrueVector)
> >>>>>> divided
> >>>>>> by a "number" derived from the current latitude. And I get this
> >>>>>> message:
> >>>>>>
> >>>>>> visad.TypeException: visad.TypeException: FunctionType.binary:
> >>>>>> types
> >>>>>> don't match
> >>>>>
> >>>>> The problem is that you are trying to divide a vector by a scalar
> >>>>> and this is not allowed in the abstract VisAD math model.  You
> >>>>> need
> >>>>> to divide each component of the vector by the scalar.
> >>>>>
> >>>>> In general, the VisAD data model carries along units with all
> >>>>> mathematical operators so you need to be careful about making
> >>>>> sure your units all are compatible.  See below:
> >>>>>
> >>>>>>
> >>>>>> Here's my very very simple function:
> >>>>>>
> >>>>>> def ekmanVector(U10,V10,HGT):
> >>>>>> W=sqrt(U10*U10+V10*V10)
> >>>>>> V0=0.0127*W/sqrt(sin(latr(U10)))
> >>>>>> vector=makeTrueVector(V0*0.707,V0*0.707)
> >>>>>> vector2=makeTrueVector(U10,V10) / V0     <- Here's the error
> >>>>>> (or so
> >>>>>> I believe)
> >>>>>> sum=add(vector2,-vector)
> >>>>>> return sum
> >>>>>
> >>>>> So, if you change the above to:
> >>>>>
> >>>>> def ekmanVector(U10,V10,HGT):
> >>>>> W=sqrt(U10*U10+V10*V10)
> >>>>> V0=0.0127*W/sqrt(sin(latr(U10)))
> >>>>> vector=makeTrueVector(V0*0.707,V0*0.707)
> >>>>> vector2=makeTrueVector(U10,V10)
> >>>>> vector2=vecr(ur(vector2)/V0,vr(vector2)/V0)
> >>>>> sum=add(vector2,-vector)
> >>>>> return sum
> >>>>>
> >>>>> You'll get a little further.  However, dividing the U component
> >>>>> of vector2 by V0 will result in dimensionless units (m.s-1/m.s-1)
> >>>>> so you'll end up with a UnitException when trying to add
> >>>>> vector2 (dimensionless) to -vector (m.s-1).
> >>>>>
> >>>>>> I'm just trying to derive Ekman surface currents: that simple!
> >>>>>
> >>>>> Can you send along the formula or a reference so I can try to
> >>>>> assist you further?  That will help me understand what units
> >>>>> the constants (0.0127, 0.707) are supposed to be.  Also, what is
> >>>>> HGT being used for?
> >>>>>
> >>>>>> Thanks millions in advance, (again, I haven't found anything in
> >>>>>> forums
> >>>>>> nor in mailing lists and I'm sorry to disturb you)
> >>>>>
> >>>>> Thanks for checking there first.
> >>>>>
> >>>>> Don Murray
> >>>>>
> >>>>>
> >>>>> Ticket Details
> >>>>> ===================
> >>>>> Ticket ID: BVE-541882
> >>>>> Department: Support IDV
> >>>>> Priority: Normal
> >>>>> Status: Open
> >>>>>
> >>>>
> >>>> Alberto Corbi Bellot
> >>>> Estudiante 3er Ciclo
> >>>> Ciencias del Mar
> >>>> Universidad Católica de Valencia
> >>>> San Vicente Mártir
> >>>> Tel: 610457462
> >>>>
> >>>>
> >>>
> >>>
> >>> Ticket Details
> >>> ===================
> >>> Ticket ID: BVE-541882
> >>> Department: Support IDV
> >>> Priority: Normal
> >>> Status: Open
> >>>
> >>
> >> Alberto Corbi Bellot
> >> Estudiante 3er Ciclo
> >> Ciencias del Mar
> >> Universidad Católica de Valencia
> >> San Vicente Mártir
> >> Tel: 610457462
> >>
> >>
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: BVE-541882
> > Department: Support IDV
> > Priority: Normal
> > Status: Open
> >
> 
> Alberto Corbi Bellot
> Estudiante 3er Ciclo
> Ciencias del Mar
> Universidad Católica de Valencia
> San Vicente Mártir
> Tel: 610457462
> 
> 


Ticket Details
===================
Ticket ID: BVE-541882
Department: Support IDV
Priority: Normal
Status: Open