Re: fill color map in different counties

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Sat Mar 09 2013 - 17:53:57 MST

CL,

You need to define fill_colors as an array, and also move the plot
command outside of the loop. So change the loop to this (untested):

  fill_colors = new (159, integer) ; create an empty array

  do i = 0, 158 ;;; county number
    if (emis(i,6).ge.0.and.emis(i,6).lt.10.) then
      fill_colors(i) = 10
    end if
    if (emis(i,6).ge.10.and.emis(i,6).lt.20.) then
      fill_colors(i) = 20
    end if
    if (emis(i,6).ge.20.and.emis(i,6).lt.50.) then
      fill_colors(i) = 30
    end if
    if (emis(i,6).ge.50.and.emis(i,6).lt.100.) then
      fill_colors(i) = 40
    end if
  end do

Remove the subscripting (i) from two of the following commands, and
delete the final "end do" which has moved up. So the end of the
program should look like this:

  mpres@mpFillAreaSpecifiers = "Georgia . " + georgia_counties
  mpres@mpSpecifiedFillColors = fill_colors
  mpres@mpOutlineSpecifiers = "Georgia . " + georgia_counties
  map = gsn_csm_map(wks,mpres)
end

--Dave
(Please reply to list only!)

On Sat, Mar 9, 2013 at 4:07 PM, Luo, Chao <chao.luo@eas.gatech.edu> wrote:
> Hello,
>
> I am working on the plot by filling the different colors (different emission
> levels) in different counties by NCL script. Now I am able to fill the
> different colors in different counties. The problem is that when loop the
> counties, the script open new map page (one county one page). I want to fill
> all counties on one map page, and try "overlay" function, it doesn't work. I
> am pasting the script I used here, any suggestions or help are very
> appreciated!
>
> Thanks,
>
> cl
>
> ------------------------
> 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"
>
> begin
> wks = gsn_open_wks("ps","maponly")
> gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
> mpres = True
> ; mpres@gsnMaximize = True
> mpres@mpFillOn = True
> mpres@mpOutlineOn = True
> ;
> ; These next three resources set up the drawing of county boundaries.
> ;
> mpres@mpOutlineBoundarySets = "AllBoundaries"
> mpres@mpDataBaseVersion = "Ncarg4_1"
> mpres@mpDataSetName = "Earth..2"
>
> mpres@mpGridAndLimbOn = False
> ; mpres@mpPerimOn = True
> mpres@mpLimitMode = "LatLon" georgia_counties = \
> (/"Appling", "Atkinson", "Bacon", "Baker", "Baldwin", "Banks",
> "Barrow", \
> "Bartow", "Ben Hill", "Berrien", "Bibb", "Bleckley",
> "Brantley", "Brooks",\
> "Bryan", "Bulloch", "Burke", "Butts", "Calhoun", "Camden", \
> "Candler", "Carroll", "Catoosa", "Charlton", "Chatham",
> "Chattahoochee", \
> "Chattooga", "Cherokee", "Clarke", "Clay", "Clayton",
> "Clinch","Cobb", \
> "Coffee", "Colquitt", "Columbia", "Cook", "Coweta", \
> "Crawford", "Crisp", "Dade", "Dawson", "Decatur", "DeKalb",
> "Dodge", \
> "Dooly", "Dougherty", "Douglas", "Early", "Echols",
> "Effingham", "Elbert", \
> "Emanuel", "Evans", "Fannin", "Fayette","Floyd", "Forsyth", \
> "Franklin", "Fulton", "Gilmer", "Glascock", "Glynn", "Gordon",
> "Grady", \
> "Greene", "Gwinnett", "Habersham", "Hall", "Hancock",
> "Haralson", \
> "Harris", "Hart", "Heard", "Henry", "Houston", "Irwin", \
> "Jackson", "Jasper", "Jeff Davis", "Jefferson", "Jenkins",
> "Johnson", \
> "Jones", "Lamar", "Lanier", "Laurens", "Lee", "Liberty",
> "Lincoln", \
> "Long", "Lowndes", "Lumpkin", "Macon", "Madison", "Marion", \
> "McDuffie", "McIntosh", "Meriwether", "Miller", "Mitchell",
> "Monroe", \
> "Montgomery", "Morgan", "Murray", "Muscogee", "Newton",
> "Oconee", \
> "Oglethorpe", "Paulding", "Peach", "Pickens", "Pierce", "Pike",
> \
> "Polk", "Pulaski", "Putnam", "Quitman", "Rabun", "Randolph",
> "Richmond", \
> "Rockdale", "Schley", "Screven", "Seminole", "Spalding",
> "Stephens", "Stewart", \
> "Sumter", "Talbot", "Taliaferro", "Tattnall", "Taylor",
> "Telfair", "Terrell", \
> "Thomas", "Tift", "Toombs", "Towns", "Treutlen", "Troup",
> "Turner", \
> "Twiggs", "Union", "Upson", "Walker", "Walton", "Ware",
> "Warren", "Washington", \
> "Wayne", "Webster","Wheeler", "White", "Whitfield", "Wilcox",
> "Wilkes", \
> "Wilkinson", "Worth" /)
>
> ; read emis data
> emis = asciiread("BBEP_159x7.dat" , (/159,7/),"float")
> emis = emis/31./24.
> mpres@mpOutlineBoundarySets = "GeophysicalAndUSStates"
> mpres@mpMinLatF = 30.5
> mpres@mpMaxLatF = 35.2
> mpres@mpMinLonF = -85.8
> mpres@mpMaxLonF = -81.
>
> do i = 0, 158 ;;; county number
> if (emis(i,6).ge.0.and.emis(i,6).lt.10.) then
> fill_colors = 10
> end if
> if (emis(i,6).ge.10.and.emis(i,6).lt.20.) then
> fill_colors = 20
> end if
> if (emis(i,6).ge.20.and.emis(i,6).lt.50.) then
> fill_colors = 30
> end if
> if (emis(i,6).ge.50.and.emis(i,6).lt.100.) then
> fill_colors = 40
> end if
> mpres@mpFillAreaSpecifiers = "Georgia . " + georgia_counties(i)
> mpres@mpSpecifiedFillColors = fill_colors
> mpres@mpOutlineSpecifiers = "Georgia . " + georgia_counties(i)
> map = gsn_csm_map(wks,mpres)
> end do
> end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Mar 9 15:54:08 2013

This archive was generated by hypermail 2.1.8 : Wed Mar 13 2013 - 14:19:38 MDT