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
| # -*- coding: utf-8 -*- | |
| """ Deletes all tweets below a certain retweet threshold. | |
| """ | |
| import tweepy | |
| from datetime import datetime | |
| # Constants | |
| CONSUMER_KEY = '' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| FROM pangeo/base-image:2020.03.27 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| def preprocess(ds): | |
| """Drop all unnecessary variables and coordinates""" | |
| vars_to_drop = [vname for vname in ds.data_vars if vname not in variables] | |
| coord_vars = [vname for vname in ds.data_vars if 'time' not in ds[vname].dims or 'bound' in vname] | |
| ds_fixed = ds.set_coords(coord_vars) | |
| data_vars_dims = [] | |
| for data_var in ds_fixed.data_vars: | |
| data_vars_dims.extend(list(ds_fixed[data_var].dims)) | |
| coords_to_drop = [coord for coord in ds_fixed.coords if coord not in data_vars_dims] | |
| grid_vars = list(set(vars_to_drop + coords_to_drop) - set(['time', 'time_bound'])) |