示例#1
0
observations.append(ob30)
observations.append(ob31)
observations.append(ob32)
observations.append(ob33)
observations.append(ob34)
observations.append(ob35)
observations.append(ob36)
observations.append(ob37)
observations.append(ob38)
observations.append(ob39)
observations.append(ob40)
observations.append(ob41)
observations.append(ob42)

# Put the state class object and observation objects into EnSRF object
assimilator = EnSRF(statecls, observations, loc='GC')
print(assimilator)

# Update the prior with EFA- post_state is an EnsembleState object
post_state, post_obs = assimilator.update()

state = post_state
outfile = '/home/disk/hot/stangen/Documents/GEFS/posterior/' + \
            '2017090600/2017090600_21mem_10days_42MSLP_Z500_WC_efa.nc'
tunit = 'seconds since 1970-01-01'
# Write ensemble forecast to netcdf
with Dataset(outfile, 'w') as dset:
    dset.createDimension('time', None)
    dset.createDimension('lat', state.ny())
    dset.createDimension('lon', state.nx())
    dset.createDimension('ens', state.nmems())
示例#2
0
                        olons = np.array([o.lon for o in observations])
                        assert olat in olats
                        assert olon in olons
                        lons = state['lon'][0, :]
                        lats = state['lat'][:, 0]
                        o_ind = np.where(
                            (olats == olat) * (olons == olon))[0][0]
                        observations = [observations[o_ind]]
                        print(' Only assimilating the ob at {}N {}E'.format(
                            olat, olon))

                #==== ASSIMILATE THE OBS ======================================================
                    print('\n(3) Assimilating the observations...')
                    assimilator = EnSRF(state,
                                        observations,
                                        nproc=1,
                                        verbose=True,
                                        loc=localization,
                                        inflation=inflations)
                    start = time.time()
                    if plot_covs:
                        assert one_ob
                        covs, kal, mask = assimilator.update(return_covs=True,
                                                             cov_file=cov_file)

                        plot_covariances(lons,
                                         lats,
                                         covs,
                                         kal,
                                         mask,
                                         varlist,
                                         olat,