-
Notifications
You must be signed in to change notification settings - Fork 38
ENH/SE: don't deadreckon position #218
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
Open
jklymak
wants to merge
12
commits into
main
Choose a base branch
from
enh-donedeadreckon
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fbed50c
ENH/SE: don't deadreckon position
3bfe0da
FIX: older files
761a8a0
FIX: older files
1210180
TST: fix tests
06d3330
DOC: add proper docstring
cbca726
FIX: refactor
778f34e
Apply suggestions from code review
jklymak 9ee263b
Fixes
983d47f
FIXES
1aa5838
FIXES
beb1a3b
Merge branch 'main' into enh-donedeadreckon
f828d75
FIX
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |||||||||||||||||||||||||||
| import glob | ||||||||||||||||||||||||||||
| import logging | ||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||
| import warnings | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| import numpy as np | ||||||||||||||||||||||||||||
| import polars as pl | ||||||||||||||||||||||||||||
|
|
@@ -329,6 +330,29 @@ def _remove_fill_values(df, fill_value=9999): | |||||||||||||||||||||||||||
| return df | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| def _forward_fill(gli, todo='Lat'): | ||||||||||||||||||||||||||||
| """Forward-fill Lat to get the last good value at each row""" | ||||||||||||||||||||||||||||
| gli = gli.with_columns([ | ||||||||||||||||||||||||||||
| pl.col(todo).fill_null(strategy="forward").alias("temp_fill") | ||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||
| gli = gli.with_columns([ | ||||||||||||||||||||||||||||
| pl.when( | ||||||||||||||||||||||||||||
| (pl.col(todo) == pl.col("temp_fill").shift(1)) & pl.col("Lat").is_not_null() | ||||||||||||||||||||||||||||
|
jklymak marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||
| ).then(np.nan).otherwise(pl.col(todo)).alias(todo) | ||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||
| gli = gli.drop("temp_fill") | ||||||||||||||||||||||||||||
| return gli | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| def _drop_if(gli, todo='Lat', condit='DeadReckoning', value=1): | ||||||||||||||||||||||||||||
| """Drop Lat if DeadReckoning is 1""" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| """Drop Lat if DeadReckoning is 1""" | |
| """ | |
| Drop values in the column specified by `todo` if the column specified by `condit` equals `value`. | |
| Parameters: | |
| gli (polars.DataFrame): The input DataFrame. | |
| todo (str): The name of the column to modify. | |
| condit (str): The name of the column to check the condition against. | |
| value (any): The value to compare against in the `condit` column. | |
| Returns: | |
| polars.DataFrame: The modified DataFrame with updated values in the `todo` column. | |
| """ |
jklymak marked this conversation as resolved.
Outdated
jklymak marked this conversation as resolved.
jklymak marked this conversation as resolved.
Outdated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-1.51 KB
(100%)
tests/expected/example-seaexplorer/L0-timeseries/dfo-eva035-20190718.nc
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.