Ignore:
Timestamp:
Nov 18, 2011, 1:51:41 PM (13 years ago)
Author:
acolaitis
Message:

PYTHON:

  • Improved handling of missing values NaN by min() and max() functions
  • Added the possibility to change the viewing angle of "ortho" projections by using --blat. Default is meanlat. (remember than in spstere and npstere projections, blat already controls the boundling latitude)
  • Changed colorbar of "operation" plots to RdBu_r, whatever the colorbar of other plots are. The thinking behind this is that this is a symmetrical colorbar, which is very usefull for difference plots. (could be changed for other operations.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/mymath.py

    r395 r398  
    22        import numpy as np
    33        if field is None: return None
     4        if type(field).__name__=='MaskedArray':
     5              field.set_fill_value(np.NaN)
     6              return np.ma.array(field).min(axis=axis)
     7        elif (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')):
     8              return np.ma.masked_invalid(field).min(axis=axis)
    49        else: return np.array(field).min(axis=axis)
    510
     
    712        import numpy as np
    813        if field is None: return None
     14        if type(field).__name__=='MaskedArray':
     15              field.set_fill_value(np.NaN)
     16              return np.ma.array(field).max(axis=axis)
     17        elif (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')):
     18              return np.ma.masked_invalid(field).max(axis=axis)
    919        else: return np.array(field).max(axis=axis)
    1020
     
    1626              field.set_fill_value(np.NaN)
    1727              zout=np.ma.array(field).mean(axis=axis)
    18 #              np.ma.masked_invalid(zout)
    1928              zout.set_fill_value(np.NaN)
     29              return zout.filled()
     30           elif (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')):
     31              zout=np.ma.masked_invalid(field).mean(axis=axis)
     32              zout.set_fill_value([np.NaN])
    2033              return zout.filled()
    2134           else:
Note: See TracChangeset for help on using the changeset viewer.