# Re: Calculate sums for different biomes

From: Jiang, Lifen <lfjiang_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 25 2013 - 18:24:46 MDT

Dear Dave,

Thank you for the answer! I will try it.

Best,

Lifen

________________________________
From: David Brown [dbrown@ucar.edu]
Sent: Thursday, April 25, 2013 5:55 PM
To: Jiang, Lifen
Cc: ncl-talk
Subject: Re: Calculate sums for different biomes

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<mailto: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?

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 18:24:57 2013

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