[ 
https://issues.apache.org/jira/browse/CLIMATE-803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16266259#comment-16266259
 ] 

Michael Anderson commented on CLIMATE-803:
------------------------------------------

The problem here is that the method assumes the first dataset passed is a 
masked array.  If a regular numpy array (e.g. OCW dataset) is passed, it does 
not have a mask attribute and an error is thrown

After calculating the mean and std, it attempts to apply the mask of the first 
dataset to the results.

As mentioned for the other JIRA I'm looking at:

1.  I could tidy up the error handling to make it more clear to the caller that 
a masked array was expected.

2.  I could check if a mask exists and use that.  In the case of the mask not 
being supplied, I could carry out the intent of the function and manually check 
the array for "missing values".  

Alternatively

3.  In this case, the error is happening in 
utils.calc_subregion_area_mean_and_std.  It could be assumed that the masking 
should have occurred in the data processing and could simply be removed from 
this method.  

Preferences on the approach?

> AttributeError in Utils.py
> --------------------------
>
>                 Key: CLIMATE-803
>                 URL: https://issues.apache.org/jira/browse/CLIMATE-803
>             Project: Apache Open Climate Workbench
>          Issue Type: Bug
>            Reporter: Ibrahim Jarif
>            Assignee: Michael Anderson
>            Priority: Critical
>             Fix For: 1.3.0
>
>
> AttributeError in *calc_subregion_area_mean_and_std* function
> {code}
> AttributeError: 'numpy.ndarray' object has no attribute 'mask'
> {code}
> The following line raises the error
> {code}
> mask_array = dataset_array[0].values[0,:].mask
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to