Пример #1
0
    for profile_id, profile_name in enumerate(profile_names):

        fig = plt.figure()
        ax = fig.add_subplot(111)

        profile_axis = nc.variables['profile'][profile_id]
        profile_axis_units = nc.variables['profile'].units
        profile_axis_name = nc.variables['profile'].long_name

        profile_axis_out_units = 'km'
        profile_axis = np.squeeze(
            unit_converter(profile_axis[:], profile_axis_units, profile_axis_out_units))

        my_var = nc.variables[varname]
        my_var_units = my_var.units
        my_var_p = permute(my_var, output_order=output_order)
        data = np.squeeze(my_var_p[profile_id, 0, Ellipsis])
        data = unit_converter(data, my_var_units, o_units)

        # stuff needed for masking
        z = np.squeeze(nc.variables['z'][:])
        b = np.squeeze(nc.variables['topg'][:])
        s = np.squeeze(nc.variables['usurf'][:])
        ss = np.tile(s, [len(z), 1])

        x = profile_axis
        xx = np.squeeze(np.tile(x, [len(z), 1])).transpose()
        zz = np.squeeze((np.tile(z, [len(x), 1])).transpose() + b)

        mask = zz > ss
        data_ma = np.ma.array(data=data, mask=mask)
Пример #2
0
        ylabel = ("relative flotation [%s]" % var_units_str)
    elif var in ("taud", "taud_mag", "taud_x", "taud_y", "bwp", "tauc"):
        out_units = "Pa"
        var_units_str = "Pa"
        ylabel = ("pressure [%s]" % var_units_str)
    elif var in ("csurf", "cbase", "cbar", "velsurf_mag", "velsurf_base"):
        out_units = "m year-1"
        var_units_str = "m a$^{-1}$"
        ylabel = ("speed [%s]" % var_units_str)
    else:
        print("unit %s not recognized" % var_units)
    var_ylabels.append(ylabel)

    try:
        var_vals = unit_converter(
            np.squeeze(permute(nc.variables[var],
                               output_order=output_order)), var_units, out_units)
    except:
        var_vals = unit_converter(
            np.squeeze(permute(nc.variables[var],
                               output_order=output_order_cdo)), var_units, out_units)
    if normalize:
        var_vals -= var_vals[0]

    var_values.append(var_vals)

    nc.close()


aspect_ratio = golden_mean

# set the print mode
Пример #3
0
        var_units_str = "-"
        ylabel = ("relative flotation [%s]" % var_units_str)
    elif var in ("taud", "taud_mag", "taud_x", "taud_y", "bwp", "tauc"):
        out_units = "Pa"
        var_units_str = "Pa"
        ylabel = ("pressure [%s]" % var_units_str)
    elif var in ("csurf", "cbase", "cbar"):
        out_units = "m year-1"
        var_units_str = "m a$^{-1}$"
        ylabel = ("speed [%s]" % var_units_str)
    else:
        print("unit %s not recognized" % var_units)
    var_ylabels.append(ylabel)
    var_units_strings.append(var_units_str)
    try:
        var_vals = unit_converter(np.squeeze(permute(nc.variables[var],
                                                     output_order=output_order)), var_units, out_units)
    except:
        var_vals = unit_converter(np.squeeze(permute(nc.variables[var],
                                                     output_order=output_order_cdo)), var_units, out_units)
    if normalize:
        var_vals -= var_vals[0]

    var_values.append(var_vals)

nc.close()

try:
    no_profiles = len(var_values[0][:, 0])
except:
    no_profiles = 1