# Re: Calculate sums for different biomes

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 25 2013 - 16:55:00 MDT

Use the where function.
Assuming types numbers range from 1 to n:

bc_density = new(dim sizes(c_density),typeof(c_density))
bc_sum = new(number_of_biome_types,typeof(c_density))
do i = 1, n
bc_density = where(biome_type_var .eq. i, c_density, bc_density@_FillValue) ; bc_density will be overwritten at each iteration of the loop
bc_sum(i) = wgt_areasum2, bc_density, wgts, 0)
end do

-dave

On Apr 25, 2013, at 4:36 PM, "Jiang, Lifen" <lfjiang@ou.edu> wrote:

> Dear NCL members,
>
> I have a challenging purpose in my case and am looking for help.
>
> I have two data files with same dimensions (lat and lon) and resolution. One is global carbon density with unit of kg/m2. The other is global biomes with several different values and each value stands a biome type, e.g. "1" refers to tropical forests.
>
> Now I need to calculate total carbon for each biome. Is there any way or examples to use NCL' wgt_areasum2 to obtain the sums of different biomes?
>
> I greatly appreciate your help!
>
> Best regards,
>
> Lifen
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 25 16:55:11 2013

This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:25 MDT