← LAMPIRAN MENULAMPIRAN 10 / 18
S1D4NG.5KR1P51.404 · ANNEX FILE
Lampiran 10. Program python curah hujan bulanan Kabupaten tahun Kudus 2016–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 10. Program python curah hujan bulanan Kabupaten tahun Kudus 2016–2025
| import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as mticker import numpy as np plt.rcParams['font.family'] = 'Arial' plt.rcParams['font.size'] = 11 plt.rcParams['axes.linewidth'] = 0.8 df = pd.read_csv( r'~\20162025g4.areaAvgTimeSeries.GPM_3IMERGHH_07_precipitation.20160101-20251231.110E_6S_110E_6S.csv', skiprows=9, names=['time', 'precipitation'], parse_dates=['time'] ) df = df[df['precipitation'] != -9999.9] df['time_wib'] = df['time'] + pd.Timedelta(hours=7) df['year'] = df['time_wib'].dt.year df['month'] = df['time_wib'].dt.month df['precip_30min'] = df['precipitation'] * 0.5 monthly = df.groupby(['year', 'month'])['precip_30min'].sum().reset_index() monthly.columns = ['year', 'month', 'total_mm'] clim = monthly.groupby('month')['total_mm'].mean().reset_index() clim.columns = ['month', 'mean'] mo_names = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'] fig, ax = plt.subplots(figsize=(12, 5.5)) x = clim['month'].values y = clim['mean'].values ax.plot(x, y, color='#1a1a2e', linewidth=1.8, marker='o', markersize=5, zorder=3) ax.set_xticks(range(1, 13)) ax.set_xticklabels(mo_names, fontsize=10) ax.set_xlim(0.5, 12.5) ax.set_ylabel('Curah Hujan (mm/bulan)', fontsize=11, fontweight='bold') ax.set_xlabel('Bulan', fontsize=11, fontweight='bold') ax.yaxis.set_major_locator(mticker.MultipleLocator(100)) ax.yaxis.set_minor_locator(mticker.MultipleLocator(50)) ax.set_ylim(bottom=0) 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) fig.text(0.5, -0.02, 'Sumber: NASA GPM IMERG Final Run v07 (GPM_3IMERGHH) | Rata-rata 2016\u20132025', ha='center', fontsize=8, color='#868e96', style='italic') plt.tight_layout(rect=[0, 0.04, 1, 1]) out = r'~\Skripsi\precipitation_analysis\pola_ch_bulanan_imerg_2016_2025_clean.png' plt.savefig(out, dpi=300, bbox_inches='tight', facecolor='white') plt.close() print(f'Saved: {out}') |