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

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



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