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

Change adapters so that they can handle ascat timeseries and timezones #164

Merged
merged 8 commits into from
Jul 30, 2019

Conversation

awst-baum
Copy link
Collaborator

Ascat returns data not in a dataframe but in an ascat timeseries object. This produces an exception if pytesmo tries to access the data's columns. This PR works around that.

Also, if data readers add timezone information to data, this PR normalizes to UTC and then drops tz info.

@awst-baum
Copy link
Collaborator Author

@cpaulik @sebhahn Can you comment on if and how this PR would interfere with timezone handling and additional information about TS in pytesmo?
Can we pull this in until the other changes are made?

@sebhahn
Copy link
Member

sebhahn commented Jul 17, 2019

Could you try the new temporal matching e.g. 69d33fc in the pull request #176

@awst-baum
Copy link
Collaborator Author

Dunno what you mean by "try"... I've merged your branch into mine and the merge has no conflicts. I want to run the tests but I currently can't get them to work (in general), lots of "TypeError: boxcar_filter() got an unexpected keyword argument 'fillna'"

But how would I see that the try is successful?

@sebhahn
Copy link
Member

sebhahn commented Jul 18, 2019

There shouldn't be any conflict/complain about the timezone during the temporal matching, but maybe the timezone is also an issue somewhere else

@awst-baum
Copy link
Collaborator Author

See issue #150

@sebhahn
Copy link
Member

sebhahn commented Jul 18, 2019

the test you've provided in #150 works without a problem using #176

@awst-baum
Copy link
Collaborator Author

Cool! Can we then add that test back into the pytesmo tests?

@sebhahn
Copy link
Member

sebhahn commented Jul 18, 2019

done 3cd2fb0

@awst-baum
Copy link
Collaborator Author

Great, thanks! Once your changes go to the master branch, __drop_tz_info can be removed from this PR. Until it does, I'll leave it in there...

class MaskingAdapter(object):
class BasicAdapter(object):
"""
Base class for other adapters that works around the ascat reader not
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not just for ascat. Would work for any data in this format.


def __get_dataframe(self, data):
if ((not isinstance(data, DataFrame)) and (hasattr(data, 'data')) and (isinstance(data.data, DataFrame))):
data = data.data
Copy link
Collaborator

Choose a reason for hiding this comment

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

could add a key word argument for the name of the 'data', i.e. (hasattr(data, keyword_name_of_data)). Then if not named 'data', this could be overwritten. May be useful if a reader returns more than one data frame with data in it.


def __drop_tz_info(self, data):
if data.index.tz is not None:
warnings.warn('Dropping timezone information for data')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we put in what the timezone was?

Copy link
Collaborator

Choose a reason for hiding this comment

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

i mean stating the timezone that has been dropped, i.e. UTC. May be a clearer message to the user. For example if they didn't know the timezones on the data going in, it would now tell them and may help them resolve errors more easily. Only a suggestion.

@awst-baum
Copy link
Collaborator Author

Should we put in what the timezone was?

How do you mean?
(Hopefully, the timezone bit can be removed anyway when Sebastian's changes get merged anyway, but still)

…mment, optional column name parameter, better warning message
@awst-baum
Copy link
Collaborator Author

OK, suggestions implemented.

wpreimes and others added 4 commits July 27, 2019 23:40
Remove old files in appveyor folder that are not used anymore

Support x64 python 2 and 3 and x86 for py2
We install python via conda
Pulling in wpreimes's changes to appveyor config
@wpreimes
Copy link
Member

@tracyscanlon or @sebhahn can you merge this please, everything ok from my side (even the windows builds work now), then #177 can be closed as well.

@cpaulik
Copy link
Collaborator

cpaulik commented Jul 29, 2019

I will look at the temporal matching merge request this week. Then we can hopefully merge it and remove the time zone dropping from this one.

@awst-baum
Copy link
Collaborator Author

I've merged it now because:

  • this branch contains the fixes for AppVeyor as well (and we want those)
  • it's not hard to deactivate/revert/change this change again
  • in case temporal matching takes a little longer, we've got a workaround now

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.

None yet

5 participants