divergence calculations

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 25 2011 - 08:40:36 MDT

My calculated monthly mean 250-hPa divergence map
looks extremely noisy (see attached plots of divergence
and interpolated u wind).

I started with 6-hourly U and V on a regional model lat2d x lon2d
grid. I used int2p to interpolate U and V from sigma to 250 hPa.
Then I used rcm2rgrid to interpolate to a fixed grid. Then I used
uv2dv_cfd to compute 250 hPa divergence of these interpolated
wind components. Finally I averaged the divergences across
all time steps to get the monthly mean.

Any suggestions? I assume the interpolated wind components
are not the best, and so the derivates for divergence look messy.

Michael

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin

nlat=148
nlon=158

ctl=new((/8,148,158,10/),float)

months=(/"MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT"/)

yrs=(/"1991","1992","1993","1994","1995","1996","1997","1998","1999","2000"/)
yr=(/"91","92","93","94","95","96","97","98","99","00"/)
mns=(/"03","04","05","06","07","08","09","10"/)
hr=(/"06","00","00","00","00","00","00","00"/)
days=(/31,30,31,30,31,31,30,31/)

do iy=0,9
  do im=0,7
    print(iy+" "+im)
    if ( (yrs(iy)+""+mns(im).eq."199103").or.(yrs(iy)+""+mns(im).eq."199406") ) then
      a=addfile("../con9096/Southwest_ATM."+yrs(iy)+""+mns(im)+"0106.nc","r")
    else
      a=addfile("../con9096/Southwest_ATM."+yrs(iy)+""+mns(im)+"0100.nc","r")
    end if
    if ( (yrs(iy)+""+mns(im).eq."199103").or.(yrs(iy)+""+mns(im).eq."199406") ) then
      u=a->u(3::,:,:,:)
      v=a->v(3::,:,:,:)
      ps=a->ps(3::,:,:)
      time=a->time(3::)
    else
      if (mns(im).eq."03") then
        u=a->u(4::,:,:,:)
        v=a->v(4::,:,:,:)
        ps=a->ps(4::,:,:)
        time=a->time(4::)
      else
        u=a->u(:,:,:,:)
        v=a->v(:,:,:,:)
        ps=a->ps(:,:,:)
        time=a->time
      end if
    end if
    lat2d=a->xlat
    lon2d=a->xlon
    sigma=a->sigma
    ptop=a->ptop ; hPa
    nt=dimsizes(time)

    lat=fspan(min(lat2d),max(lat2d),148)
    lon=fspan(min(lon2d),max(lon2d),158)
    lat!0="lat"
    lat&lat=lat
    lat@units="degrees_north"
    lon!0="lon"
    lon&lon=lon
    lon@units="degrees_east"

    p=new((/nt,18,148,158/),float)
    do ilev=0,17
      p(:,ilev,:,:)=ps*sigma(ilev)
    end do
    copy_VarCoords(u,p)

    ulev=int2p(p(time|:,iy|:,jx|:,kz|:),u(time|:,iy|:,jx|:,kz|:),250.,1)
    vlev=int2p(p(time|:,iy|:,jx|:,kz|:),v(time|:,iy|:,jx|:,kz|:),250.,1)

    ulevel=ulev(:,:,:,0)
    vlevel=vlev(:,:,:,0)
    copy_VarCoords(ps,ulevel)
    copy_VarCoords(ps,vlevel)

    ugrid=rcm2rgrid(lat2d,lon2d,ulevel,lat,lon,0)
    vgrid=rcm2rgrid(lat2d,lon2d,vlevel,lat,lon,0)
    ugrid!0="time"
    ugrid!1="lat"
    ugrid!2="lon"
    ugrid&time=time
    ugrid&lat=lat
    ugrid&lon=lon
    copy_VarCoords(ugrid,vgrid)

    div=uv2dv_cfd (ugrid,vgrid,lat,lon,2)
    copy_VarCoords(ps,div)

    ctl(im,:,:,iy)=dim_avg_Wrap(div(iy|:,jx|:,time|:))

    out=addfile("out.nc","c")
    out->ctl=ctl(im,:,:,iy)
    out->ugrid=ugrid
    out->vgrid=vgrid

    delete(a)
    delete(time)
    delete(u)
    delete(v)
    delete(ps)
    delete(p)
    delete(ulev)
    delete(vlev)
    delete(ugrid)
    delete(vgrid)
    delete(div)

  end do
end do

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Screen_shot_2011-03-25_at_9.33.05_AM.png Screen_shot_2011-03-25_at_9.33.50_AM.png
Received on Fri Mar 25 08:40:49 2011

This archive was generated by hypermail 2.1.8 : Mon Mar 28 2011 - 08:51:50 MDT