Spaces:
Sleeping
Sleeping
Download docs/clean.html from sammmmmmm25/marine-tracker: direct link, hf CLI and curl.
- Browser
- Download file 6.43 kB
-
https://huggingface.co/spaces/sammmmmmm25/marine-tracker/resolve/main/docs/clean.html
- Command line
-
hf download hf://spaces/sammmmmmm25/marine-tracker/docs/clean.html
-
curl -L -o clean.html https://huggingface.co/spaces/sammmmmmm25/marine-tracker/resolve/main/docs/clean.html
6.43 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Python: module clean</title> | |
| </head><body> | |
| <table class="heading"> | |
| <tr class="heading-text decor"> | |
| <td class="title"> <br><strong class="title">clean</strong></td> | |
| <td class="extra"><a href=".">index</a><br><a href="file:/Users/samuelveliveli/Downloads/marine-tracker/src/clean.py">/Users/samuelveliveli/Downloads/marine-tracker/src/clean.py</a></td></tr></table> | |
| <p><span class="code">Clean noisy satellite tag fixes: speed filtering, deduplication, optional smoothing.<br> | |
| <br> | |
| Raw Argos/GPS fixes on marine mammals contain occasional large location errors<br> | |
| that imply impossible travel speeds. This module applies the classic<br> | |
| McConnell et al. (1992) speed-filtering approach used widely in marine<br> | |
| telemetry: a forward pass per individual that drops any fix which would<br> | |
| require traveling faster than a per-species plausible maximum from the last<br> | |
| retained fix.</span></p> | |
| <p> | |
| <table class="section"> | |
| <tr class="decor pkg-content-decor heading-text"> | |
| <td class="section-title" colspan=3> <br><strong class="bigsection">Modules</strong></td></tr> | |
| <tr><td class="decor pkg-content-decor"><span class="code"> </span></td><td> </td> | |
| <td class="singlecolumn"><table><tr><td class="multicolumn"><a href="numpy.html">numpy</a><br> | |
| </td><td class="multicolumn"><a href="pandas.html">pandas</a><br> | |
| </td><td class="multicolumn"></td><td class="multicolumn"></td></tr></table></td></tr></table><p> | |
| <table class="section"> | |
| <tr class="decor functions-decor heading-text"> | |
| <td class="section-title" colspan=3> <br><strong class="bigsection">Functions</strong></td></tr> | |
| <tr><td class="decor functions-decor"><span class="code"> </span></td><td> </td> | |
| <td class="singlecolumn"><dl><dt><a name="-clean_track"><strong>clean_track</strong></a>(df, max_speed_kmh=None, smooth=False)</dt><dd><span class="code">Full cleaning pipeline: dedupe -> speed filter -> optional Kalman smoothing.</span></dd></dl> | |
| <dl><dt><a name="-haversine_km"><strong>haversine_km</strong></a>(lat1, lon1, lat2, lon2)</dt><dd><span class="code">Great-circle distance in km between two (lat, lon) points in decimal degrees.</span></dd></dl> | |
| <dl><dt><a name="-kalman_smooth"><strong>kalman_smooth</strong></a>(df, process_noise=0.0001, measurement_noise=0.001)</dt><dd><span class="code">Apply a simple constant-velocity Kalman smoother to each individual's lat/lon track.<br> | |
| <br> | |
| Returns a copy of df with location_lat/location_long replaced by smoothed<br> | |
| estimates. This is an optional pass -- toggle raw vs. smoothed in the app<br> | |
| rather than always applying it, since smoothing can mask genuine sharp<br> | |
| turns.</span></dd></dl> | |
| <dl><dt><a name="-remove_duplicates"><strong>remove_duplicates</strong></a>(df, min_time_diff_seconds=60, min_dist_m=1.0)</dt><dd><span class="code">Drop near-duplicate consecutive fixes for the same individual.<br> | |
| <br> | |
| A fix is considered a near-duplicate of the previous one if it arrived<br> | |
| within min_time_diff_seconds AND within min_dist_m -- i.e. it adds no new<br> | |
| information about position or timing. Iterates over numpy arrays rather<br> | |
| than DataFrame rows since this forward-dependent pass (each decision<br> | |
| depends on the last *retained* fix) can't be fully vectorized, and<br> | |
| per-row Series construction is the dominant cost on studies with 100k+ fixes.</span></dd></dl> | |
| <dl><dt><a name="-speed_filter"><strong>speed_filter</strong></a>(df, max_speed_kmh=None)</dt><dd><span class="code">Drop fixes that imply travel speed above a per-species plausible maximum.<br> | |
| <br> | |
| Forward pass per individual (McConnell et al. speed-filtering approach):<br> | |
| walk fixes in time order, keeping a fix only if its implied speed from the<br> | |
| last *retained* fix is at or below the threshold. max_speed_kmh may be a<br> | |
| single float (applied to all individuals) or None to look up each row's<br> | |
| species in SPECIES_MAX_SPEED_KMH (falling back to DEFAULT_MAX_SPEED_KMH).<br> | |
| Iterates over numpy arrays rather than DataFrame rows for the same reason<br> | |
| as remove_duplicates: the greedy dependency prevents full vectorization,<br> | |
| but avoiding per-row Series construction is still much faster.</span></dd></dl> | |
| </td></tr></table><p> | |
| <table class="section"> | |
| <tr class="decor data-decor heading-text"> | |
| <td class="section-title" colspan=3> <br><strong class="bigsection">Data</strong></td></tr> | |
| <tr><td class="decor data-decor"><span class="code"> </span></td><td> </td> | |
| <td class="singlecolumn"><strong>DEFAULT_MAX_SPEED_KMH</strong> = 15.0<br> | |
| <strong>EARTH_RADIUS_KM</strong> = 6371.0088<br> | |
| <strong>SPECIES_MAX_SPEED_KMH</strong> = {'Balaena mysticetus': 15.0, 'Balaenoptera musculus': 20.0, 'Balaenoptera physalus': 20.0, 'Halichoerus grypus': 20.0, 'Megaptera novaeangliae': 15.0, 'Phoca vitulina': 20.0, 'Trichechus manatus': 10.0}</td></tr></table> | |
| </body></html> |