nappy/nc_interface/na_to_cdms.py
def _convertCdmsVariables(self):
        """
        Creates cdms variable list for writing out.
        """
        self.cdms_variables = []

        if self.variables in (None, "all"):    
            for var_number in range(self.na_file_obj.NV):
                self.cdms_variables.append(self._convertNAToCdmsVariable(var_number))
        else:
            if type(self.variables[0]) == type(1) or re.match("\d+", str(self.variables[0])): # They are integers = indices
                for var_number in self.variables:
                    vn = int(var_number)
                    self.cdms_variables.append(self._convertNAToCdmsVariable(vn))   
            elif type(self.variables[0]) == type("string"):  # Vars are strings
                for var_name in self.variables:
                    if var_name in self.na_file_obj.VNAME:
                        var_number = self.na_file_obj.VNAME.index(var_name)
                        self.cdms_variables.append(self._convertNAToCdmsVariable(var_number))
                    else:
                        raise Exception("Variable name not known: " + var_name)

        Creates cdms variable list for writing out.
        
Creates cdms variable list for writing out.
Creates cdms variable list for writing out .
def _convertCdmsVariables(self):
        self.cdms_variables = []
        if self.variables in (None, "all"):    
            for var_number in range(self.na_file_obj.NV):
                self.cdms_variables.append(self._convertNAToCdmsVariable(var_number))
        else:
            if type(self.variables[0]) == type(1) or re.match("\d+", str(self.variables[0])): 
                for var_number in self.variables:
                    vn = int(var_number)
                    self.cdms_variables.append(self._convertNAToCdmsVariable(vn))   
            elif type(self.variables[0]) == type("string"):  
                for var_name in self.variables:
                    if var_name in self.na_file_obj.VNAME:
                        var_number = self.na_file_obj.VNAME.index(var_name)
                        self.cdms_variables.append(self._convertNAToCdmsVariable(var_number))
                    else:
                        raise Exception("Variable name not known: " + var_name)
def _convertCdmsVariables ( self ) : self . cdms_variables = [ ] if self . variables in ( None , "all" ) : for var_number in range ( self . na_file_obj . NV ) : self . cdms_variables . append ( self . _convertNAToCdmsVariable ( var_number ) ) else : if type ( self . variables [ 0 ] ) == type ( 1 ) or re . match ( "\d+" , str ( self . variables [ 0 ] ) ) : for var_number in self . variables : vn = int ( var_number ) self . cdms_variables . append ( self . _convertNAToCdmsVariable ( vn ) ) elif type ( self . variables [ 0 ] ) == type ( "string" ) : for var_name in self . variables : if var_name in self . na_file_obj . VNAME : var_number = self . na_file_obj . VNAME . index ( var_name ) self . cdms_variables . append ( self . _convertNAToCdmsVariable ( var_number ) ) else : raise Exception ( "Variable name not known: " + var_name )
Creates cdms variable list for writing out.
Creates cdms variable list for writing out .
"""
        Creates cdms variable list for writing out.
        """ # They are integers = indices # Vars are strings
self