help with surface area calculation

From: Osen, Angela <angela.osen_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 09 2012 - 18:30:41 MST

Hello,

I am working with the latest version of NCL and I am not a computer programmer by profession, so you will have to excuse my non-professional terminology.

Can you tell me if there is a way to (or a program that is available) compute the surface area? What I have is a program which creates a variable based on the criteria set in a series of if statements. I would like to be able to compute the surface area that the variable covers. I am including a copy of the if statements used to create the new variable(rmask) below:

ocn = addfile(file_loc+localfile,"r")
temp = ocn->TEMP(0,lev,:,:) ; (0,lev,lat2d,lon2d)
salt = ocn->SALT(0,lev,:,:)
wvel = ocn->WVEL(0,1,:,:)
tlat = ocn->TLAT
tlon = ocn->TLONG
rmask = ocn->REGION_MASK(:,:)
tarea = ocn->TAREA ; added 2-29-12 AO
tarea = tarea*0.0001

dims = dimsizes(tlat)
nlat = dims(0)
nlon = dims(1)

temp@lat2d = tlat
temp@lat2d = tlon
salt@lat2d = tlat
salt@lon2d = tlon

do nlt = 0,nlat-1
do nln = 0,nlon-1
 if(.not.ismissing(temp(nlt,nln)).and.temp(nlt,nln).le.-1.8) then
  rmask(nlt,nln) = 1
  else if(.not.ismissing(temp(nlt,nln)).and.temp(nlt,nln).gt.-1.8.and.temp(nlt,nln).le.0.) then
   rmask(nlt,nln) = 2
  else if(.not.ismissing(temp(nlt,nln)).and.temp(nlt,nln).gt.0.and.temp(nlt,nln).lt.20.and.salt(nlt,nln).lt.32) then
   rmask(nlt,nln) = 3
  else if(.not.ismissing(temp(nlt,nln)).and.temp(nlt,nln).gt.0.and.temp(nlt,nln).lt.20.and.salt(nlt,nln).ge.32.and.salt(nlt,nln).lt.37) then
   rmask(nlt,nln) = 4
; else if(.not.ismissing(wvel(nlt,nln)).and.wvel(nlt,nln).ge.0.01) then
 ; rmask(nlt,nln) = 5 ;NOTE: this is not working, need to take down a level
  else if(.not.ismissing(salt(nlt,nln)).and.salt(nlt,nln).ge.37.) then
   rmask(nlt,nln) = 6
  else if(.not.ismissing(temp(nlt,nln)).and.temp(nlt,nln).ge.20.and.salt(nlt,nln).ge.32.and.salt(nlt,nln).lt.37) then
   rmask(nlt,nln) = 7
  else if(.not.ismissing(temp(nlt,nln)).and.temp(nlt,nln).ge.20.and.salt(nlt,nln).lt.32) then
   rmask(nlt,nln) = 8
    else
     rmask(nlt,nln) = 9
 end if
  end if
   end if
  ; end if
     end if
      end if
       end if
        end if
end do
end do

Thank you in advance for any assistance you can render,

Angie

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 9 15:30:57 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 13 2012 - 14:00:14 MDT