quicker approach?

From: MICHAEL NOTARO <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Sat, 14 Oct 2006 18:19:16 -0500

Does anyone know a quicker way to perform this task?
I perform the loop below on several variables and it takes
many hours.

I am working with two variables.

forest(0:67419,0:101) = forest cover for 67,420 land points over 102 years

tree(0:101,0:359,0:719) = forest cover on a 0.5x0.5 grid (all points, land
and ocean) for 102 years.

Note that latit(0:359) and longit(0:719) apply to "tree"
and lat(0:67419) and lon(0:67419) apply to "forest".

I computed forest cover over all land points and now want
to put those values ("forest") into the variable "tree"
which covers every global grid point. I initially set all "tree"
to zero and fill in the land points with "forest", leaving ocean
points as 0.

tree=new((/102,360,720/),float)
tree=0.
do ipt=0,67419
  tree(:,ind(latit.eq.lat(ipt)),ind(longit.eq.lon(ipt)))=forest(ipt,:)
end do

Any suggestions on how to speed this up? Preferably without wrapit
since I want to keep this script as a single file.

Hope this makes sense (:

Thanks, Michael
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Oct 14 2006 - 17:19:16 MDT

This archive was generated by hypermail 2.2.0 : Mon Oct 16 2006 - 22:16:12 MDT