Re: [idvusers] Adding two different 4d grids

Hi Ken/Don,

Thanks for your help/suggestions.  I have submitted a bug report via the
support interface.

Ken,

def simpleAdd(F1,F2):
    return F1 + F2

This generates the following error: "visad.TypeException:
visad.TypeException: FunctionType.binary:
 types don't match
FunctionType.binary: types don't match"

Regards,

Paul

On 29 August 2013 03:22, Don Murray (NOAA Affiliate) <don.murray@xxxxxxxx>wrote:

> Hi Paul-
>
>
> On 8/27/13 4:26 PM, Paul Graham wrote:
>
>> Hi Don,
>>
>> The first method generates a "visad.UnitException".  The second one (with
>> noUnit) generates "java.lang.**NullPointerException".  Any ideas as to
>> what
>> can be done?
>>
>
> I suggest running your second method and when the error occurs, use the
> submit button to submit this to Unidata support.  That will provide them
> with the stack trace so they can track down the problem. In theory, it
> should work. ;-)
>
> I would expect the unit exception from the first method.  Unlike most
> other programs which ignore units, IDV will try to do automatic unit
> conversion between variables.  That way you can add temperatures in Celsius
> to temperatures in Kelvin and get a meaningful answer.  In the real world,
> you can't physically add quantities with incompatible units and get a
> meaningful answer (e.g. you can't get a valid unit result out of adding a
> gallon to a meter).  But here you just want to add some numbers together,
> so making the IDV ignore units with the noUnit method is the way to go.
>
> Don
>
>  On 28 August 2013 08:25, Paul Graham <meteorpaul@xxxxxxxxx> wrote:
>>
>>  Hi Don,
>>>
>>> The first method generates a "visad.UnitException".  The second one (with
>>> noUnit) generates "java.lang.**NullPointerException".  Any ideas as to
>>> what
>>> can be done?
>>>
>>> Thanks,
>>>
>>> Paul
>>>
>>>
>>> On 27 August 2013 23:19, Don Murray (NOAA Affiliate) <
>>> don.murray@xxxxxxxx>wrote:
>>>
>>>  I would expect that the second one would work.  What errors do you get?
>>>>
>>>> Don
>>>>
>>>>
>>>> On 8/26/13 8:49 PM, Paul Graham wrote:
>>>>
>>>>  Dear IDV Users,
>>>>>
>>>>> What is the best way to add two different 4d grids (ie. having
>>>>> different
>>>>> units) in order to create dimensionless field?
>>>>>
>>>>> Eg.  Suppose, for whatever reason, you wanted to add convective
>>>>> available
>>>>> potential energy (CAPE), F1, and rainfall rate, F2.
>>>>>
>>>>> I have not been able to get either of the following to work (IDV
>>>>> produces
>>>>> errors):
>>>>>
>>>>> def simpleAdd(F1,F2):
>>>>>     res = add(F1,F2)
>>>>>     return res
>>>>>
>>>>> def simpleAdd(F1,F2):
>>>>>     res = add(noUnit(F1),noUnit(F2))
>>>>>     return res
>>>>>
>>>>> What should I do?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Paul
>>>>> ______________________________****_________________
>>>>>
>>>>> idvusers mailing list
>>>>> idvusers@xxxxxxxxxxxxxxxx
>>>>> For list information, to unsubscribe, visit:
>>>>> http://www.unidata.ucar.edu/****mailing_lists/<http://www.unidata.ucar.edu/**mailing_lists/>
>>>>> <http://www.**unidata.ucar.edu/mailing_**lists/<http://www.unidata.ucar.edu/mailing_lists/>
>>>>> >
>>>>>
>>>>>
>>>>>  --
>>>> Don Murray
>>>> NOAA/ESRL/PSD and CIRES
>>>> 303-497-3596
>>>> http://www.esrl.noaa.gov/psd/****people/don.murray/<http://www.esrl.noaa.gov/psd/**people/don.murray/>
>>>> <http://**www.esrl.noaa.gov/psd/people/**don.murray/<http://www.esrl.noaa.gov/psd/people/don.murray/>
>>>> >
>>>>
>>>> ______________________________****_________________
>>>> idvusers mailing list
>>>> idvusers@xxxxxxxxxxxxxxxx
>>>>
>>>> For list information, to unsubscribe, visit:
>>>> http://www.unidata.ucar.edu/
>>>> **mailing_lists/ 
>>>> <http://www.unidata.ucar.edu/**mailing_lists/<http://www.unidata.ucar.edu/mailing_lists/>
>>>> >
>>>>
>>>
>>>
>>>
>>>
>>> --
>>>
>>>
>>>  ______________________________**_________________
>> idvusers mailing list
>> idvusers@xxxxxxxxxxxxxxxx
>> For list information, to unsubscribe, visit: http://www.unidata.ucar.edu/
>> **mailing_lists/ <http://www.unidata.ucar.edu/mailing_lists/>
>>
>>
> --
> Don Murray
> NOAA/ESRL/PSD and CIRES
> 303-497-3596
> http://www.esrl.noaa.gov/psd/**people/don.murray/<http://www.esrl.noaa.gov/psd/people/don.murray/>
>
> ______________________________**_________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit: http://www.unidata.ucar.edu/*
> *mailing_lists/ <http://www.unidata.ucar.edu/mailing_lists/>
>