Skip to content

Commit

Permalink
not sure why logging is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
tcnichol committed Oct 4, 2023
1 parent f74f118 commit 555888e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions preview.pdg.asjp.netcdf/pdg.asjp.netcdf.extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@

# sample_file = 'ASJP_Year_2023_Day_218.nc4'

# setup logging for the exctractor
logging.getLogger('pyclowder').setLevel(logging.DEBUG)
logging.getLogger('__main__').setLevel(logging.DEBUG)
logger = logging.getLogger(__name__)

def generate_plots(current_filepath, current_filename, projection="Mercator"):
logger = logging.getLogger(__name__)
ds = Dataset(current_filepath)

variable_names = ds.variables.keys()
Expand Down Expand Up @@ -64,7 +61,8 @@ def generate_plots(current_filepath, current_filename, projection="Mercator"):

plt.clf()
except Exception as e:
print("Error with variable", variable_name)
logger.debug("Error with variable", variable_name)
logger.debug(e)


class PDG_ASJP_NetCDF(Extractor):
Expand All @@ -79,14 +77,24 @@ def __init__(self):
# parse command line and load default logging configuration
self.setup()

logging.basicConfig(level=logging.INFO)
# setup logging for the exctractor


logging.getLogger('pyclowder').setLevel(logging.DEBUG)
logging.getLogger('__main__').setLevel(logging.DEBUG)

def process_message(self, connector, host, secret_key, resource, parameters, projection="Polar Stereographic'"):
# Process the file and upload the results

logger = logging.getLogger(__name__)

inputfile = resource["local_paths"][0]
file_id = resource['id']
file_name = resource['name']
# These process messages will appear in the Clowder UI under Extractions.
connector.message_process(resource, "Loading contents of file...")
logger.debug("Preparing to generate plots")
generate_plots(current_filepath=inputfile, current_filename=file_name, projection='Polar Stereographic')

print('we generated plots!!')
Expand Down

0 comments on commit 555888e

Please sign in to comment.