Ejemplo n.º 1
0
        # Faz o acumulado da estação
        r = 31 * len(ntrimetres[i])
        data_all_aux = np.nansum(np.swapaxes(data_all_aux, 1, 2) \
                       .reshape(r, 20, nlat, nlon), axis=0)

        print(data_all_aux.shape)

        data_all = np.full((20, nlat, nlon), np.nan)

        for memb in range(20):
            data_all[memb, ...], lons = shiftgrid(180., data_all_aux[memb, ...],
            lons_aux, start=False)

        # pm.plotmap(data_all[0, 23:33, 45:54], lats[23:33], lons[45:54])
        # print(data_all[0, 23:33, 45:54].shape)
        # raw_input()

        y_season[a, :] = data_all[0, 23:33, 45:54]

    y_season = np.swapaxes(y_season, 0, 1)

    # Usado no hindcast
    fname = 'pcp-seasonacc-rsm97-2016-{0}-{1}.nc' \
        .format(fcst_month, tri.upper())
    writenc4(y_season, lats[23:33], lons[45:54], fname, itime,
        fcst_month, 11, 1981, 10, 9)
    fname = 'pcp-seasonacc-rsm97-2016-{0}-{1}' \
        .format(fcst_month, tri.upper())
    np.save(fname, y_season)
Ejemplo n.º 2
0
    # ano, membro, lat, lon
    y_season = np.full((itime, 20, 72, 109), np.nan)

    for a, y in enumerate(ltime):

        data_all, seaccum, monaccum, seamean, monmean, \
        lats, lons = post.PostModel(fcst_month, ntrimetres[i], y,
                                    model='RSM97')

        # Faz o acumulado da estação
        r = 31 * len(ntrimetres[i])
        data_all = np.nansum(np.swapaxes(data_all, 1, 2) \
                       .reshape(r, 20, nlat, nlon), axis=0)

        # data_all = np.full((20, nlat, nlon), np.nan)

        print(data_all.shape)

        y_season[a, :] = data_all

    y_season = np.swapaxes(y_season, 0, 1)

    # Usado no hindcast
    fname = 'pcp-seasonacc-rsm97-2016-{0}-{1}.nc' \
        .format(fcst_month, tri.upper())
    writenc4(y_season, lats, lons, fname, itime,
        fcst_month, 11, 2016, nlat, nlon)
    fname = 'pcp-seasonacc-rsm97-2016-{0}-{1}' \
        .format(fcst_month, tri.upper())
    np.save(fname, y_season)