This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
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