Пример #1
0
def param(argv):

    for k in argv.keys():
        if k in ['main', "_keyorder"]:
            continue  # private keys

        if k not in authorized_keys:
            raise Exception('option %s is not recognized' % k)

    if "-op" not in argv.keys():
        assert not os.path.exists('_HerrMet.param')

    nlayer = int(argv["main"][0])
    zbot = float(argv["main"][1])
    type = argv['-t'][0] if "t" in argv.keys() else default_parameterization
    basedon = argv['-basedon'][0] if "-basedon" in argv.keys() else None
    if "-growing" in argv.keys():
        assert "-dvs" not in argv.keys()  # not compatible with -growing
        assert "-dvp" not in argv.keys()  # not compatible with -growing
        assert "-drh" not in argv.keys()  # not compatible with -growing
        assert "-dpr" not in argv.keys()  # not compatible with -growing
        dvp = 0., 5.
        dvs = 0., 5.
        drh = 0., 5.
        dpr = -5., 0.
    else:
        dvp = minmax(np.asarray(argv['-dvp'],
                                float)) if "-dvp" in argv.keys() else None
        dvs = minmax(np.asarray(argv['-dvs'],
                                float)) if "-dvs" in argv.keys() else None
        drh = minmax(np.asarray(argv['-drh'],
                                float)) if "-drh" in argv.keys() else None
        dpr = minmax(np.asarray(argv['-dpr'],
                                float)) if "-dpr" in argv.keys() else None

    if not type in default_parameterization_list:
        raise Exception('please pick one type in %s' %
                        str(default_parameterization_list))
    write_default_paramfile(nlayer,
                            zbot,
                            type=type,
                            basedon=basedon,
                            dvp=dvp,
                            dvs=dvs,
                            drh=drh,
                            dpr=dpr)
    print "please customize _HerrMet.param, do not change line orders and metadata"
    print "use option --display to see the depth boundaries"
Пример #2
0
def param(argv):

    if '-h' in argv.keys() or "-help" in argv.keys():
        print(long_help)
        return

    for k in argv.keys():
        if k in ['main', "_keyorder"]:
            continue  # private keys

        if k not in authorized_keys:
            raise Exception('option %s is not recognized' % k)

    if "-op" not in argv.keys():
        if os.path.exists(HERRMETPARAMFILELOCAL):
            raise IOError(HERRMETPARAMFILELOCAL +
                          ' exists already, use -op to overwrite')

    nlayer = int(argv["main"][0])
    zbot = float(argv["main"][1])
    type = argv['-t'][0] if "-t" in argv.keys() else default_parameterization
    basedon = argv['-basedon'][0] if "-basedon" in argv.keys() else None
    if "-growing" in argv.keys():
        assert "-dvs" not in argv.keys()  # not compatible with -growing
        assert "-dvp" not in argv.keys()  # not compatible with -growing
        assert "-drh" not in argv.keys()  # not compatible with -growing
        assert "-dpr" not in argv.keys()  # not compatible with -growing
        dvp = 0., 5.
        dvs = 0., 5.
        drh = 0., 5.
        dpr = -5., 0.
    else:
        dvp = minmax(np.asarray(argv['-dvp'],
                                float)) if "-dvp" in argv.keys() else None
        dvs = minmax(np.asarray(argv['-dvs'],
                                float)) if "-dvs" in argv.keys() else None
        drh = minmax(np.asarray(argv['-drh'],
                                float)) if "-drh" in argv.keys() else None
        dpr = minmax(np.asarray(argv['-dpr'],
                                float)) if "-dpr" in argv.keys() else None

    if not type in default_parameterization_list:
        raise Exception('please pick one type in %s' %
                        str(default_parameterization_list))

    write_default_paramfile(nlayer,
                            zbot,
                            which_parameterizer=type,
                            basedon=basedon,
                            dvp=dvp,
                            dvs=dvs,
                            drh=drh,
                            dpr=dpr)

    print("you can edit {} to adjust parameters boundaries, "
          "do not change line orders".format(HERRMETPARAMFILELOCAL))
    print(
        "use option --display to see the depth boundaries of your parameter file"
    )
    print(
        "use option --send to copy the parameter file to each temporary directory"
    )
Пример #3
0
            ax3 = fig1.add_subplot(224, sharex=ax2, sharey=ax1)
            ax3.set_title('%s%s%d' % (w, t, m))

            # M = np.sign(M) * np.abs(M) ** 0.6
            coll = plt.pcolormesh(1. / _F_,
                                  _depth_,
                                  M,
                                  vmin=vmin,
                                  vmax=vmax,
                                  cmap=cmap)

            cax = fig1.add_axes((.91, .2, .01, .2))
            plt.colorbar(coll, cax=cax)

            ax3.set_xlabel('period (s)')
            ax3.set_xlim(minmax(1. / _F_))
            ax3.set_ylim(minmax(_depth_))
            ax3.set_xscale('log')

            if norm:
                textonly(ax3,
                         txt=r'$ \frac{1}{H_i} \, \frac{d ln%s_j}{d %s} $' %
                         (t, p),
                         loc=3,
                         fontsize=16)
            else:
                textonly(ax3,
                         txt=r'$ \frac{d ln%s_j}{d %s} $' % (t, p),
                         loc=3,
                         fontsize=16)
Пример #4
0
                                  z_edges,
                                  M,
                                  vmin=vmin,
                                  vmax=vmax,
                                  cmap=cmap)

            if M.max() - M.min():
                levels = np.logspace(-1., 2, 10)
                levels = np.hstack((-levels[::-1], [0], levels))
                plt.contour(1. / F, z_mid, M, levels=levels, colors="k")

            cax = fig1.add_axes((.91, .2, .01, .2))
            plt.colorbar(coll, cax=cax)

            ax3.set_xlabel('period (s)')
            ax3.set_xlim(minmax(1. / F_edges))
            ax3.set_ylim(minmax(z_edges))
            ax3.set_xscale('log')

            if norm:
                textonly(ax3,
                         txt=r'$ \frac{H}{H_i} \, \frac{d ln%s_j}{d %s} $' %
                         (t, p),
                         loc=3,
                         fontsize=16)
            else:
                textonly(ax3,
                         txt=r'$ \frac{d ln%s_j}{d %s} $' % (t, p),
                         loc=3,
                         fontsize=16)