def load_data(self, filename, *args, **kwargs):
        """
        Load JSON data.

        :param filename: name of JSON file with data
        :type filename: str
        :return: data
        :rtype: dict
        """
        # append .json extension if needed
        if not filename.endswith('.json'):
            filename += '.json'  # append "json" to filename
        # open file and load JSON data
        with open(filename, 'r') as fid:
            json_data = json.load(fid)
        # if JSONReader is the original reader then apply units and return
        if (not self.orig_data_reader or
                isinstance(self, self.orig_data_reader)):
            return self.apply_units_to_cache(json_data['data'])
        # last modification since JSON file was saved
        utc_mod_time = json_data.get('utc_mod_time')
        # instance of original data reader with original parameters
        orig_data_reader_obj = self.orig_data_reader(self.parameters, self.meta)
        # check if file has been modified since saved as JSON file
        if utc_mod_time:
            # convert to ordered tuple
            utc_mod_time = time.struct_time(utc_mod_time)
            orig_filename = filename[:-5]  # original filename
            # use original file if it's been modified since JSON file saved
            if utc_mod_time < time.gmtime(os.path.getmtime(orig_filename)):
                os.remove(filename)  # delete JSON file
                return orig_data_reader_obj.load_data(orig_filename)
        # use JSON file if original file hasn't been modified
        return orig_data_reader_obj.apply_units_to_cache(json_data['data'])
def load_data ( self , filename , * args , ** kwargs ) : if not filename . endswith ( '.json' ) : filename += '.json' with open ( filename , 'r' ) as fid : json_data = json . load ( fid ) if ( not self . orig_data_reader or isinstance ( self , self . orig_data_reader ) ) : return self . apply_units_to_cache ( json_data [ 'data' ] ) utc_mod_time = json_data . get ( 'utc_mod_time' ) orig_data_reader_obj = self . orig_data_reader ( self . parameters , self . meta ) if utc_mod_time : utc_mod_time = time . struct_time ( utc_mod_time ) orig_filename = filename [ : - 5 ] if utc_mod_time < time . gmtime ( os . path . getmtime ( orig_filename ) ) : os . remove ( filename ) return orig_data_reader_obj . load_data ( orig_filename ) return orig_data_reader_obj . apply_units_to_cache ( json_data [ 'data' ] )
Load JSON data.

        :param filename: name of JSON file with data
        :type filename: str
        :return: data
        :rtype: dict