Created At: 2026-06-14T13:52:28Z
Completed At: 2026-06-14T13:52:28Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 4581
Total Bytes: 193572
Showing lines 3220 to 3300
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.
3220:         if (customParams.graphSSP5Slope !== undefined && customParams.graphSSP5Slope !== null && customParams.graphSSP5Slope !== '') {
3221:           ssp5_slope = parseFloat(customParams.graphSSP5Slope);
3222:         }
3223:       }
3224: 
3225:       // Consistent seeded random for reproducibility
3226:       function seededRandom(seed) {
3227:         const x = Math.sin(seed++) * 10000;
3228:         return x - Math.floor(x);
3229:       }
3230: 
3231:       const dataHist = [];
3232:       const dataSSP1 = [];
3233:       const dataSSP1_min = [];
3234:       const dataSSP1_max = [];
3235:       
3236:       const dataSSP2 = [];
3237:       const dataSSP2_min = [];
3238:       const dataSSP2_max = [];
3239:       
3240:       const dataSSP3 = [];
3241:       const dataSSP3_min = [];
3242:       const dataSSP3_max = [];
3243: 
3244:       const dataSSP5 = [];
3245:       const dataSSP5_min = [];
3246:       const dataSSP5_max = [];
3247: 
3248:       let csvRows = null;
3249:       if (customParams && customParams.csvData) {
3250:         try {
3251:           csvRows = JSON.parse(customParams.csvData);
3252:         } catch (e) {
3253:           console.error("Failed to parse csvData JSON:", e);
3254:         }
3255:       }
3256: 
3257:       if (csvRows && csvRows.length > 0) {
3258:         csvRows.sort((a, b) => a.year - b.year);
3259:         
3260:         years.length = 0;
3261:         csvRows.forEach(row => {
3262:           if (row.year >= startYearVal && row.year <= endYearVal) {
3263:             years.push(row.year);
3264:           }
3265: 
<truncated 76 bytes>
rEach(row => {
3269:           rowMap[row.year] = row;
3270:         });
3271: 
3272:         years.forEach((y, idx) => {
3273:           const row = rowMap[y] || {};
3274:           const histVal = row.historical !== undefined && row.historical !== null && row.historical !== '' ? parseFloat(row.historical) : null;
3275:           
3276:           let ssp1Val = row.ssp1 !== undefined && row.ssp1 !== null && row.ssp1 !== '' ? parseFloat(row.ssp1) : null;
3277:           let ssp2Val = row.ssp2 !== undefined && row.ssp2 !== null && row.ssp2 !== '' ? parseFloat(row.ssp2) : null;
3278:           let ssp3Val = row.ssp3 !== undefined && row.ssp3 !== null && row.ssp3 !== '' ? parseFloat(row.ssp3) : null;
3279:           let ssp5Val = row.ssp5 !== undefined && row.ssp5 !== null && row.ssp5 !== '' ? parseFloat(row.ssp5) : null;
3280: 
3281:           if (y === histEndYear && histVal !== null) {
3282:             ssp1Val = histVal;
3283:             ssp2Val = histVal;
3284:             ssp3Val = histVal;
3285:             ssp5Val = histVal;
3286:           }
3287: 
3288:           const yearIdx = Math.max(0, y - futStartYear + 1);
3289:           const currentUncertainty = baseUncertainty + (yearIdx * (baseUncertainty * 0.015));
3290: 
3291:           dataHist.push({ x: y, y: histVal });
3292: 
3293:           // Helper to get custom bounds from CSV or fallback to dynamic calculations
3294:           const getVal = (val, rowMin, rowMax) => {
3295:             if (val === null) return [null, null, null];
3296:             const min = (rowMin !== undefined && rowMin !== null && rowMin !== '') ? parseFloat(rowMin) : val - currentUncertainty;
3297:             const max = (rowMax !== undefined && rowMax !== null && rowMax !== '') ? parseFloat(rowMax) : val + currentUncertainty;
3298:             return [val, min, max];
3299:           };
3300: 
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.
