← LAMPIRAN MENULAMPIRAN 11 / 18
S1D4NG.5KR1P51.404 · ANNEX FILE
Lampiran 11. Program python curah hujan harian bulan Maret Kabupaten Kudus tahun 2025
//⚠ S1D4NG.5KR1P51.404 — BIOHAZARD ZONE·//⚠ NO SHARP · NO NARCOTICS · NO WEIRD CARGO·//⚠ THE HUM IS LOUDER WHEN YOU NOTICE IT·//⚠ ERROR 404 RECOVERED — STILL WRONG·//⚠ LEVEL 0 · DO NOT TRUST THE CORRIDOR·
Lampiran 11. Program python curah hujan harian bulan Maret Kabupaten Kudus tahun 2025
| import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as mticker import matplotlib.dates as mdates import numpy as np # === STYLE (match tekanan_permukaan_kudus.py) === plt.rcParams['font.family'] = 'Arial' plt.rcParams['font.size'] = 11 plt.rcParams['axes.linewidth'] = 0.8 # Load IMERG CSV (header on line 8, data starts line 9) csv_path = '~\Skripsi\20162025g4.areaAvgTimeSeries.GPM_3IMERGHH_07_precipitation.20160101-20251231.110E_6S_110E_6S.csv' raw = pd.read_csv(csv_path, skiprows=9, header=None) raw.columns = ['time', 'precip'] raw['time'] = pd.to_datetime(raw['time'].str.strip()) raw['precip'] = pd.to_numeric(raw['precip'], errors='coerce') # Filter Maret 2025 only df = raw[(raw['time'] >= '2025-03-01') & (raw['time'] < '2025-04-01')].copy() df = df.reset_index(drop=True) # Convert to WIB df['time_wib'] = df['time'] + pd.Timedelta(hours=7) print(f"Data points: {len(df)}") print(f"Time range: {df['time_wib'].min()} to {df['time_wib'].max()}") print(f"CH range: {df['precip'].min():.3f} - {df['precip'].max():.3f} mm/jam") print(f"Total bulan: {df['precip'].sum():.1f} mm") # === PLOT === fig, ax = plt.subplots(figsize=(14, 5)) ax.plot(df['time_wib'], df['precip'], color='#1a1a2e', linewidth=0.7, zorder=3) ax.fill_between(df['time_wib'], df['precip'], alpha=0.08, color='#1a1a2e', zorder=2) # Event 24-25 Maret event_start = pd.Timestamp('2025-03-24 00:00:00') event_end = pd.Timestamp('2025-03-26 00:00:00') ax.axvspan(event_start, event_end, alpha=0.10, color='#d62828', zorder=1) ax.axvline(x=event_start, color='#d62828', linewidth=1.2, linestyle='--', alpha=0.7, zorder=4) ax.axvline(x=pd.Timestamp('2025-03-25 00:00:00'), color='#d62828', linewidth=1.2, linestyle='--', alpha=0.7, zorder=4) # Day boundaries for d in range(1, 32): bd = pd.Timestamp(f'2025-03-{d:02d} 00:00:00') ax.axvline(x=bd, color='#adb5bd', linewidth=0.6, linestyle=':', alpha=0.5, zorder=1) # Labels ax.set_ylabel('Curah Hujan (mm/jam)', fontsize=11, fontweight='bold') ax.set_xlabel('Waktu (WIB)', fontsize=11, fontweight='bold') # Y-axis ax.set_ylim(bottom=0) ax.yaxis.set_major_locator(mticker.MultipleLocator(10)) ax.yaxis.set_minor_locator(mticker.MultipleLocator(5)) ax.grid(True, axis='y', which='major', linestyle='--', linewidth=0.4, alpha=0.3) ax.grid(True, axis='y', which='minor', linestyle=':', linewidth=0.3, alpha=0.15) ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) # X-axis ax.set_xlim(df['time_wib'].min(), df['time_wib'].max()) ax.xaxis.set_major_locator(mdates.DayLocator(interval=3)) ax.xaxis.set_minor_locator(mdates.DayLocator()) ax.xaxis.set_major_formatter(mdates.DateFormatter('%d/%m')) plt.setp(ax.xaxis.get_majorticklabels(), fontsize=9) # Source fig.text(0.5, -0.04, 'Sumber: IMERG GPM (NASA/GPM) | Waktu dalam WIB (UTC+7)\n' 'Bbox: 110.75\u00b0E\u2013110.98\u00b0E, 6.98\u00b0S\u20136.59\u00b0S (Kabupaten Kudus)', ha='center', fontsize=7.5, color='#868e96', style='italic') plt.tight_layout(rect=[0, 0.06, 1, 1]) out = r'~\Skripsi\precipitation_analysis\curah_hujan_imerg_kudus_maret2025.png' plt.savefig(out, dpi=300, bbox_inches='tight', facecolor='white') plt.close() print(f'\nSaved: {out}') # Detail 24-25 m24 = df[(df['time_wib'] >= '2025-03-24') & (df['time_wib'] < '2025-03-26')] print(f'\n=== 24-25 Maret 2025 ===') print(f'Total 2 hari: {m24["precip"].sum():.1f} mm') print(f'Max 30-menit: {m24["precip"].max():.2f} mm/jam') |