Re: sptial distribution

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue, 25 Jul 2006 10:49:26 -0600

Hi Chao,

The fastest varying dimension in fortran is the leftmost dimension of
the array. In your case ilon... The fastest varying dimension in ncl is
the rightmost dimension... The fastest varying dimension maps to the
fastest varying dimension, so upon read-in into NCL, longitude should be
the rightmost dimension.

data = asciiread("./annl_avg_emi95.dat" \
                       , (/spe_nbr,lat_nbr,lon_nbr/),"float")

Adam

Chao Luo wrote:
> Hi Adam,
>
> Thanks for your detailed information. I changed the script. The min(so4)
> and max(so4) are still not correct. It seems the read data from asc file
> is not correct. The array in asc file is (72x46x48) write out by FORTRAN
> format: write(99,'(8e12.4)') (((data
> (ilon,jlat,kspe),ilon=1,72),jlat=1,46),kspe=1,48)
>
> The statement of :
> data = asciiread("./annl_avg_emi95.dat" \
> , (/lon_nbr,lat_nbr,spe_nbr/),"float")
> should read right thing?
>
> Thanks,
>
> Chao
>
>
> On Mon, 2006-07-24 at 17:33 -0600, Adam Phillips wrote:
>
>>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
>>
>
> _______________________________________________
> 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 Tue Jul 25 2006 - 10:49:26 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 28 2006 - 16:18:17 MDT