Created At: 2026-06-14T13:53:09Z
Completed At: 2026-06-14T13:53:09Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 4581
Total Bytes: 193572
Showing lines 50 to 80
The following code has been modified to include a line number before every line, in the format: <line_number>: <original_line>. Please note that any changes targeting the original code should remove the line number, colon, and leading space.
50:             }
51:         }
52:         fclose($handle);
53:     }
54:     return $data;
55: }
56: 
57: // Fungsi membuat 4 file CSV simulasi IPCC (historical, ensmean, ensmin, ensmax) jika belum tersedia
58: function ensure_sample_csv_exists_ipcc($location_sanitized, $variable_sanitized) {
59:     $dir = __DIR__ . "/data/{$location_sanitized}/{$variable_sanitized}";
60:     if (!is_dir($dir)) {
61:         mkdir($dir, 0777, true);
62:     }
63: 
64:     $base = 26.5; // default baseline (suhu)
65:     if (stripos($variable_sanitized, 'precip') !== false || stripos($variable_sanitized, 'hujan') !== false) {
66:         $base = 2300; // default baseline (curah hujan)
67:     } else if (stripos($variable_sanitized, 'kelembaban') !== false || stripos($variable_sanitized, 'humidity') !== false) {
68:         $base = 82.0;
69:     } else if (stripos($variable_sanitized, 'kecepatan') !== false || stripos($variable_sanitized, 'angin') !== false || stripos($variable_sanitized, 'wind') !== false) {
70:         $base = 2.4;
71:     } else if (stripos($variable_sanitized, 'radiasi') !== false || stripos($variable_sanitized, 'matahari') !== false || stripos($variable_sanitized, 'solar') !== false) {
72:         $base = 178.0;
73:     }
74: 
75:     // 1. historical_timeseries.csv (1991 - 2020)
76:     $hist_path = "{$dir}/historical_timeseries.csv";
77:     if (!file_exists($hist_path)) {
78:         $handle = fopen($hist_path, "w");
79:         if ($handle !== FALSE) {
80:             fputcsv($handle, ['year', 'ssp126', 'ssp245', 'ssp370', 'ssp585']);
The above content does NOT show the entire file contents. If you need to view any lines of the file which were not shown to complete your task, call this tool again to view those lines.
