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

added option for dry run #322

Merged
merged 6 commits into from
Jul 20, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pep8ed
  • Loading branch information
doutriaux1 committed Apr 22, 2016
commit bc47b1bcfdd294da22c44c5a6c8992bb5867f364
28 changes: 14 additions & 14 deletions src/python/pcmdi/scripts/pcmdi_metrics_driver.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python
######################################################
#
#
# USER INPUT IS SET IN FILE "input_parameters.py"
# Identified via --parameters key at startup
#
######################################################
#
import pcmdi_metrics
import sys
import argparse
Expand All @@ -18,8 +18,8 @@
import collections
import cdat_info

## Statistical tracker
cdat_info.pingPCMDIdb("pcmdi_metrics","pcmdi_metrics_driver")
# Statistical tracker
cdat_info.pingPCMDIdb("pcmdi_metrics", "pcmdi_metrics_driver")

# Before we do anything else we need to create some units
# Salinity Units
Expand Down Expand Up @@ -77,7 +77,7 @@ def applyCustomKeys(O, custom_dict, var):
help="input parameter file containing local settings",
required=True)
P.add_argument(
"-d",
"-d",
"--dry-run",
action="store_true",
default=False,
Expand Down Expand Up @@ -460,9 +460,9 @@ def applyCustomKeys(O, custom_dict, var):
do.shape,
' ',
ref)
###################################################
#
# Basic checks
###################################################
#
if dm.shape != do.shape:
raise RuntimeError(
"Obs and Model -%s- have different" % model_version +
Expand All @@ -483,14 +483,14 @@ def applyCustomKeys(O, custom_dict, var):
"Could not convert model units (%s) " % dm.units +
"to obs units: (%s)" % (do.units))

###################################################
#
# OBS INFO FOR JSON/ASCII FILES
###################################################
#
onm = obs_dic[var][ref]

###################################################
#
# METRICS CALCULATIONS
###################################################
#
metrics_dictionary[model_version] = \
metrics_dictionary.get(
model_version,
Expand Down Expand Up @@ -581,12 +581,12 @@ def applyCustomKeys(O, custom_dict, var):
Var,
None,
None))
###################################################
#
# The follwoing allow users to plug in a set of
# custom metrics
# Function needs to take in var name,
# model clim, obs clim
###################################################
#
if hasattr(parameters, "compute_custom_metrics"):
pr_rgn.update(
parameters.compute_custom_metrics(
Expand Down Expand Up @@ -671,4 +671,4 @@ def applyCustomKeys(O, custom_dict, var):
except Exception as err:
dup("Error while processing variable %s:\n\t%s" % (var, err))

print "Done. Check log at: ",Efile.name
print "Done. Check log at: ", Efile.name