nappy/nc_interface/cdms_to_na.py
def _convertSingletonVars(self, variables):
        """
        Loops through variables to convert singleton variables (i.e. Masked Arrays/Numeric Arrays) 
        to proper CDMS variables. Then code won't break when asking for rank attribute later.
        Returns a list of CDMS variable objects
        """
        vars = []

        for variable in variables:
            var_obj = variable

            # If singleton variable then convert into proper CDMS variables so code doesn't break later
            if not hasattr(var_obj, "rank") or var_obj.rank() == 0:
              
                var_metadata = var_obj.attributes       
                var_obj = cdms.createVariable(N.array(var_obj), 
                                   id = cdms_utils.var_utils.getBestName(var_metadata).replace(" ", "_"), 
                                   attributes=var_metadata)
                var_obj.value = float(var_obj._data)
                
            vars.append(var_obj)

        return vars

        Loops through variables to convert singleton variables (i.e. Masked Arrays/Numeric Arrays) 
        to proper CDMS variables. Then code won't break when asking for rank attribute later.
        Returns a list of CDMS variable objects
        
Loops through variables to convert singleton variables
to proper CDMS variables. Then code won't break when asking for rank attribute later.
Returns a list of CDMS variable objects
Loops through variables to convert singleton variables to proper CDMS variables . Then code won ' t break when asking for rank attribute later . Returns a list of CDMS variable objects
def _convertSingletonVars(self, variables):
        vars = []
        for variable in variables:
            var_obj = variable
            if not hasattr(var_obj, "rank") or var_obj.rank() == 0:
                var_metadata = var_obj.attributes       
                var_obj = cdms.createVariable(N.array(var_obj), 
                                   id = cdms_utils.var_utils.getBestName(var_metadata).replace(" ", "_"), 
                                   attributes=var_metadata)
                var_obj.value = float(var_obj._data)
            vars.append(var_obj)
        return vars
def _convertSingletonVars ( self , variables ) : vars = [ ] for variable in variables : var_obj = variable if not hasattr ( var_obj , "rank" ) or var_obj . rank ( ) == 0 : var_metadata = var_obj . attributes var_obj = cdms . createVariable ( N . array ( var_obj ) , id = cdms_utils . var_utils . getBestName ( var_metadata ) . replace ( " " , "_" ) , attributes = var_metadata ) var_obj . value = float ( var_obj . _data ) vars . append ( var_obj ) return vars
Loops through variables to convert singleton variables (i.e.
Loops through variables to convert singleton variables ( i . e .
"""
        Loops through variables to convert singleton variables (i.e. Masked Arrays/Numeric Arrays) 
        to proper CDMS variables. Then code won't break when asking for rank attribute later.
        Returns a list of CDMS variable objects
        """ # If singleton variable then convert into proper CDMS variables so code doesn't break later
self
variables