Hi Mark,
I am not sure if you mean you want the counties to be labelled on the plot itself (hard) or just to print them within your script
(still not as easy as it should be). It requires that you consult the table for (in your case) the Earth..4 dataset.
From the table you can see that all the counties of OK have indexes between the entity for Oklahoma itself (Conterminous US : Oklahoma)
and Oregon (Conterminous US : Oregon).
Therefore once you have created the MapPlot you can do something like this:
plot = gsn_csm_map_ce(wks,res)
getvalues plot
"mpAreaNames" : anames
end getvalues
start_ix = ind(anames .eq. "Conterminous US : Oklahoma") + 1
end_ix = ind(anames .eq. "Conterminous US : Oregon") - 1
At this point you can print out the list of counties with a single print command:
print(anames(start_ix:end_ix))
However, since the mpAreaNames resource gives the minimum part of the fully-qualified name required to make the names unique,
some of the names will be just the county while others will have "Oklahoma : " prefixed to them.
A possible solution that would allow you to make them uniform (with or without the "Oklahoma" prefix) could go like this
str = new(2,string)
do i = start_ix, end_ix
; if there is no prefix the str_split routine will return a scalar that gets assigned to both elements of the variable str
str = str_split(anames(i)," :")
str(0) = "Oklahoma" ; make the first element uniformly "Oklahoma"
print("" + str(1)) ; print only the county name
end do
Hope this helps. It would be good if we had a resource that would return the fully-qualified name. Then you could do this without any a priori knowledge of the table.
-dave
On Mar 17, 2011, at 3:53 PM, Mark Chan wrote:
> NCL users,
>
> Is it any possible to print out the list of county name based on the attached
> script?
>
> Thanks a lot!
> Mark
>
>
>
> <CountyName.ncl>_______________________________________________
> 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 Thu Mar 17 18:51:03 2011
This archive was generated by hypermail 2.1.8 : Wed Mar 23 2011 - 16:15:59 MDT