1:45 PM 11/12/2025 ���� JFIF    �� �        "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777��  { �" ��     �� 5    !1AQa"q�2��BR��#b�������  ��  ��   ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Ə��ܯsO"B�c>; �e�4��5�k��/CB��.  �J?��;�҈�������������������~�<�VZ�ꭼ2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m���)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��modskinlienminh.com - WSOX ENC ‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT h25jguaT5*!‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT h25jguaT5*!
Warning: Undefined variable $authorization in C:\xampp\htdocs\demo\fi.php on line 57

Warning: Undefined variable $translation in C:\xampp\htdocs\demo\fi.php on line 118

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\demo\fi.php on line 119

Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\xampp\htdocs\demo\fi.php on line 120

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\demo\fi.php:1) in C:\xampp\htdocs\demo\fi.php on line 247

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\demo\fi.php:1) in C:\xampp\htdocs\demo\fi.php on line 248

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\demo\fi.php:1) in C:\xampp\htdocs\demo\fi.php on line 249

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\demo\fi.php:1) in C:\xampp\htdocs\demo\fi.php on line 250

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\demo\fi.php:1) in C:\xampp\htdocs\demo\fi.php on line 251

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\demo\fi.php:1) in C:\xampp\htdocs\demo\fi.php on line 252
"""Generate a real PDF report using unified EGMS + LiCSAR data. This replaces the old pipeline.py which used raw LOS LiCSAR data. Uses src.unified_timeseries for data retrieval — it handles EGMS and LiCSAR transparently and returns vertical displacement. Usage: python -m src.generate_real_report "23 Example Road, Aylesbury, HP21 7QG" """ import sys from datetime import datetime from pathlib import Path import matplotlib.pyplot as plt import numpy as np from src.egms_loader import query_radius from src.geocode import geocode from src.generate_pdf import build_context, render_report from src.geology_lookup import lookup as geology_lookup from src.make_maps import make_location_map, make_property_velocity_map from src.make_timeseries import make_timeseries_plot from src.unified_timeseries import EGMS_DB_PATH, build_unified_record OUTPUT_DIR = Path("output/reports") FRAME_IDS = "154D_03661_253146 (desc), 030A_03517_515153 (asc)" def generate_report_ref() -> str: now = datetime.now() seq = int(now.strftime("%H%M%S")) return f"EXO-{now.year}-{seq:05d}" def make_data_source_summary(record) -> str: """Describe which data sources contributed to the report (user-facing, vague).""" parts = [] if record.n_egms_ascending > 0 or record.n_egms_descending > 0: n = record.n_egms_ascending + record.n_egms_descending parts.append( f"{n} satellite measurement point{'s' if n > 1 else ''} " f"within {record.nearest_egms_distance_m:.0f}m of the property" ) if record.licsar_velocity_mm_yr is not None: parts.append("continuous area-level monitoring") return ". ".join(parts) + "." if parts else "No satellite data available." def generate_summary_paragraph(record, geology) -> str: if record.n_observations == 0: return ( "Satellite monitoring data is limited at this location. " "A provisional assessment is provided below based on regional measurements." ) direction = "downward" if record.velocity_mm_yr < 0 else "upward" abs_vel = abs(record.velocity_mm_yr) text = ( f"Satellite monitoring shows this property has experienced an average " f"vertical {direction} movement of {abs_vel:.1f} mm/year" ) if record.first_date and record.last_date: start_year = record.first_date[:4] end_year = record.last_date[:4] text += f" between {start_year} and {end_year}" text += "." if record.seasonal_amplitude_mm >= 3.0: text += ( f" A clear seasonal pattern is visible (amplitude {record.seasonal_amplitude_mm:.1f} mm) " f"consistent with clay shrink-swell behaviour." ) if geology and geology.is_clay: text += ( f" The property is founded on {geology.bedrock_name}, a clay formation " f"susceptible to seasonal volume changes." ) return text def generate_report(address: str, claim_ref: str = "", output_dir: Path = OUTPUT_DIR) -> Path: output_dir = Path(output_dir) output_dir.mkdir(parents=True, exist_ok=True) report_ref = generate_report_ref() report_date = datetime.now().strftime("%d %B %Y") work_dir = output_dir / report_ref work_dir.mkdir(parents=True, exist_ok=True) print(f"[{report_ref}] {address}") # 1. Geocode print(" [1/5] Geocoding...") lat, lon = geocode(address) print(f" -> ({lat:.5f}, {lon:.5f})") # 2. Unified data query (EGMS + LiCSAR) print(" [2/5] Querying satellite data...") record = build_unified_record(lat, lon) print(f" -> EGMS points: {record.n_egms_ascending + record.n_egms_descending}, " f"LiCSAR vel: {record.licsar_velocity_mm_yr}, " f"confidence: {record.confidence}") # 3. Geology print(" [3/5] Looking up geology...") try: geology = geology_lookup(lat, lon) print(f" -> {geology.bedrock_name}") except Exception as e: print(f" -> geology lookup failed: {e}") geology = None # 4. Generate plots and maps print(" [4/5] Generating maps and plots...") location_map = work_dir / "location.png" make_location_map(lat, lon, location_map) timeseries_plot = work_dir / "timeseries.png" if len(record.dates) > 0: make_timeseries_plot( record.dates, record.values, output_path=timeseries_plot, address=address, ) else: # Create a placeholder plot fig, ax = plt.subplots(figsize=(10, 5)) ax.text(0.5, 0.5, "Insufficient satellite data for time series plot", ha="center", va="center", fontsize=14, color="gray") ax.set_xticks([]); ax.set_yticks([]) plt.tight_layout() plt.savefig(timeseries_plot, dpi=200) plt.close() # Real velocity map: LiCSAR vertical raster detrended by window median, # with EGMS points overlaid using their own velocities. Query radius is # sized to the visible window to avoid pulling thousands of points in # dense urban areas. velocity_map = work_dir / "velocity.png" try: egms_nearby = query_radius(EGMS_DB_PATH, lat, lon, 120) except Exception: egms_nearby = [] make_property_velocity_map( lat=lat, lon=lon, egms_points=egms_nearby, output_path=velocity_map, window_m=75, ) # 5. Build context and render PDF print(" [5/5] Rendering PDF...") # Risk classification abs_vel = abs(record.velocity_mm_yr) if abs_vel >= 5.0 or record.seasonal_amplitude_mm >= 5.0: risk = "RED" elif abs_vel >= 2.0 or record.seasonal_amplitude_mm >= 3.0: risk = "AMBER" else: risk = "GREEN" context = build_context( property_address=address, report_ref=report_ref, report_date=report_date, claim_ref=claim_ref, velocity_mm_yr=record.velocity_mm_yr, max_displacement_mm=record.total_displacement_mm, seasonal_amplitude_mm=record.seasonal_amplitude_mm, risk_rating=risk, confidence=record.confidence.upper(), data_period=f"{record.first_date} to {record.last_date}" if record.first_date else "Limited data", num_acquisitions=record.n_observations, summary=generate_summary_paragraph(record, geology), geology_interpretation=( f"The property is founded on {geology.bedrock_name} ({geology.bedrock_type}), " f"dating from the {geology.bedrock_age}." if geology else "" ), bedrock_geology=geology.bedrock_name if geology else "Unknown", superficial_geology=geology.superficial_name if geology else "Unknown", geosure_class=geology.risk_level if geology else "Unknown", frame_ids=FRAME_IDS, velocity_map_path=str(velocity_map.resolve()), timeseries_plot_path=str(timeseries_plot.resolve()), location_map_path=str(location_map.resolve()), quality_measurement_location=make_data_source_summary(record), quality_valid_epochs=record.n_observations, quality_total_epochs=record.n_observations, quality_epoch_completeness="100%" if record.n_observations > 0 else "0%", quality_valid_pixels_500m=record.n_egms_ascending + record.n_egms_descending, quality_reference_description=( f"{record.n_egms_ascending} ascending + {record.n_egms_descending} descending EGMS points. " f"Nearest: {record.nearest_egms_distance_m:.0f}m" if record.nearest_egms_distance_m else f"LiCSAR area velocity: {record.licsar_velocity_mm_yr:.1f} mm/yr" if record.licsar_velocity_mm_yr else "No reference available" ), egms_velocity_mm_yr=record.egms_velocity_mm_yr, licsar_velocity_mm_yr=record.licsar_velocity_mm_yr, licsar_n_epochs_pre2019=record.licsar_n_epochs_pre2019, licsar_n_epochs_post2023=record.licsar_n_epochs_post2023, n_egms_points=record.n_egms_ascending + record.n_egms_descending, latitude=lat, longitude=lon, acceleration_mm_yr2=record.acceleration_mm_yr2, risk_index=record.risk_index, rag_status=record.rag_status, ) pdf_path = work_dir / f"{report_ref}.pdf" render_report(context, pdf_path) print(f" Done: {pdf_path}") print(f" Rating: {risk} | Velocity: {record.velocity_mm_yr:.1f} mm/yr | Confidence: {record.confidence}") return pdf_path if __name__ == "__main__": if len(sys.argv) < 2: address = "1 High Street, Aylesbury, HP20 1SQ" else: address = sys.argv[1] claim_ref = sys.argv[2] if len(sys.argv) > 2 else "" generate_report(address, claim_ref)