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

Ignore nans masking #282

Merged
merged 4 commits into from
Jan 27, 2023
Merged

Conversation

pstradio
Copy link
Collaborator

Method for masking to ignore NaNs in filter columns, i.e. observations can be kept if no information is given by the filtering field.

@wpreimes
Copy link
Member

wpreimes commented Jan 27, 2023

I think @sebhahn removed some functions from pygeobase recently, which are not found anymore by pytesmo...
TUW-GEO/pygeobase@v0.4.0...v0.5.0#diff-59daaa55512c1966afb3f137b3c4d21b53f024252068ddd7b0ee377f27669d4eL683
for a quick fix you could try to fall back to pygeobase==0.4.0

read_ts was deprecated anyway... so maybe we can just make it optional in pytesmo or remove it completely. However, I think read_ts is still in pynetcf (which is between pygeobase and ascat/pytesmo).

@pstradio
Copy link
Collaborator Author

That woul

I think @sebhahn removed some functions from pygeobase recently, which are not found anymore by pytesmo... TUW-GEO/pygeobase@v0.4.0...v0.5.0#diff-59daaa55512c1966afb3f137b3c4d21b53f024252068ddd7b0ee377f27669d4eL683 for a quick fix you could try to fall back to pygeobase==0.4.0

That would work..I will just fallback for now and open an issue

@pstradio
Copy link
Collaborator Author

@s-scherrer could you please review and merge if you think it is ok? new tests are included but for some reason coverall is not happy


if mask is not None:
mask = mask & new_mask
else:
mask = new_mask

return data[mask]
return data[mask].dropna(how="all")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for adding the dropna here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the ignore_nans option active, the dataframe can be returned with all-nans rows. I think it is quite specific to the SMOSL2 data, where there are a LOT of NaNs in the flagging fields, and a lot of observation with no soil moisture (NaN) and some type of flag value.

In the latter case it can happen that the NaN soil moisture is kept. dropna just eliminates these occurrences

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds okay to me. I will merge it in then. Do you need a new release?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would be best, but if you prefer to wait it should work too.

@s-scherrer s-scherrer merged commit 4a1ed8e into TUW-GEO:master Jan 27, 2023
@pstradio pstradio deleted the ignore_nans_masking branch July 22, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants