# Re: sptial distribution

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon, 24 Jul 2006 17:33:57 -0600

Hi Chao,

Just so you know, you don't need to do 2 do loops here:

do ilon=0,lon_nbr-1
do ilat=0,lat_nbr-1
so4(ilon,ilat)=data(ilon,ilat,34-1)*1.e9*0.0409*96. ;;;;ug SO4/m3
no3(ilon,ilat)=data(ilon,ilat,33-1)*1.e9*0.0409*62. ;;;;ug No3/m3
nh4(ilon,ilat)=data(ilon,ilat,32-1)*1.e9*0.0409*18. ;;;;ug nh4/m3

so2(ilon,ilat)=data(ilon,ilat,26-1)*1.e9*0.0409*64. ;;;;ug SO2/m3
hno3(ilon,ilat)=data(ilon,ilat,6-1)*1.e9*0.0409*63. ;;;;ug hno3/m3
nh3(ilon,ilat)=data(ilon,ilat,30-1)*1.e9*0.0409*17. ;;;;ug nh4/m3
end do
end do

should be

so4 = data(:,:,34-1)*1.e9*0.0409*96. ;;;;ug SO4/m3

and so on. You are also creating a new array complete with attributes
and coordinate variables by doing this:
so4 =data(:,:,33)

all of data's attributes and coordinate variables are being transferred
to so4..thus, so4 does not need to be preallocated, so you can remove
this line:
so4 =new((/lon_nbr,lat_nbr/),float)

1) if the min/max of so4 is not correct while the min/max of the other
arrays (no3,so2) are then it is likely that you didn't read the file in
correctly or that your calculation show in the lines above is not correct.

2) Re: the distribution. NCL expects you to pass arrays dimensioned
(lat,lon) into the *_map_* plotting functions (ex.
gsn_csm_contour_map_ce)... You are passing in arrays dimensioned
(lon,lat), and are likely getting errors related to this. You can fix
this by dimension reordering:
plot(0) = gsn_csm_contour_map_ce(wks_id,so2(lat|:,lon:),res1)

3) NCL will always show 1 color > than the max contour level and 1 color
< the min contour level. In your case set this for plot(0):
res1_at_cnMinLevelValF = 2.0 ; instead of 0
res1_at_cnMaxLevelValF = 18.0 ; instead of 20

Finally, latGlobeFo and lonGlobeFo set up your lat and longitude arrays
for you. You are overwriting them with:
lon = -177.5 + ispan(0,lon_nbr-1,1) * 5.
lat(0)=-89.0
lat(lat_nbr-1)=89.0
do ilat=1, lat_nbr-2
lat(ilat)=-86.00 + 4.*(ilat-1)
end do

Good luck,
Adam

Chao Luo wrote:
> Hi,
>
> I am try to make the contour plots by reading asc data of model
> simulation by previous ncl-talk suggestions. I set 3D variable to couple
> of 2D variable, and then plot the 2D variable. It seems there are 3
> types of errors. First, pint out min and max of so4 are not correct.
> Second, the distribution is not correct, and third one is that there are
> extra colors less than min and higher than max of levels.
> I attached script and plot here. Any help and suggestions are very
> appreciated!
>
> Chao
> http://dust.ess.uci.edu/chaoluo/temp/species_conc_8p_fig1.ncl
> http://dust.ess.uci.edu/chaoluo/temp/fig1.ps
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

--
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 24 2006 - 17:33:57 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 25 2006 - 08:57:03 MDT