FIRMS active-fire ingest¶
The FIRMS plugin (tracking.models.firms.FirmsPlugin) pulls NASA FIRMS VIIRS 375 m active-fire detections for one
FIRMS region. It records each detection inside the plugin’s spatial feature group as an observation and, for qualifying
detections, raises a firms_rep event. tracking.tasks.schedule_firms_plugins schedules the plugins (see
celery_schedule). The firms management command runs every plugin by hand.
Each run reads two NRT day files from the Earthdata archive (nrt3.modaps.eosdis.nasa.gov): yesterday’s and today’s
(UTC). NASA keeps rewriting yesterday’s file for hours after midnight.
Satellite products¶
|
Archive folder |
File name pattern |
Status |
|---|---|---|---|
|
|
|
Default |
|
|
|
Supported |
|
|
|
End of life: no new data after 2026-11-02 |
We verified these folders, prefixes and product tokens against the live archive on 2026-11-16. That check covered NASA’s public directory listing and authenticated downloads of NOAA-20 and NOAA-21 files. All three products publish the same 13-column header:
latitude,longitude,bright_ti4,scan,track,acq_date,acq_time,satellite,confidence,version,bright_ti5,frp,daynight
The satellite column holds N (Suomi NPP), N20 (NOAA-20) or N21 (NOAA-21).
Suomi NPP is retired. NASA stopped delivering new Suomi NPP science data at 15:40 UTC on 2026-11-02. The last
Suomi NRT day file is 2026306, and later days return 404. NOAA-20 and NOAA-21 carry the same VIIRS sensor in the same
orbital plane, about 50 minutes apart. suomi-npp can still be selected, but each run against it logs a warning that
names the end-of-life date.
additional options¶
All options live in the plugin’s existing additional JSON, so none of them needs a migration. If a value is invalid,
the run stops with a configuration error before any request is sent.
Key |
Default |
Meaning |
|---|---|---|
|
|
Satellite product to read: |
|
|
Non-empty list of processing levels to ingest, matched case-insensitively against the suffix of the |
|
|
Whether to ingest rows whose |
|
|
Decimal places (0–7) that set the de-duplication cell: new events are stored at the reported position rounded to this many places, and a detection within one cell (10^-N degrees on each axis) of an existing incident at the same acquisition time is treated as that incident. 3 places is about 110 m: enough to absorb an intraday geolocation revision, while keeping adjacent 375 m pixels apart. |
|
|
List of confidence values that raise an event. It must be a JSON list of strings; a bare string is rejected. An empty list ingests observations without raising events. |
|
24 hours |
Only detections newer than this raise an event (unchanged). |
The plugin writes and manages one more key itself. Do not edit it by hand.
firms_cursors:{product: {day_index: {etag, offset, prefix_sha256, columns}}}. For each product and each day, it records how far the plugin has read.offsetalways points just past the last complete line. Only yesterday and today are kept.
How a resume works¶
Each request for a day file carries the Earthdata token. It also carries
If-None-Match, but only when the cursor for that file is complete: an etag, a positive offset, aprefix_sha256and the header columns. It never carriesRangeorIf-Range.304means the file is unchanged. Nothing is read, and the cursor is kept.200carries the whole file. The plugin compares the firstoffsetbytes (and the header columns) against the cursor’sprefix_sha256:If they match, the file was only appended to, and parsing resumes at the cursor, so earlier rows are not ingested twice.
If they don’t match, the file was rewritten. It is re-read from the start, and the run counts a
resume_reset.An incomplete cursor (no usable offset,
prefix_sha256or columns) sends noIf-None-Match. So even an unchanged file is re-read in full, rather than skipped with a304, and the cursor is replaced by a complete one.
Why no byte ranges. The archive ignores
If-Range, and its etag changes on every append, so a partial (206) body could never be validated against the cursor. It would always be discarded and followed by a full download. The cost of this protocol is one conditional request per unchanged file, and one full download per changed file.A half-written trailing record is never parsed. It is read on a later cycle, once it is complete.
Fields are parsed by header name. A line with the wrong number of fields, or an unparseable value, is skipped with a warning and counted. A file whose header lacks
latitude,longitude,acq_dateoracq_timeis skipped with an error. That file’s cursor is left untouched, and the other file is still read.The day being read comes from the plugin’s own cursor keys, not from response headers. A
304or404on one file leaves the other file’s cursor alone.An HTML response (Earthdata redirects an unauthenticated request to its login page) logs an error naming the
app_key, and leaves the cursor unchanged.304is the only “no new data” answer, and404is counted infiles_not_found. Any other status, including a206or416, is logged with its code and URL, and its body is never parsed. The cursor is left unchanged.401/403are logged as errors pointing at theapp_key; everything else as a warning. Each is counted infetch_errors, as is the HTML login page.acq_timemust beHH:MM(the archive) orHHMM(the public CSVs), with a valid hour and minute. Any other shape makes the line malformed.
De-duplication¶
Before creating an event, the plugin looks for an existing FIRMS event in the tenant with the same event type,
acquisition time and provenance, located within one cell of the reported position. The cell is
10^-dedupe_location_precision degrees on each axis, 0.001° by default. A hit means the detection is already an
incident, and it is counted in events_deduplicated. That covers:
a revision whose coordinates NASA changes during the day, even when the change crosses a rounding boundary (for example
-18.90049→-18.90051);incidents recorded before this change, which were stored at full precision.
The lookup is a bounding box on Event.location, a geometry in SRID 4326, so the cell is in degrees. A degree of
longitude shrinks towards the poles, so at high latitude the box only gets narrower in metres. It can never merge
detections that would stay apart at the equator. Adjacent 375 m VIIRS pixels are about 0.0034° apart at the equator,
and further apart in longitude at higher latitudes, so neighbouring pixels at the same acquisition time remain
separate incidents. A box straddling the antimeridian does not wrap.
New events are stored at the reported position rounded to dedupe_location_precision places. The full-precision
reported coordinates are kept on the observation, and in the event’s event_details as reported_latitude /
reported_longitude.
Run summary¶
Every run ends with a single INFO line, Finished FIRMS Plugin. region-name=… product=…, followed by these counters
(also attached as structured extra fields):
files_read: day files fetched and parsed, including ones with no new rowsrecords_readskipped_processing_levelunknown_processing_levelmalformed_linesheader_errorsresume_resetsfiles_not_foundfetch_errors: day files that could not be fetched (HTTP errors, connection errors, the login page)unexpected_errors: 1 if the run stopped on an unexpected error part-wayoutside_areaevents_createdevents_deduplicated
For a backfill run, backfill=<first day index>..<last day index> comes before the counters.
Backfilling missed days¶
The firms management command runs every FIRMS plugin in one tenant. --backfill-days N makes it re-read the day
files from N days before today through today, oldest first.
cd das
python manage.py firms --tenant_domain <tenant-domain> --backfill-days N
Example: on 2026-11-16, recovering everything since Suomi NPP stopped on 2026-11-02 (day 2026306):
python manage.py firms --tenant_domain <tenant-domain> --backfill-days 14
That reads 15 day files, 2026306 through 2026320, for each plugin’s product (NOAA-20 unless firms_product says
otherwise).
Limits. N must be a whole number from 1 to 60. The archive keeps today’s file plus the 60 before it (checked on 2026-11-16 across products and regions), and anything larger is rejected before any plugin runs. A day missing from the archive (404) is logged, counted in
files_not_foundand skipped. The rest of the backfill goes on.Same filters as a normal run. Product selection, processing levels, the spatial feature group and
confidence_alert_levelsall apply unchanged.Events. A normal run only raises events inside
alert_window(24 h by default). A backfill widens that window back to 00:00 UTC on its first day, so sites get the incidents they missed. See the notification caveat below.Resume state. Every backfilled day is read in full, without
If-None-Match. Cursors are written only for yesterday and today. Each is written as if that file had just been read for the first time, so the next scheduled run resumes normally. If yesterday’s or today’s file is missing or unusable, its existing cursor is kept. No cursor is ever written for an older day.Re-running is safe. Observations are keyed on Source and acquisition time, and events are matched within one de-duplication cell at the same acquisition time (see De-duplication). A second backfill over the same days creates nothing new; its events show up as
events_deduplicated. Asuomi-nppbackfill over days the old code already ingested matches those full-precision incidents in the same way, so it creates no duplicates either.Which plugins. A backfill runs only the tenant’s enabled FIRMS plugins (
status = enabled, the same rule the scheduled task uses). Each disabled plugin is reported by region and left completely alone: no request, no Source, no cursor change, and no event-type upgrade on its account. If the tenant has no enabled FIRMS plugin, the command says so and does nothing. A plainfirmsrun, without--backfill-days, still runs every plugin, disabled ones included.Output and exit status. After each plugin runs, the command writes its run summary to stdout:
FIRMS plugin '<name>': region-name=… product=… [backfill=…] <counters>. Every plugin is attempted. The command then exits non-zero, naming each affected plugin, its region and the counts, if any plugin:had a configuration error (reported on stderr, plugin not run);
raised an unexpected exception (reported on stderr with the plugin’s name; the remaining plugins still run);
had a day file that failed to fetch (
fetch_errors) or had an unusable header (header_errors), even if other days were ingested;stopped on an unexpected error part-way through the run (
unexpected_errors);in a backfill, read no day file at all, for example because every day returned 404.
A run is still a success, exiting 0, when every file answered
304(normal run), when some backfill days are missing but others were read, or when no row fell inside the spatial feature group. The scheduled task does not use this exit status; it only logs the summary.Cancelling. Ctrl-C (
KeyboardInterrupt) orSystemExitduring a plugin’s run stops the whole command.The remaining plugins are not started, and no summary is printed for the cancelled plugin.
The cancelled plugin’s cursors are not saved. Observations and events already recorded stay, and the next run re-reads yesterday’s and today’s files idempotently.
Concurrency. The command does not take the scheduled task’s run-once lock. If the scheduled task runs the same plugin at the same moment, whichever saves last wins
additional.firms_cursors. Both write valid cursors, so the worst case is one extra re-read.
Caveats¶
Notifications. Every backfilled event is created exactly like a live one, and nothing in the event pipeline looks at how old an event is:
Alert rules.
activity/signals.py(event_post_save) queuesevaluate_alert_rulesfor each new event.evaluate_event(activity/alerting/service.py) selects the activefirms_repalert rules whose schedule matches the current time, not the event’s, and whose conditions match the event. In this release, alert rules have no per-rule trigger setting: every selected rule notifies when an event is created (activity/tasks.py,evaluate_conditions_for_sending_alerts→evaluate_notifications), and no rule can opt out.Alert rate limit. Each recipient may receive
alert_rate_limitalerts (20 by default) per 24 h (activity/alerting/rate_limit.py). A large backfill can exhaust that quota, which blocks that user’s alerts for any event type until the window resets.Realtime. Each new event is published as
das.event.newand pushed to every connected client (rt_api/tasks.py).Webhooks. Active event webhooks deliver the backfilled events, because
created_at/updated_atare the time of the backfill run (activity/webhooks/tasks.py).
EarthRanger has no built-in way to suppress notifications for a backfill. To avoid them, an administrator can deactivate the tenant’s
firms_repalert rules before the backfill. Reactivate them only once the queued alert evaluations have drained, and remember that live fire alerts are suppressed for that period too.New Source. NOAA detections land on the product-qualified Source (for example
Southern_Africa-noaa-20), not the old Suomi NPP Source. See the migration notes below.Overlap on 2026-11-02. Suomi NPP delivered data until 15:40 UTC that day, so its events cover part of it. The same fire can then appear once from Suomi NPP and once from NOAA-20. The two satellites pass about 50 minutes apart, so their detections have different acquisition times and never de-duplicate against each other.
Migration notes (ERA-13999, deployed after 2026-11-16)¶
The default product changes from Suomi NPP to NOAA-20. Every existing plugin has had no new Suomi data since 2026-11-02. With no
additionalchange, each one recovers on its first run after deploy.A new Source is created. Each product gets its own Source. A
suomi-nppSource keeps its bare region name asmanufacturer_id(for exampleSouthern_Africa), so existing Sources are untouched. NOAA Sources are qualified by product:Southern_Africa-noaa-20, model nameVIIRS NOAA-20. So the first run after deploy creates a new Source and SourcePlugin for each plugin. Historic Suomi observations stay on the old Source. Re-point anything bound to the old Source at the new one, such as a subject assignment.First run backfills. The first NOAA-20 run reads yesterday’s and today’s NOAA-20 files in full. Qualifying detections inside
alert_window(24 h by default) raise events, so sites get their first fire events since Suomi NPP stopped.Legacy cursors are discarded. The old cursor is
additional.stored_headers: raw Suomi response headers whosecontent-lengthserved as the offset. The first run removes it and never applies it as a byte offset, to any product. A plugin configured forsuomi-nppre-reads its window from the start, which is safe because observation writes are idempotent. Since 2026-11-02 that window only returns 404s.RT and URT rows are now excluded by default. Set
accepted_processing_levelsto include them.Event locations are rounded to
dedupe_location_precisionplaces (3 by default). Usereported_latitude/reported_longitudeinevent_detailsfor the exact position.Stricter
additionalvalidation.firms_productmust be a string naming a product.confidence_alert_levelsmust be a list of strings. A plugin whoseadditionalholds, for example,"confidence_alert_levels": "nominal"ran before, matching by substring. Now it stops with a configuration error, logged by the scheduled task and reported by thefirmscommand, until the value is a list such as["nominal"].Event-type schema (V2 only). The
firms_repV2 schema now declaresreported_latitudeandreported_longitude. A new tenant gets them when the type is created. An existing tenant’s V2firms_repgains them the first time FIRMS runs for that tenant after deploy. That happens throughensure_firms_event_type(), which both the scheduled task and thefirmscommand call before each plugin runs, so a backfill upgrades the type before it creates events. Tenants without a FIRMS plugin are not touched.Additive only. Each field is added only if the schema doesn’t already declare it or list it on the form. It goes right after
track(or afterreported_latitudefor the longitude), in the section that holds that field, or else at the end ofsection-1. Everything a site has retitled, added or reordered is kept. Once both fields are present, nothing is written. A site that deletes one of the two fields gets it back on the next run.Recorded as an edit. The write goes through
EventTypeSchemaServiceand the event type’s own save, inside the tenant’s context. It records an event-type revision and bumpsupdated_at, so sync clients usingupdated_sinceand ETags see the change.V1
firms_reptypes are left unchanged. On those, the two values are in the event’s API data but not on its form.Existing events are unaffected. Events recorded before the upgrade lack the two fields. They still validate, because neither field is required, and they still render. The
event_details_viewreporting view only picks up the new columns when an administrator recreates it from the admin.