Ejemplo n.º 1
0
def create_monsoon_wang_parser():
    P = PMPParser()

    P.use("--modnames")
    P.use("--results_dir")
    P.use("--reference_data_path")
    P.use("--test_data_path")

    P.add_argument(
        "--outnj",
        "--outnamejson",
        type=str,
        dest="outnamejson",
        default="monsoon_wang.json",
        help="Output path for jsons",
    )
    P.add_argument(
        "-e",
        "--experiment",
        type=str,
        dest="experiment",
        default="historical",
        help="AMIP, historical or picontrol",
    )
    P.add_argument("-c",
                   "--MIP",
                   type=str,
                   dest="mip",
                   default="CMIP5",
                   help="put options here")
    P.add_argument("--ovar",
                   dest="obsvar",
                   default="pr",
                   help="Name of variable in obs file")
    P.add_argument(
        "-v",
        "--var",
        dest="modvar",
        default="pr",
        help="Name of variable in model files",
    )
    P.add_argument(
        "-t",
        "--threshold",
        default=2.5 / 86400.0,
        type=float,
        help="Threshold for a hit when computing skill score",
    )
    P.add_argument(
        "--cmec",
        dest="cmec",
        default=False,
        action="store_true",
        help="Use to save CMEC format metrics JSON",
    )
    P.add_argument(
        "--no_cmec",
        dest="cmec",
        default=False,
        action="store_false",
        help="Do not save CMEC format metrics JSON",
    )
    P.set_defaults(cmec=False)
    return P
# created an env using:

# RUN EXAMPLE
# conda create -n pmp_01_08_2018 pcmdi_metrics -c conda-forge -c pcmdi -c uvcdat -c uvcdat/label/v210
# > python using_Param_With_CDP_Without_CIAjson.py -p test_paramfile.py

# PJG & ZS 1/17/18

from pcmdi_metrics.pcmdi.pmp_parser import PMPParser

P = PMPParser()

params = P.get_parameter()

print params.modnames
print params.modpath
 
Ejemplo n.º 3
0
def create_monsoon_wang_parser():
    P = PMPParser()

    P.use("--modnames")
    P.use("--results_dir")
    P.use("--reference_data_path")
    P.use("--test_data_path")

    P.add_argument("--outnj", "--outnamejson",
                   type=str,
                   dest='outnamejson',
                   default='monsoon_wang.json',
                   help="Output path for jsons")
    P.add_argument("-e", "--experiment",
                   type=str,
                   dest='experiment',
                   default='historical',
                   help="AMIP, historical or picontrol")
    P.add_argument("-c", "--MIP",
                   type=str,
                   dest='mip',
                   default='CMIP5',
                   help="put options here")
    P.add_argument("--ovar",
                   dest='obsvar',
                   default='pr',
                   help="Name of variable in obs file")
    P.add_argument("-v", "--var",
                   dest='modvar',
                   default='pr',
                   help="Name of variable in model files")
    P.add_argument("-t", "--threshold",
                   default=2.5 / 86400.,
                   type=float,
                   help="Threshold for a hit when computing skill score")

    return P
Ejemplo n.º 4
0
def create_monsoon_wang_parser():
    P = PMPParser()

    P.use("--modpath")
    P.use("--modnames")
    P.use("--results_dir")
    P.use("--reference_data_path")

    P.add_argument("--outpj", "--outpathjsons",
                   type=str,
                   dest='outpathjsons',
                   default='.',
                   help="Output path for jsons")
    P.add_argument("--outnj", "--outnamejson",
                   type=str,
                   dest='jsonname',
                   default='out.json',
                   help="Output path for jsons")
    P.add_argument("-e", "--experiment",
                   type=str,
                   dest='experiment',
                   default='historical',
                   help="AMIP, historical or picontrol")
    P.add_argument("-c", "--MIP",
                   type=str,
                   dest='mip',
                   default='CMIP5',
                   help="put options here")
    P.add_argument("--ovar",
                   dest='obsvar',
                   default='pr',
                   help="Name of variable in obs file")
    P.add_argument("-v", "--var",
                   dest='modvar',
                   default='pr',
                   help="Name of variable in model files")
    P.add_argument("-t", "--threshold",
                   default=2.5 / 86400.,
                   type=float,
                   help="Threshold for a hit when computing skill score")
    return P
Ejemplo n.º 5
0
import glob

###########
# SAMPLE COMMAND LINE EXECUTION USING ARGUMENTS BELOW
# python -i mpi_compute.py -mp
# /work/gleckler1/processed_data/cmip5clims_metrics_package-historical/pr_MODS_Amon_historical_r1i1p1_198001-200512-clim.nc
# -op
# /work/gleckler1/processed_data/obs/atm/mo/pr/GPCP/ac/pr_GPCP_000001-000012_ac.nc
# --mns "['NorESM1-ME','MRI-CGCM3']" --outpd
# /work/gleckler1/processed_data/wang_monsoon --outpj
# /work/gleckler1/processed_data/metrics_package/metrics_results/wang_monsoon

##########


P = PMPParser()

P.add_argument("--mp", "--modpath",
               type=str,
               dest='modpath',
               default='',
               help="Explicit path to model monthly PR climatology")
P.add_argument("--op", "--obspath",
               type=str,
               dest='obspath',
               default='',
               help="Explicit path to obs monthly PR climatology")
P.add_argument("--outpj", "--outpathjsons",
               type=str,
               dest='outpathjsons',
               default='.',
Ejemplo n.º 6
0
import matplotlib.pyplot as plt
import MV2
import os
import pcmdi_metrics
import sys

from collections import defaultdict
from lib_psd import *
from lib_psd_plot import plot_psd
from pcmdi_metrics.pcmdi.pmp_parser import PMPParser

#------------------------------------------------------------
# Read from "my_Param.py"
# How to run: python run_psd_loop.py -p my_Param.py
#------------------------------------------------------------
P = PMPParser() # Includes all default options
param = P.get_parameter()

modes = param.modes
PlotOn_xlog = param.PlotOn_xlog
PlotOn_xlinear = param.PlotOn_xlinear
NormalizePCts = param.NormalizePCts
outdir = param.outdir
TaperingRatio = param.TaperingRatio
SegmentLengthRatio = param.SegmentLengthRatio
SegmentOverlapping = param.SegmentOverlapping
debug = param.debug # if debug=True, run only for obs, not models
#------------------------------------------------------------

for mode in modes:
Ejemplo n.º 7
0
import MV2 as MV
import glob
import cdutil
import cdtime
import genutil
import numpy as np
from regrid2 import Regridder
from scipy import signal
from scipy.stats import chi2
import scipy.interpolate as interp
import pandas as pd
import math
import os
from pcmdi_metrics.pcmdi.pmp_parser import PMPParser

P = PMPParser()

P.add_argument("--mip",
               type=str,
               dest='mip',
               default=None,
               help="cmip5, cmip6 or other mip")

P.add_argument("--var",
               type=str,
               dest='var',
               default=None,
               help="pr or other variable")

P.add_argument("--dir",
               type=str,