Esempio n. 1
0
            trees['tpa'][-tn:] = fvs.arrays.prob[:tn]
            #trees['spp'][-tn:] = spp_codes[fvs.arrays.isp[:tn]]

            #print sum(trees[-tn:]['tpa']) - summary[run_id,cycle]['tpa']
            print('{:>6s}{:>5s}{:>5s}{:>10s}'.format('year','stop','spp','tpa'))
            print('{:>6d}{:>5d}{:>5s}{:>10.3f}'.format(trees[-tn:]['year'][0],trees[-tn:]['stop'][0],trees[-tn:]['spp'][0],sum(trees[-tn:]['tpa'])))
            print('{:>6d}{:>5d}{:>5s}{:>10.3f}'.format(trees[-tn:]['year'][0],trees[-tn:]['stop'][0],trees[-tn:]['spp'][-1],trees[-tn:]['tpa'][-1]))

#            ntrees,ncycles,nplots,maxtrees,maxspecies,maxplots,maxcycles = fvs.fvsdimsizes()
#            attrs = numpy.zeros(ntrees)
#            fvs.fvstreeattr('tpa',3,'get',attrs)
#
#            print sum(trees[-tn:]['tpa']) - summary[run_id,cycle]['tpa'], sum(attrs) - summary[run_id,cycle]['tpa']

        #close all IO files
        fvs.filclose()

#        print summary[:,:6]
#        print summary[cnt,:]
        print 'Rep: %-4d' % x, ','.join('%6d' % v for v in summary[run_id,:]['tcuft'])
        # print 'BDFT',','.join('%6d' % v for v in summary[:,5])

        # if plot:
            # pylab.plot(summary[:, 3])

        run_id += 1

et = time.clock()

#replace the overwritten tree data file
shutil.copy2('pnt01.tre.save','pnt01.tre')
Esempio n. 2
0
        cycle_year = year_zero

        # Initialize the FVS run
        fvs.fvs_step.fvs_init(kwd)

        # loop through growth cycles, collecting summary and tree stats
        for cycle in range(1, num_cycles + 1):

            # call the FVS grower loop
            fvs.fvs_step.fvs_grow()

            cycle_year += cycle_len

        # close all IO files
        fvs.fvs_step.fvs_end()
        fvs.filclose()

        run_id += 1

        #         rep_trees.append(
        #                 fvs_tables.trees_to_dataframe(
        #                         fvs.tree_data, spp_codes, stand_id=0, run_id=x
        #                         , year_zero=year_zero, cycle_len=cycle_len
        #                         ))
        #
        #         d = fvs.snag_data

        #     open('snags.csv', 'w').close()
        #     for cycle in range(num_cycles):
        #         snags = pandas.DataFrame({
        #                 'cycle':cycle