Skip to content

Commit ca50801

Browse files
committed
Docstring formatting
1 parent 7b9e81b commit ca50801

File tree

5 files changed

+25
-19
lines changed

5 files changed

+25
-19
lines changed

src/bedrock_ge/gi/ags/read.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def ags_to_dfs(ags_data: str) -> Dict[str, pd.DataFrame]:
1818
1919
Returns:
2020
Dict[str, pd.DataFrame]]: A dictionary where keys represent AGS group
21-
names with corresponding DataFrames for the corresponding group data.
21+
names with corresponding DataFrames for the corresponding group data.
2222
"""
2323
# Process each line to find the AGS version and delegate parsing
2424
for line in ags_data.splitlines():
@@ -57,8 +57,9 @@ def ags3_to_dfs(ags3_data: str) -> Dict[str, pd.DataFrame]:
5757
ags3_data (str): The AGS 3 data as a string.
5858
5959
Returns:
60-
Dict[str, pd.DataFrame]: A dictionary of pandas DataFrames, where each key represents a group name from AGS 3 data,
61-
and the corresponding value is a pandas DataFrame containing the data for that group.
60+
Dict[str, pd.DataFrame]: A dictionary of pandas DataFrames, where each key
61+
represents a group name from AGS 3 data, and the corresponding value is a
62+
pandas DataFrame containing the data for that group.
6263
"""
6364
# Initialize dictionary and variables used in the AGS 3 read loop
6465
ags3_dfs = {}
@@ -156,8 +157,9 @@ def ags4_to_dfs(ags4_data: str) -> Dict[str, pd.DataFrame]:
156157
ags4_data (str): The AGS 4 data as a string.
157158
158159
Returns:
159-
Dict[str, pd.DataFrame]: A dictionary of pandas DataFrames, where each key represents a group name from AGS 4 data,
160-
and the corresponding value is a pandas DataFrame containing the data for that group.
160+
Dict[str, pd.DataFrame]: A dictionary of pandas DataFrames, where each key
161+
represents a group name from AGS 4 data, and the corresponding value is a
162+
pandas DataFrame containing the data for that group.
161163
"""
162164
# AGS4.AGS4_to_dataframe accepts the file, not the data string
163165
ags4_file = io.StringIO(ags4_data)

src/bedrock_ge/gi/ags/transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def ags3_db_to_no_gis_brgi_db(
4343
4444
Returns:
4545
Dict[str, pd.DataFrame]: A dictionary containing Bedrock GI database tables,
46-
where keys are table names and values are transformed pandas DataFrames.
46+
where keys are table names and values are transformed pandas DataFrames.
4747
4848
Note:
4949
The function creates a copy of the input database to avoid modifying the original data.

src/bedrock_ge/gi/gis_geometry.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ def calculate_gis_geometry(
2828
2929
Returns:
3030
Dict[str, gpd.GeoDataFrame]: Dictionary containing the Bedrock GI database tables
31-
with added GIS geometry. All tables are converted to GeoDataFrames with
32-
appropriate CRS and geometry columns.
31+
with added GIS geometry. All tables are converted to GeoDataFrames with
32+
appropriate CRS and geometry columns.
3333
3434
Raises:
3535
ValueError: If the projects in the database use different Coordinate Reference Systems (CRS).
3636
3737
Note:
3838
The function performs the following operations:
39+
3940
1. Verifies all projects use the same CRS
4041
2. Calculates GIS geometry for the 'Location' table
4142
3. Creates a 'LonLatHeight' table for 2D visualization
@@ -231,9 +232,9 @@ def calculate_in_situ_gis_geometry(
231232
232233
Returns:
233234
gpd.GeoDataFrame: The GIS geometry for the given in-situ data, with additional columns:
234-
- elevation_at_top: The elevation at the top of the in-situ data.
235-
- elevation_at_base: The elevation at the base of the in-situ data.
236-
- geometry: The GIS geometry of the in-situ data.
235+
- elevation_at_top: The elevation at the top of the in-situ data.
236+
- elevation_at_base: The elevation at the base of the in-situ data.
237+
- geometry: The GIS geometry of the in-situ data.
237238
"""
238239
location_child = brgi_in_situ.copy()
239240

src/bedrock_ge/gi/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def check_brgi_database(brgi_db: Dict[str, Union[pd.DataFrame, gpd.GeoDataFrame]
3333
values are the corresponding data tables (DataFrame or GeoDataFrame).
3434
3535
Returns:
36-
bool: True if all tables are valid and relationships are properly maintained.
36+
is_valid (bool): True if all tables are valid and relationships are properly maintained.
3737
3838
Example:
3939
```python
@@ -97,7 +97,7 @@ def check_no_gis_brgi_database(
9797
and values are the corresponding data tables (DataFrame or GeoDataFrame).
9898
9999
Returns:
100-
bool: True if all tables are valid and relationships are properly maintained.
100+
is_valid (bool): True if all tables are valid and relationships are properly maintained.
101101
102102
Example:
103103
```python

src/bedrock_ge/gi/write.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def write_gi_db_to_gpkg(
1616
separate table named by the keys of the dictionary.
1717
1818
Args:
19-
brgi_db (dict): A dictionary where keys are brgi table names and values are DataFrames
19+
brgi_db (Dict[str, Union[pd.DataFrame, gpd.GeoDataFrame]]): A dictionary where
20+
keys are brgi table names and values are pandas DataFrames or GeoDataFrames
2021
with brgi data.
2122
gpkg_path (str): The name of the output GeoPackage file.
2223
@@ -39,7 +40,7 @@ def write_gi_db_to_gpkg(
3940

4041

4142
def write_gi_db_to_excel(
42-
gi_db: Dict[str, Union[pd.DataFrame, gpd.GeoDataFrame]],
43+
gi_dfs: Dict[str, Union[pd.DataFrame, gpd.GeoDataFrame]],
4344
excel_path: Union[str, Path],
4445
) -> None:
4546
"""Writes a database with Ground Investigation data to an Excel file.
@@ -49,15 +50,17 @@ def write_gi_db_to_excel(
4950
AGS, Bedrock, or another format.
5051
5152
Args:
52-
gi_dfs (dict): A dictionary where keys are GI table names and values are DataFrames with GI data.
53-
excel_path (str): The name of the output Excel file.
53+
gi_dfs (Dict[str, Union[pd.DataFrame, gpd.GeoDataFrame]]): A dictionary where
54+
keys are GI table names and values are DataFrames with GI data.
55+
excel_path (Union[str, Path]): Path to the output Excel file. Can be provided as a
56+
string or Path object.
5457
5558
Returns:
5659
None
5760
"""
5861
# Create an Excel writer object
5962
with pd.ExcelWriter(excel_path, engine="openpyxl") as writer:
60-
for sheet_name, df in gi_db.items():
63+
for sheet_name, df in gi_dfs.items():
6164
sanitized_sheet_name = sanitize_table_name(sheet_name)
6265
if isinstance(df, pd.DataFrame) or isinstance(df, gpd.GeoDataFrame):
6366
df.to_excel(writer, sheet_name=sanitized_sheet_name, index=False)
@@ -76,7 +79,7 @@ def sanitize_table_name(sheet_name):
7679
sheet_name (str): The original sheet name.
7780
7881
Returns:
79-
sanitized_name: A sanitized sheet name with invalid characters and spaces replaced.
82+
sanitized_name (str): A sanitized sheet name with invalid characters and spaces replaced.
8083
"""
8184
# Trim to a maximum length of 31 characters
8285
trimmed_name = sheet_name.strip()[:31]

0 commit comments

Comments
 (0)