Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase #172 #173

Merged
merged 6 commits into from
Apr 26, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { type geoEventInterface as GeoEvent } from "../../../Interfaces/GeoEvent
import {Confidence} from '../../../Interfaces/GeoEvent';
import {determineSlice} from "../../../utils/geometry"
import ee from '@google/earthengine'
import {logger} from "../../../server/logger"

type FireDataEntry = [number, number, Date];
type AllFireData = FireDataEntry[];
Expand Down Expand Up @@ -57,16 +58,19 @@ class GOES16GeoEventProviderClass implements GeoEventProviderClass {
null,
() => {
console.log('Google Earth Engine authentication successful');
logger(`Google Earth Engine authentication successful`, "info");
resolve();
},
(err) => {
console.error('Google Earth Engine initialization error', err);
logger(`Google Earth Engine initialization error`, "error");
reject(err);
}
);
},
(err) => {
console.error('Google Earth Engine authentication error', err);
logger(`Google Earth Engine authentication error`, "error");
reject(err);
}
);
Expand Down Expand Up @@ -135,12 +139,12 @@ class GOES16GeoEventProviderClass implements GeoEventProviderClass {
}
});
}) as FireDataEntry;

// Concatenate the current image's fire data with the master array
allFireData = allFireData.concat(fireData);
};
} catch (error) {
console.error("Error fetching fire data:", error);
logger(`Error fetching fire data`, "error");
}

// Normalize the fire data into GeoEvent format
Expand All @@ -156,10 +160,10 @@ class GOES16GeoEventProviderClass implements GeoEventProviderClass {
slice: determineSlice(fireData[1], fireData[0]),
data: {'satellite': clientApiKey, 'slice': slice}
}));

resolve(geoEventsData);
} catch (error) {
console.error('Failed to fetch or process GOES-16 data', error);
logger(`Failed to fetch or process GOES-16 data`, "error");
reject(error);
}
});
Expand Down
Loading