def set_geometric_data(geo_model: Model, surface_points_df=None, orientations_df=None, **kwargs): """ Function to set directly pandas.Dataframes to the gempy geometric data objects Args: geo_model: [s0] surface_points_df: A pn.Dataframe object with X, Y, Z, and surface columns orientations_df: A pn.Dataframe object with X, Y, Z, surface columns and pole or orientation columns **kwargs: Returns: Modified df """ r_ = None if surface_points_df is not None: geo_model.set_surface_points(surface_points_df, **kwargs) r_ = 'surface_points' elif orientations_df is not None: geo_model.set_orientations(orientations_df, **kwargs) r_ = 'data' if r_ == 'surface_points' else 'orientations' else: raise AttributeError('You need to pass at least one dataframe') return get_data(geo_model, itype=r_)
def init_data(geo_model: Model, extent: Union[list, ndarray] = None, resolution: Union[list, ndarray] = None, **kwargs) -> Model: """ Create a :class:`gempy.core.model.Model` object and initialize some of the main functions such as: - Grid :class:`gempy.core.data.GridClass`: To regular grid. - read_csv: SurfacePoints and orientations: From csv files - set_values to default Args: geo_model (:class:Model): [s0] extent (list or array): [x_min, x_max, y_min, y_max, z_min, z_max]. Extent for the visualization of data and default of for the grid class. resolution (list or array): [nx, ny, nz]. Resolution for the visualization of data and default of for the grid class. project_name (str) Keyword Args: path_i: Path to the data bases of surface_points. Default os.getcwd(), path_o: Path to the data bases of orientations. Default os.getcwd() surface_points_df: A df object directly orientations_df: Returns: :class:`gempy.data_management.InputData` """ if extent is None or resolution is None: warnings.warn( 'Regular grid won\'t be initialize, you will have to create a gridafterwards. See gempy.set_grid' ) else: geo_model.set_regular_grid(extent, resolution) if 'path_i' in kwargs or 'path_o' in kwargs: read_csv(geo_model, **kwargs) if 'surface_points_df' in kwargs: geo_model.set_surface_points(kwargs['surface_points_df'], **kwargs) # if we set the surfaces names with surfaces they cannot be set again on orientations or pandas will complain. kwargs['update_surfaces'] = False if 'orientations_df' in kwargs: geo_model.set_orientations(kwargs['orientations_df'], **kwargs) return geo_model