diff --git a/doc/source/user_guide/documentation/classes_dev_uml.svg b/doc/source/user_guide/documentation/classes_dev_uml.svg index 765e0d531..3409a38e5 100644 --- a/doc/source/user_guide/documentation/classes_dev_uml.svg +++ b/doc/source/user_guide/documentation/classes_dev_uml.svg @@ -4,11 +4,11 @@ - - + + classes_dev_uml - + icepyx.core.auth.AuthenticationError @@ -30,38 +30,38 @@ icepyx.core.auth.EarthdataAuthMixin - -EarthdataAuthMixin - -_auth : NoneType -_s3_initial_ts : NoneType, datetime -_s3login_credentials : NoneType -_session : NoneType -auth -s3login_credentials -session - -__init__(auth) -__str__() -earthdata_login(uid, email, s3token): None + +EarthdataAuthMixin + +_auth : NoneType +_s3_initial_ts : NoneType, datetime +_s3login_credentials : NoneType +_session : NoneType +auth +s3login_credentials +session + +__init__(auth) +__str__() +earthdata_login(uid, email, s3token): None icepyx.core.query.GenQuery - -GenQuery - -_spatial -_temporal -dates -end_time -spatial -spatial_extent -start_time -temporal - -__init__(spatial_extent, date_range, start_time, end_time) -__str__() + +GenQuery + +_spatial +_temporal +dates +end_time +spatial +spatial_extent +start_time +temporal + +__init__(spatial_extent, date_range, start_time, end_time) +__str__() @@ -81,96 +81,93 @@ icepyx.core.query.Query - -Query - -CMRparams -_CMRparams -_about_product -_cust_options : dict -_cycles : list -_file_vars -_granules -_order_vars -_prod : NoneType, str -_readable_granule_name : list -_reqparams -_source : str -_subsetparams : NoneType -_tracks : list -_version -cycles -dataset -file_vars -granules -order_vars -product -product_version -reqparams -tracks - -__init__(product, spatial_extent, date_range, start_time, end_time, version, cycles, tracks, files, auth) -__str__() -avail_granules(ids, cycles, tracks, cloud) -download_granules(path, verbose, subset, restart) -latest_version() -order_granules(verbose, subset, email) -product_all_info() -product_summary_info() -show_custom_options(dictview) -subsetparams() -visualize_elevation() -visualize_spatial_extent() + +Query + +CMRparams +_CMRparams +_about_product +_cust_options : dict +_cycles : list +_granules +_order_vars +_prod : NoneType, str +_readable_granule_name : list +_reqparams +_subsetparams : NoneType +_tracks : list +_version +cycles +dataset +granules +order_vars +product +product_version +reqparams +tracks + +__init__(product, spatial_extent, date_range, start_time, end_time, version, cycles, tracks, auth) +__str__() +avail_granules(ids, cycles, tracks, cloud) +download_granules(path, verbose, subset, restart) +latest_version() +order_granules(verbose, subset, email) +product_all_info() +product_summary_info() +show_custom_options(dictview) +subsetparams() +visualize_elevation() +visualize_spatial_extent() icepyx.core.granules.Granules->icepyx.core.query.Query - - + + _granules icepyx.core.granules.Granules->icepyx.core.query.Query - - -_granules + + +_granules icepyx.core.icesat2data.Icesat2Data - -Icesat2Data - - -__init__() + +Icesat2Data + + +__init__() icepyx.core.exceptions.NsidcQueryError - -NsidcQueryError - -errmsg -msgtxt : str - -__init__(errmsg, msgtxt) -__str__() + +NsidcQueryError + +errmsg +msgtxt : str + +__init__(errmsg, msgtxt) +__str__() icepyx.core.exceptions.QueryError - -QueryError - - - + +QueryError + + + icepyx.core.exceptions.NsidcQueryError->icepyx.core.exceptions.QueryError - - + + @@ -195,202 +192,195 @@ icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - + + _CMRparams icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - + + _reqparams icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - + + _subsetparams icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - -_subsetparams + + +_subsetparams icepyx.core.query.Query->icepyx.core.auth.EarthdataAuthMixin - - + + icepyx.core.query.Query->icepyx.core.query.GenQuery - - + + icepyx.core.read.Read - -Read - -_filelist : NoneType, list -_out_obj : Dataset -_product : NoneType, str -_read_vars -filelist -product -vars - -__init__(data_source, product, filename_pattern, catalog, glob_kwargs, out_obj_type) -_add_vars_to_ds(is2ds, ds, grp_path, wanted_groups_tiered, wanted_dict) -_build_dataset_template(file) -_build_single_file_dataset(file, groups_list) -_check_source_for_pattern(source, filename_pattern) -_combine_nested_vars(is2ds, ds, grp_path, wanted_dict) -_read_single_grp(file, grp_path) -load() + +Read + +_filelist : NoneType, list +_out_obj : Dataset +_product : NoneType, str +_read_vars +filelist +product +vars + +__init__(data_source, product, filename_pattern, catalog, glob_kwargs, out_obj_type) +_add_vars_to_ds(is2ds, ds, grp_path, wanted_groups_tiered, wanted_dict) +_build_dataset_template(file) +_build_single_file_dataset(file, groups_list) +_check_source_for_pattern(source, filename_pattern) +_combine_nested_vars(is2ds, ds, grp_path, wanted_dict) +_read_single_grp(file, grp_path) +load() icepyx.core.spatial.Spatial - -Spatial - -_ext_type : str -_gdf_spat : GeoDataFrame -_geom_file : NoneType -_spatial_ext -_xdateln -extent -extent_as_gdf -extent_file -extent_type - -__init__(spatial_extent) -__str__() -fmt_for_CMR() -fmt_for_EGI() + +Spatial + +_ext_type : str +_gdf_spat : GeoDataFrame +_geom_file : NoneType +_spatial_ext +_xdateln +extent +extent_as_gdf +extent_file +extent_type + +__init__(spatial_extent) +__str__() +fmt_for_CMR() +fmt_for_EGI() icepyx.core.spatial.Spatial->icepyx.core.query.GenQuery - - -_spatial + + +_spatial icepyx.core.spatial.Spatial->icepyx.core.query.GenQuery - - -_spatial + + +_spatial icepyx.core.temporal.Temporal - -Temporal - -_end : datetime -_start : datetime -end -start - -__init__(date_range, start_time, end_time) -__str__() + +Temporal + +_end : datetime +_start : datetime +end +start + +__init__(date_range, start_time, end_time) +__str__() icepyx.core.temporal.Temporal->icepyx.core.query.GenQuery - - -_temporal + + +_temporal icepyx.core.variables.Variables - -Variables - -_avail : NoneType, list -_path : NoneType -_product : NoneType, str -_version -path -product -version -wanted : NoneType, dict - -__init__(vartype, path, product, version, avail, wanted, auth) -_check_valid_lists(vgrp, allpaths, var_list, beam_list, keyword_list) -_get_combined_list(beam_list, keyword_list) -_get_sum_varlist(var_list, all_vars, defaults) -_iter_paths(sum_varlist, req_vars, vgrp, beam_list, keyword_list) -_iter_vars(sum_varlist, req_vars, vgrp) -append(defaults, var_list, beam_list, keyword_list) -avail(options, internal) -parse_var_list(varlist, tiered, tiered_vars) -remove(all, var_list, beam_list, keyword_list) + +Variables + +_avail : NoneType, list +_path : NoneType +_product : NoneType, str +_version +path +product +version +wanted : NoneType, dict + +__init__(vartype, path, product, version, avail, wanted, auth) +_check_valid_lists(vgrp, allpaths, var_list, beam_list, keyword_list) +_get_combined_list(beam_list, keyword_list) +_get_sum_varlist(var_list, all_vars, defaults) +_iter_paths(sum_varlist, req_vars, vgrp, beam_list, keyword_list) +_iter_vars(sum_varlist, req_vars, vgrp) +append(defaults, var_list, beam_list, keyword_list) +avail(options, internal) +parse_var_list(varlist, tiered, tiered_vars) +remove(all, var_list, beam_list, keyword_list) icepyx.core.variables.Variables->icepyx.core.auth.EarthdataAuthMixin - - + + icepyx.core.variables.Variables->icepyx.core.query.Query - - + + _order_vars icepyx.core.variables.Variables->icepyx.core.query.Query - - -_order_vars - - - -icepyx.core.variables.Variables->icepyx.core.query.Query - - -_file_vars + + +_order_vars - + icepyx.core.variables.Variables->icepyx.core.read.Read - - -_read_vars + + +_read_vars icepyx.core.visualization.Visualize - -Visualize - -bbox : list -cycles : NoneType -date_range : NoneType -product : NoneType, str -tracks : NoneType - -__init__(query_obj, product, spatial_extent, date_range, cycles, tracks) -generate_OA_parameters(): list -grid_bbox(binsize): list -make_request(base_url, payload) -parallel_request_OA(): da.array -query_icesat2_filelist(): tuple -request_OA_data(paras): da.array -viz_elevation(): (hv.DynamicMap, hv.Layout) + +Visualize + +bbox : list +cycles : NoneType +date_range : NoneType +product : NoneType, str +tracks : NoneType + +__init__(query_obj, product, spatial_extent, date_range, cycles, tracks) +generate_OA_parameters(): list +grid_bbox(binsize): list +make_request(base_url, payload) +parallel_request_OA(): da.array +query_icesat2_filelist(): tuple +request_OA_data(paras): da.array +viz_elevation(): (hv.DynamicMap, hv.Layout) diff --git a/doc/source/user_guide/documentation/classes_user_uml.svg b/doc/source/user_guide/documentation/classes_user_uml.svg index 59b8e8e6f..d52b1c779 100644 --- a/doc/source/user_guide/documentation/classes_user_uml.svg +++ b/doc/source/user_guide/documentation/classes_user_uml.svg @@ -4,11 +4,11 @@ - - + + classes_user_uml - + icepyx.core.auth.AuthenticationError @@ -30,29 +30,29 @@ icepyx.core.auth.EarthdataAuthMixin - -EarthdataAuthMixin - -auth -s3login_credentials -session - -earthdata_login(uid, email, s3token): None + +EarthdataAuthMixin + +auth +s3login_credentials +session + +earthdata_login(uid, email, s3token): None icepyx.core.query.GenQuery - -GenQuery - -dates -end_time -spatial -spatial_extent -start_time -temporal - - + +GenQuery + +dates +end_time +spatial +spatial_extent +start_time +temporal + + @@ -70,79 +70,78 @@ icepyx.core.query.Query - -Query - -CMRparams -cycles -dataset -file_vars -granules -order_vars -product -product_version -reqparams -tracks - -avail_granules(ids, cycles, tracks, cloud) -download_granules(path, verbose, subset, restart) -latest_version() -order_granules(verbose, subset, email) -product_all_info() -product_summary_info() -show_custom_options(dictview) -subsetparams() -visualize_elevation() -visualize_spatial_extent() + +Query + +CMRparams +cycles +dataset +granules +order_vars +product +product_version +reqparams +tracks + +avail_granules(ids, cycles, tracks, cloud) +download_granules(path, verbose, subset, restart) +latest_version() +order_granules(verbose, subset, email) +product_all_info() +product_summary_info() +show_custom_options(dictview) +subsetparams() +visualize_elevation() +visualize_spatial_extent() icepyx.core.granules.Granules->icepyx.core.query.Query - - + + _granules icepyx.core.granules.Granules->icepyx.core.query.Query - - -_granules + + +_granules icepyx.core.icesat2data.Icesat2Data - -Icesat2Data - - - + +Icesat2Data + + + icepyx.core.exceptions.NsidcQueryError - -NsidcQueryError - -errmsg -msgtxt : str - - + +NsidcQueryError + +errmsg +msgtxt : str + + icepyx.core.exceptions.QueryError - -QueryError - - - + +QueryError + + + icepyx.core.exceptions.NsidcQueryError->icepyx.core.exceptions.QueryError - - + + @@ -161,170 +160,163 @@ icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - + + _CMRparams icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - + + _reqparams icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - + + _subsetparams icepyx.core.APIformatting.Parameters->icepyx.core.query.Query - - -_subsetparams + + +_subsetparams icepyx.core.query.Query->icepyx.core.auth.EarthdataAuthMixin - - + + icepyx.core.query.Query->icepyx.core.query.GenQuery - - + + icepyx.core.read.Read - -Read - -filelist -product -vars - -load() + +Read + +filelist +product +vars + +load() icepyx.core.spatial.Spatial - -Spatial - -extent -extent_as_gdf -extent_file -extent_type - -fmt_for_CMR() -fmt_for_EGI() + +Spatial + +extent +extent_as_gdf +extent_file +extent_type + +fmt_for_CMR() +fmt_for_EGI() icepyx.core.spatial.Spatial->icepyx.core.query.GenQuery - - -_spatial + + +_spatial icepyx.core.spatial.Spatial->icepyx.core.query.GenQuery - - -_spatial + + +_spatial icepyx.core.temporal.Temporal - -Temporal - -end -start - - + +Temporal + +end +start + + icepyx.core.temporal.Temporal->icepyx.core.query.GenQuery - - -_temporal + + +_temporal icepyx.core.variables.Variables - -Variables - -path -product -version -wanted : NoneType, dict - -append(defaults, var_list, beam_list, keyword_list) -avail(options, internal) -parse_var_list(varlist, tiered, tiered_vars) -remove(all, var_list, beam_list, keyword_list) + +Variables + +path +product +version +wanted : NoneType, dict + +append(defaults, var_list, beam_list, keyword_list) +avail(options, internal) +parse_var_list(varlist, tiered, tiered_vars) +remove(all, var_list, beam_list, keyword_list) icepyx.core.variables.Variables->icepyx.core.auth.EarthdataAuthMixin - - + + icepyx.core.variables.Variables->icepyx.core.query.Query - - -_order_vars + + +_order_vars icepyx.core.variables.Variables->icepyx.core.query.Query - - -_order_vars - - - -icepyx.core.variables.Variables->icepyx.core.query.Query - - -_file_vars + + +_order_vars - + icepyx.core.variables.Variables->icepyx.core.read.Read - - -_read_vars + + +_read_vars icepyx.core.visualization.Visualize - -Visualize - -bbox : list -cycles : NoneType -date_range : NoneType -product : NoneType, str -tracks : NoneType - -generate_OA_parameters(): list -grid_bbox(binsize): list -make_request(base_url, payload) -parallel_request_OA(): da.array -query_icesat2_filelist(): tuple -request_OA_data(paras): da.array -viz_elevation(): (hv.DynamicMap, hv.Layout) + +Visualize + +bbox : list +cycles : NoneType +date_range : NoneType +product : NoneType, str +tracks : NoneType + +generate_OA_parameters(): list +grid_bbox(binsize): list +make_request(base_url, payload) +parallel_request_OA(): da.array +query_icesat2_filelist(): tuple +request_OA_data(paras): da.array +viz_elevation(): (hv.DynamicMap, hv.Layout) diff --git a/icepyx/core/query.py b/icepyx/core/query.py index 0627486ed..32357eb8a 100644 --- a/icepyx/core/query.py +++ b/icepyx/core/query.py @@ -1,19 +1,12 @@ -import datetime as dt import geopandas as gpd -import json import matplotlib.pyplot as plt -import numpy as np -import os -from pathlib import Path +from pathlib import Path # used in docstring tests import pprint -import time import warnings import icepyx.core.APIformatting as apifmt from icepyx.core.auth import EarthdataAuthMixin import icepyx.core.granules as granules - -# QUESTION: why doesn't from granules import Granules work, since granules=icepyx.core.granules? from icepyx.core.granules import Granules import icepyx.core.is2ref as is2ref import icepyx.core.spatial as spat @@ -34,14 +27,17 @@ class GenQuery: Parameters ---------- spatial_extent : list of coordinates or string (i.e. file name) - Spatial extent of interest, provided as a bounding box, list of polygon coordinates, or + Spatial extent of interest, provided as a bounding box, + list of polygon coordinates, or geospatial polygon file. NOTE: Longitude values are assumed to be in the range -180 to +180, - with 0 being the Prime Meridian (Greenwich). See xdateline for regions crossing the date line. + with 0 being the Prime Meridian (Greenwich). + See xdateline for regions crossing the date line. You can submit at most one bounding box or list of polygon coordinates. Per NSIDC requirements, geospatial polygon files may only contain one feature (polygon). Bounding box coordinates should be provided in decimal degrees as - [lower-left-longitude, lower-left-latitute, upper-right-longitude, upper-right-latitude]. + [lower-left-longitude, lower-left-latitute, + upper-right-longitude, upper-right-latitude]. Polygon coordinates should be provided as coordinate pairs in decimal degrees as [(longitude1, latitude1), (longitude2, latitude2), ... (longitude_n,latitude_n), (longitude1,latitude1)] or @@ -73,7 +69,8 @@ class GenQuery: where HH = hours, mm = minutes, ss = seconds. If None is given (and a datetime.datetime object is not supplied for `date_range`), a default of 23:59:59 is applied. - If a datetime.datetime object was created without times, the datetime package defaults will apply over those of icepyx + If a datetime.datetime object was created without times, + the datetime package defaults will apply over those of icepyx xdateline : boolean, default None Keyword argument to enforce spatial inputs that cross the International Date Line. Internally, this will translate your longitudes to 0 to 360 to construct the @@ -211,7 +208,8 @@ def spatial_extent(self): Return an array showing the spatial extent of the query object. Spatial extent is returned as an input type (which depends on how you initially entered your spatial data) followed by the geometry data. - Bounding box data is [lower-left-longitude, lower-left-latitute, upper-right-longitude, upper-right-latitude]. + Bounding box data is [lower-left-longitude, lower-left-latitute, + ... upper-right-longitude, upper-right-latitude]. Polygon data is [longitude1, latitude1, longitude2, latitude2, ... longitude_n,latitude_n, longitude1,latitude1]. @@ -250,7 +248,8 @@ def spatial_extent(self): def dates(self): """ Return an array showing the date range of the query object. - Dates are returned as an array containing the start and end datetime objects, inclusive, in that order. + Dates are returned as an array containing the start and end datetime + objects, inclusive, in that order. Examples -------- @@ -320,7 +319,6 @@ def end_time(self): # DevGoal: update docs throughout to allow for polygon spatial extent -# Note: add files to docstring once implemented # DevNote: currently this class is not tested class Query(GenQuery, EarthdataAuthMixin): """ @@ -340,16 +338,15 @@ class Query(GenQuery, EarthdataAuthMixin): ICESat-2 data product ID, also known as "short name" (e.g. ATL03). Available data products can be found at: https://nsidc.org/data/icesat-2/data-sets version : string, default most recent version - Product version, given as a 3 digit string. If no version is given, the current - version is used. Example: "006" + Product version, given as a 3 digit string. + If no version is given, the current version is used. Example: "006" cycles : string or a list of strings, default all available orbital cycles - Product cycle, given as a 2 digit string. If no cycle is given, all available - cycles are used. Example: "04" + Product cycle, given as a 2 digit string. + If no cycle is given, all available cycles are used. Example: "04" tracks : string or a list of strings, default all available reference ground tracks (RGTs) - Product track, given as a 4 digit string. If no track is given, all available - reference ground tracks are used. Example: "0594" - files : string, default None - A placeholder for future development. Not used for any purposes yet. + Product track, given as a 4 digit string. + If no track is given, all available reference ground tracks are used. + Example: "0594" auth : earthaccess.auth.Auth, default None An earthaccess authentication object. Available as an argument so an existing earthaccess.auth.Auth object can be used for authentication. If not given, a new auth @@ -407,31 +404,18 @@ def __init__( version=None, cycles=None, tracks=None, - files=None, # NOTE: if you end up implemeting this feature here, use a better variable name than "files" auth=None, **kwargs, ): # Check necessary combination of input has been specified - if ( - (product is None or spatial_extent is None) - or ( - (date_range is None and cycles is None and tracks is None) - and int(product[-2:]) <= 13 - ) - and files is None + if (product is None or spatial_extent is None) or ( + (date_range is None and cycles is None and tracks is None) + and int(product[-2:]) <= 13 ): raise ValueError( "Please provide the required inputs. Use help([function]) to view the function's documentation" ) - if files is not None: - self._source = "files" - # self.file_vars = Variables(self._source) - else: - self._source = "order" - # self.order_vars = Variables(self._source) - # self.variables = Variables(self._source) - self._prod = is2ref._validate_product(product) super().__init__(spatial_extent, date_range, start_time, end_time, **kwargs) @@ -594,7 +578,8 @@ def CMRparams(self): @property def reqparams(self): """ - Display the required key:value pairs that will be submitted. It generates the dictionary if it does not already exist. + Display the required key:value pairs that will be submitted. + It generates the dictionary if it does not already exist. Examples -------- @@ -618,7 +603,8 @@ def reqparams(self): # DevQuestion: if I make this a property, I get a "dict" object is not callable when I try to give input kwargs... what approach should I be taking? def subsetparams(self, **kwargs): """ - Display the subsetting key:value pairs that will be submitted. It generates the dictionary if it does not already exist + Display the subsetting key:value pairs that will be submitted. + It generates the dictionary if it does not already exist and returns an empty dictionary if subsetting is set to False during ordering. Parameters @@ -626,7 +612,8 @@ def subsetparams(self, **kwargs): **kwargs : key-value pairs Additional parameters to be passed to the subsetter. By default temporal and spatial subset keys are passed. - Acceptable key values are ['format','projection','projection_parameters','Coverage']. + Acceptable key values are + ['format','projection','projection_parameters','Coverage']. At this time (2020-05), only variable ('Coverage') parameters will be automatically formatted. See Also @@ -648,7 +635,7 @@ def subsetparams(self, **kwargs): kwargs["start"] = self._temporal._start kwargs["end"] = self._temporal._end - if self._subsetparams == None and not kwargs: + if self._subsetparams is None and not kwargs: return {} else: # If the user has supplied a subset list of variables, append the @@ -672,7 +659,7 @@ def subsetparams(self, **kwargs): if var not in kwargs["Coverage"].keys(): kwargs["Coverage"][var.split("/")[-1]] = [var] - if self._subsetparams == None: + if self._subsetparams is None: self._subsetparams = apifmt.Parameters("subset") if self._spatial._geom_file is not None: self._subsetparams.build_params( @@ -710,63 +697,37 @@ def order_vars(self): """ if not hasattr(self, "_order_vars"): - if self._source == "order": - # DevGoal: check for active session here - if hasattr(self, "_cust_options"): - self._order_vars = Variables( - product=self.product, - version=self._version, - avail=self._cust_options["variables"], - auth=self.auth, - ) - else: - self._order_vars = Variables( - product=self.product, - version=self._version, - auth=self.auth, - ) - - # I think this is where property setters come in, and one should be used here? Right now order_vars.avail is only filled in - # if _cust_options exists when the class is initialized, but not if _cust_options is filled in prior to another call to order_vars - # if self._order_vars.avail == None and hasattr(self, '_cust_options'): - # print('got into the loop') - # self._order_vars.avail = self._cust_options['variables'] - - return self._order_vars - - @property - def file_vars(self): - """ - Return the file variables object. - This instance is generated when files are used to create the data object (not yet implemented). - - See Also - -------- - variables.Variables - - Examples - -------- - >>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28']) # doctest: +SKIP - - >>> reg_a.file_vars # doctest: +SKIP - - """ - - if not hasattr(self, "_file_vars"): - if self._source == "file": - self._file_vars = Variables( + # DevGoal: check for active session here + if hasattr(self, "_cust_options"): + self._order_vars = Variables( + product=self.product, + version=self._version, + avail=self._cust_options["variables"], auth=self.auth, + ) + else: + self._order_vars = Variables( product=self.product, version=self._version, + auth=self.auth, ) - return self._file_vars + # I think this is where property setters come in, and one should be used here? + # Right now order_vars.avail is only filled in + # if _cust_options exists when the class is initialized, + # but not if _cust_options is filled in prior to another call to order_vars + # if self._order_vars.avail == None and hasattr(self, '_cust_options'): + # print('got into the loop') + # self._order_vars.avail = self._cust_options['variables'] + + return self._order_vars @property def granules(self): """ Return the granules object, which provides the underlying funtionality for searching, ordering, - and downloading granules for the specified product. Users are encouraged to use the built in wrappers + and downloading granules for the specified product. + Users are encouraged to use the built-in wrappers rather than trying to access the granules object themselves. See Also @@ -785,7 +746,7 @@ def granules(self): if not hasattr(self, "_granules"): self._granules = Granules() - elif self._granules == None: + elif self._granules is None: self._granules = Granules() return self._granules @@ -1041,9 +1002,9 @@ def order_granules(self, verbose=False, subset=True, email=False, **kwargs): if self._reqparams._reqtype == "search": self._reqparams._reqtype = "download" - if "email" in self._reqparams.fmted_keys.keys() or email == False: + if "email" in self._reqparams.fmted_keys.keys() or email is False: self._reqparams.build_params(**self._reqparams.fmted_keys) - elif email == True: + elif email is True: user_profile = self.auth.get_user_profile() self._reqparams.build_params( **self._reqparams.fmted_keys, email=user_profile["email_address"] @@ -1052,9 +1013,9 @@ def order_granules(self, verbose=False, subset=True, email=False, **kwargs): if subset is False: self._subsetparams = None elif ( - subset == True + subset is True and hasattr(self, "_subsetparams") - and self._subsetparams == None + and self._subsetparams is None ): del self._subsetparams @@ -1146,7 +1107,7 @@ def download_granules( if not hasattr(self, "_granules"): self.granules - if restart == True: + if restart is True: pass else: if (