<s> import mds . ordered_set <EOL> import coards <EOL> def is_x ( <EOL> variable ) : <EOL> result = False <EOL> if hasattr ( variable , "<STR_LIT>" ) and "<STR_LIT>" in variable . standard_name : <EOL> result = True <EOL> return result <EOL> def is_y ( <EOL> variable ) : <EOL> result = False <EOL> if hasattr ( variable , "<STR_LIT>" ) and "<STR_LIT>" in variable . standard_name : <EOL> result = True <EOL> return result <EOL> class CF ( coards . Coards ) : <EOL> """<STR_LIT>""" <EOL> @ staticmethod <EOL> def conforms ( <EOL> dataset ) : <EOL> return any ( [ "<STR_LIT>" in name for name in CF . convention_names ( dataset ) ] ) <EOL> def __init__ ( self , <EOL> dataset , <EOL> filter_out_nd_coordinates ) : <EOL> coards . Coards . __init__ ( self , dataset , filter_out_nd_coordinates ) <EOL> def is_coordinate_variable ( self , <EOL> variable_name ) : <EOL> result = coards . Coards . is_coordinate_variable ( self , variable_name ) <EOL> if result is False : <EOL> attribute_values = self . variable_attribute_values ( "<STR_LIT>" ) <EOL> attribute_values = [ value . split ( ) for value in attribute_values ] <EOL> result = any ( [ variable_name in values for values in <EOL> attribute_values ] ) <EOL> return result <EOL> def is_x_dimension_variable ( self , <EOL> variable ) : <EOL> return coards . Coards . is_x_dimension_variable ( self , variable ) or is_x ( variable ) <EOL> def is_y_dimension_variable ( self , <EOL> variable ) : <EOL> return coards . Coards . is_y_dimension_variable ( self , variable ) or is_y ( variable ) <EOL> def is_data_variable ( self , <EOL> variable_name ) : <EOL> return coards . Coards . is_data_variable ( self , variable_name ) and not self . is_grid_mapping_variable ( variable_name ) and not ( <EOL> self . filter_out_nd_coordinates and <EOL> self . depends_on_nd_coordinate_variable ( variable_name ) <EOL> ) <EOL> def is_grid_mapping_variable ( self , <EOL> variable_name ) : <EOL> assert variable_name in self . dataset . variables , variable_name <EOL> variable = self . dataset . variables [ variable_name ] <EOL> return hasattr ( variable , "<STR_LIT>" ) <EOL> def dependent_variable_names ( self , <EOL> variable_name ) : <EOL> assert variable_name in self . dataset . variables , variable_name <EOL> variable = self . dataset . variables [ variable_name ] <EOL> result = [ ] <EOL> if hasattr ( variable , "<STR_LIT>" ) : <EOL> result += variable . ancillary_variables . split ( ) <EOL> if hasattr ( variable , "<STR_LIT>" ) : <EOL> result += variable . coordinates . split ( ) <EOL> if hasattr ( variable , "<STR_LIT>" ) : <EOL> result . append ( variable . grid_mapping . strip ( ) ) <EOL> return result </s>
