nappy/nc_interface/na_to_cdms.py
def _convertNAAuxToCdmsVariable(self, avar_number, attributes={}):
        """
        Converts an auxiliary variable to a cdms variable.
        """
        (var_name, units, miss, scal) = self.na_file_obj.getAuxVariable(avar_number)
        array = N.array(self.na_file_obj.A[avar_number])
        array = array * scal

        msg="\nAdding auxiliary variable: %s" % self.na_file_obj.ANAME[avar_number]
        log.debug(msg)
        self.output_message.append(msg)

        # Set up axes
        if not hasattr(self, 'cdms_axes'):
            self._convertCdmsAxes()

        # Set up variable
        var = cdms.createVariable(array, axes=[self.cdms_axes[0]], fill_value=miss, 
                                  attributes=attributes)

        # Sort units etc
        if units:   var.units = units
        if len(var_name) < max_id_length:
            var.id = safe_nc_id.sub("_", var_name).lower()
        else:
            var.id = "naAuxVariable_%s" % (avar_number)

	    # Check if mapping provided for renaming this variable
        if var_name in self.rename_variables.keys():
            var_name = self.rename_variables[var_name]

        var.long_name = var.name = var.title = var_name

        # Add a NASA Ames auxiliary variable number (for mapping correctly back to NASA Ames)
        var.nasa_ames_aux_var_number = avar_number
        return var

        Converts an auxiliary variable to a cdms variable.
        
Converts an auxiliary variable to a cdms variable.
Converts an auxiliary variable to a cdms variable .
def _convertNAAuxToCdmsVariable(self, avar_number, attributes={}):
        (var_name, units, miss, scal) = self.na_file_obj.getAuxVariable(avar_number)
        array = N.array(self.na_file_obj.A[avar_number])
        array = array * scal
        msg="\nAdding auxiliary variable: %s" % self.na_file_obj.ANAME[avar_number]
        log.debug(msg)
        self.output_message.append(msg)
        if not hasattr(self, 'cdms_axes'):
            self._convertCdmsAxes()
        var = cdms.createVariable(array, axes=[self.cdms_axes[0]], fill_value=miss, 
                                  attributes=attributes)
        if units:   var.units = units
        if len(var_name) < max_id_length:
            var.id = safe_nc_id.sub("_", var_name).lower()
        else:
            var.id = "naAuxVariable_%s" % (avar_number)
        if var_name in self.rename_variables.keys():
            var_name = self.rename_variables[var_name]
        var.long_name = var.name = var.title = var_name
        var.nasa_ames_aux_var_number = avar_number
        return var
def _convertNAAuxToCdmsVariable ( self , avar_number , attributes = { } ) : ( var_name , units , miss , scal ) = self . na_file_obj . getAuxVariable ( avar_number ) array = N . array ( self . na_file_obj . A [ avar_number ] ) array = array * scal msg = "\nAdding auxiliary variable: %s" % self . na_file_obj . ANAME [ avar_number ] log . debug ( msg ) self . output_message . append ( msg ) if not hasattr ( self , 'cdms_axes' ) : self . _convertCdmsAxes ( ) var = cdms . createVariable ( array , axes = [ self . cdms_axes [ 0 ] ] , fill_value = miss , attributes = attributes ) if units : var . units = units if len ( var_name ) < max_id_length : var . id = safe_nc_id . sub ( "_" , var_name ) . lower ( ) else : var . id = "naAuxVariable_%s" % ( avar_number ) if var_name in self . rename_variables . keys ( ) : var_name = self . rename_variables [ var_name ] var . long_name = var . name = var . title = var_name var . nasa_ames_aux_var_number = avar_number return var
Converts an auxiliary variable to a cdms variable.
Converts an auxiliary variable to a cdms variable .
"""
        Converts an auxiliary variable to a cdms variable.
        """ # Set up axes # Set up variable # Sort units etc # Check if mapping provided for renaming this variable # Add a NASA Ames auxiliary variable number (for mapping correctly back to NASA Ames)
self
avar_number
attributes