nappy/nc_interface/cdms_to_na.py
def convert(self):
        """
        Reads the CDMS objects and convert to a set of dictionaries that
        provide the structure for a NA File object.
        Returns [(na_dict, var_ids), (na_dict, var_ids), ....]
        All these na_dict dictionaries can be readily written to a NA File object.

        Note that NASA Ames is not as flexible as NetCDF so you cannot just send any 
        set of variables to write to a NASA Ames file. Essentially there is one
        multi-dimensional structure and all variables must be defined against it.

        Otherwise variables must be auxiliary variables within that structure (i.e. only
        defined once per the least changing dimension.
        """
        if self.converted:
            return self.na_dict_list
        
        # Convert any singleton variables to CDMS variables
        variables = self._convertSingletonVars(self.cdms_variables)

        # Re-order variables if they have the attribute "nasa_ames_var_number" which means they came from a NASA Ames file originally
        variables = self._reorderVars(variables)

        # Make first call to collector class that creates NA dict from CDMS variables and global atts list 
        collector = nappy.nc_interface.na_content_collector.NAContentCollector(variables, 
                                        self.global_attributes, requested_ffi=self.requested_ffi,
                                        )
        collector.collectNAContent()

        # Return if no files returned
        if not collector.found_na:
            msg = "\nNo files created after variables parsed."
            if DEBUG: log.debug(msg)
            self.output_message.append(msg)
            return

        # NOTE: collector has attributes: na_dict, var_ids, unused_vars

        # Set up a list to collect multiple calls to content collector
        na_dict_list = []
        na_dict_list.append((collector.na_dict, collector.var_ids))

        # If there are variables that were not captured (i.e. unused) by NAContentCollector then loop through these
        # in attempt to convert all to a set of na_dicts
        log.debug("\nUnused_vars: %s" % collector.unused_vars)
        while len(collector.unused_vars) > 0:
            collector = nappy.nc_interface.na_content_collector.NAContentCollector(collector.unused_vars, 
                                        self.global_attributes, requested_ffi=self.requested_ffi,
                                        )
            collector.collectNAContent()           
            self.output_message += collector.output_message

            # Append to list if more variables were captured
            if collector.found_na:
                na_dict_list.append((collector.na_dict, collector.var_ids))

        self.na_dict_list = na_dict_list
        self.converted = True

        return self.na_dict_list

        Reads the CDMS objects and convert to a set of dictionaries that
        provide the structure for a NA File object.
        Returns [(na_dict, var_ids), (na_dict, var_ids), ....]
        All these na_dict dictionaries can be readily written to a NA File object.

        Note that NASA Ames is not as flexible as NetCDF so you cannot just send any 
        set of variables to write to a NASA Ames file. Essentially there is one
        multi-dimensional structure and all variables must be defined against it.

        Otherwise variables must be auxiliary variables within that structure (i.e. only
        defined once per the least changing dimension.
        
Reads the CDMS objects and convert to a set of dictionaries that
provide the structure for a NA File object.
Returns [(na_dict, var_ids), (na_dict, var_ids), ....]
All these na_dict dictionaries can be readily written to a NA File object.

Note that NASA Ames is not as flexible as NetCDF so you cannot just send any
set of variables to write to a NASA Ames file. Essentially there is one
multi-dimensional structure and all variables must be defined against it.

Otherwise variables must be auxiliary variables within that structure (i.e. only
defined once per the least changing dimension.
Reads the CDMS objects and convert to a set of dictionaries that provide the structure for a NA File object . Returns [ ( na_dict var_ids ) ( na_dict var_ids ) .... ] All these na_dict dictionaries can be readily written to a NA File object . Note that NASA Ames is not as flexible as NetCDF so you cannot just send any set of variables to write to a NASA Ames file . Essentially there is one multi - dimensional structure and all variables must be defined against it . Otherwise variables must be auxiliary variables within that structure ( i . e . only defined once per the least changing dimension .
def convert(self):
        if self.converted:
            return self.na_dict_list
        variables = self._convertSingletonVars(self.cdms_variables)
        variables = self._reorderVars(variables)
        collector = nappy.nc_interface.na_content_collector.NAContentCollector(variables, 
                                        self.global_attributes, requested_ffi=self.requested_ffi,
                                        )
        collector.collectNAContent()
        if not collector.found_na:
            msg = "\nNo files created after variables parsed."
            if DEBUG: log.debug(msg)
            self.output_message.append(msg)
            return
        na_dict_list = []
        na_dict_list.append((collector.na_dict, collector.var_ids))
        log.debug("\nUnused_vars: %s" % collector.unused_vars)
        while len(collector.unused_vars) > 0:
            collector = nappy.nc_interface.na_content_collector.NAContentCollector(collector.unused_vars, 
                                        self.global_attributes, requested_ffi=self.requested_ffi,
                                        )
            collector.collectNAContent()           
            self.output_message += collector.output_message
            if collector.found_na:
                na_dict_list.append((collector.na_dict, collector.var_ids))
        self.na_dict_list = na_dict_list
        self.converted = True
        return self.na_dict_list
def convert ( self ) : if self . converted : return self . na_dict_list variables = self . _convertSingletonVars ( self . cdms_variables ) variables = self . _reorderVars ( variables ) collector = nappy . nc_interface . na_content_collector . NAContentCollector ( variables , self . global_attributes , requested_ffi = self . requested_ffi , ) collector . collectNAContent ( ) if not collector . found_na : msg = "\nNo files created after variables parsed." if DEBUG : log . debug ( msg ) self . output_message . append ( msg ) return na_dict_list = [ ] na_dict_list . append ( ( collector . na_dict , collector . var_ids ) ) log . debug ( "\nUnused_vars: %s" % collector . unused_vars ) while len ( collector . unused_vars ) > 0 : collector = nappy . nc_interface . na_content_collector . NAContentCollector ( collector . unused_vars , self . global_attributes , requested_ffi = self . requested_ffi , ) collector . collectNAContent ( ) self . output_message += collector . output_message if collector . found_na : na_dict_list . append ( ( collector . na_dict , collector . var_ids ) ) self . na_dict_list = na_dict_list self . converted = True return self . na_dict_list
Reads the CDMS objects and convert to a set of dictionaries that
provide the structure for a NA File object.
Reads the CDMS objects and convert to a set of dictionaries that provide the structure for a NA File object .
"""
        Reads the CDMS objects and convert to a set of dictionaries that
        provide the structure for a NA File object.
        Returns [(na_dict, var_ids), (na_dict, var_ids), ....]
        All these na_dict dictionaries can be readily written to a NA File object.

        Note that NASA Ames is not as flexible as NetCDF so you cannot just send any 
        set of variables to write to a NASA Ames file. Essentially there is one
        multi-dimensional structure and all variables must be defined against it.

        Otherwise variables must be auxiliary variables within that structure (i.e. only
        defined once per the least changing dimension.
        """ # Convert any singleton variables to CDMS variables # Re-order variables if they have the attribute "nasa_ames_var_number" which means they came from a NASA Ames file originally # Make first call to collector class that creates NA dict from CDMS variables and global atts list  # Return if no files returned # NOTE: collector has attributes: na_dict, var_ids, unused_vars # Set up a list to collect multiple calls to content collector # If there are variables that were not captured (i.e. unused) by NAContentCollector then loop through these # in attempt to convert all to a set of na_dicts # Append to list if more variables were captured
self