Update Physical DB after azimuth validation
Browse files
physical_db/physical_database.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
utils/azimuth_validation.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
|
| 3 |
+
from utils.convert_to_excel import save_dataframe
|
| 4 |
+
|
| 5 |
+
url = r"./physical_db/physical_database.csv"
|
| 6 |
+
|
| 7 |
+
df = pd.read_csv(url)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def validate_azimuth(group):
|
| 11 |
+
"""
|
| 12 |
+
Validates the azimuth ordering within a group.
|
| 13 |
+
|
| 14 |
+
This function checks if the azimuth values are strictly increasing when there are exactly three values.
|
| 15 |
+
To make sure that Sector 3 is higher than Sector 2 and Sector 2 is higher than Sector 1
|
| 16 |
+
|
| 17 |
+
Args:
|
| 18 |
+
group (pd.DataFrame): A DataFrame group containing an 'Azimut' column.
|
| 19 |
+
|
| 20 |
+
Returns:
|
| 21 |
+
bool: True if the azimuth values are strictly increasing when there are exactly three values, False otherwise.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
azimuths = group.get("Azimut", []).values
|
| 25 |
+
if len(azimuths) == 3 and not (azimuths[0] < azimuths[1] < azimuths[2]):
|
| 26 |
+
return False
|
| 27 |
+
return True
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# Apply validation per 'code'
|
| 31 |
+
azimut_verification = df.groupby("CODE").apply(lambda x: validate_azimuth(x))
|
| 32 |
+
df["Azimut_verification"] = df["CODE"].map(azimut_verification)
|
| 33 |
+
|
| 34 |
+
save_dataframe(df, "azimut_verification")
|
| 35 |
+
# print(df)
|