def add_precip_file(self, precip_file_path, interpolation_type=None):
        """
        Adds a precip file to project with interpolation_type
        """
        # precip file read in
        self._update_card('PRECIP_FILE', precip_file_path, True)

        if interpolation_type is None:
            # check if precip type exists already in card
            if not self.project_manager.getCard('RAIN_INV_DISTANCE') \
                    and not self.project_manager.getCard('RAIN_THIESSEN'):
                # if no type exists, then make it theissen
                self._update_card('RAIN_THIESSEN', '')
        else:
            if interpolation_type.upper() not in self.PRECIP_INTERP_TYPES:
                raise IndexError("Invalid interpolation_type {0}".format(interpolation_type))
            interpolation_type = interpolation_type.upper()

            if interpolation_type == "INV_DISTANCE":
                self._update_card('RAIN_INV_DISTANCE', '')
                self.project_manager.deleteCard('RAIN_THIESSEN', self.db_session)
            else:
                self._update_card('RAIN_THIESSEN', '')
                self.project_manager.deleteCard('RAIN_INV_DISTANCE', self.db_session)
def add_precip_file ( self , precip_file_path , interpolation_type = None ) : self . _update_card ( 'PRECIP_FILE' , precip_file_path , True ) if interpolation_type is None : if not self . project_manager . getCard ( 'RAIN_INV_DISTANCE' ) and not self . project_manager . getCard ( 'RAIN_THIESSEN' ) : self . _update_card ( 'RAIN_THIESSEN' , '' ) else : if interpolation_type . upper ( ) not in self . PRECIP_INTERP_TYPES : raise IndexError ( "Invalid interpolation_type {0}" . format ( interpolation_type ) ) interpolation_type = interpolation_type . upper ( ) if interpolation_type == "INV_DISTANCE" : self . _update_card ( 'RAIN_INV_DISTANCE' , '' ) self . project_manager . deleteCard ( 'RAIN_THIESSEN' , self . db_session ) else : self . _update_card ( 'RAIN_THIESSEN' , '' ) self . project_manager . deleteCard ( 'RAIN_INV_DISTANCE' , self . db_session )
Adds a precip file to project with interpolation_type