Re: divergence calculations

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 25 2011 - 11:52:12 MDT

Thanks, Andrea.
What function can I use to compute divergence on a lat2d x lon2d grid though?

On Mar 25, 2011, at 11:08 AM, Andrea Hahmann wrote:

> Dear Michael
>
> I would compute the divergence on the 2d model grid (using the model's own
> discretization) from the vertically interpolated winds, then average in time
> and at the very end interpolate to the new 2d grid.
>
> Regards,
> Andrea
> --
>
> Andrea N. Hahmann
> Senior Scientist
> Wind Energy Division
> Risų DTU
>
> Technical University of Denmark
> Risų National Laboratory for Sustainable Energy
> Frederikborgvej 399, P.O. Box 49
> 4000 Roskilde, Denmark
>
> Direct +45 4677 5471
> Mobil: +45 2133 0550
> ahah@risoe.dtu.dk
> www.risoe.dtu.dk
>
>
>
>> From: Michael Notaro <mnotaro@wisc.edu>
>> Date: Fri, 25 Mar 2011 09:40:36 -0500
>> To: ncl-talk NCL <ncl-talk@ucar.edu>
>> Subject: divergence calculations
>>
>> 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
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 25 11:52:24 2011

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