Re: Masking a map correctly with a black background

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 8 May 2009 09:27:10 -0600 (MDT)


Horrors on my part. I spent a bit of time convincing myself yesterday
that the default map database didn't have ice shelves, and now that
I've apparently rebooted my brain, I do see them. Grrrr.

I'm not sure what I did yesterday, because I know I generated maps
that contained solid gray fill where there should have been ice

Well, mystery aside, these ice shelves that you are seeing in black
(once you swap the foreground/background colors) is due to the fact
that they are considered part of the ocean in the default map
database. There's no way to single them out to color them in white.

So, we're back to having to use the "Earth..4" database if you want to
color those ice shelves individually. You need to have V5.1.0 in order
to get these shelves.

Please see the attached script (and image), which is taken from your
last script, with your original color map added back in.

I'm sorry about the go around on this. Now I'll probably spend another
hour trying to prove I didn't imagine things yesterday. :-)


On Thu, 7 May 2009, Mark Branson wrote:

> Well, I think I understand what's going on in the sample codes and pngs you
> sent, but I'm still confused as to how to solve my problem. So I've trimmed
> my code down to the bare essentials, and to avoid any possible confusion that
> my custom color scheme (with the blues going to white) might be injecting
> into the mix I'm just using the "cosam" predefined color table for now. Then
> with this code I created three different test plots:
> - The code as it is displayed below (i.e., gray is not being
> added to the end of the color table, and I'm not changing the background and
> foreground colors). What I see in my postscript viewer is white continents
> with the color fill of the ice area data.
> - uncomment out the line "i = NhlNewColor(wks,0.8,0.8,0.8)". Now
> the continents are gray, but the inland lakes and what I call the Antarctic
> ice shelve areas are still white.
> - now also uncomment out the setvalues block to change the
> foreground and background colors. This plot looks identical to
> except that now the inland lakes and ice shelves area black.
> I hope it's okay to attach postscript files to this message. I was going to
> convert them to png with imagemagick and send those but that actually makes
> them look slightly different than the ps files on my machine (Mac Powerpc
> desktop).
> And below is the actual code.
> Thanks!
> Mark
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> b = addfile("/Volumes/xraid3/endworld/ice/",
> "r")
> data = b->aice
> lat2d = b->TLAT
> lon2d = b->TLON
> data_at_lon2d = lon2d
> data_at_lat2d = lat2d
> outfile = "icearea1"
> wks = gsn_open_wks("ps",outfile) ; open a postscript file
> gsn_define_colormap(wks,"cosam")
> ;i = NhlNewColor(wks,0.8,0.8,0.8) ; add gray to colormap
> res = True
> ;setvalues wks
> ; "wkBackgroundColor" : (/0.,0.,0./)
> ; "wkForegroundColor" : (/1.,1.,1./)
> ;end setvalues
> res_at_cnFillOn = True ; Fill contours
> res_at_cnLinesOn = False
> res_at_cnLineLabelsOn = False
> res_at_gsnAddCyclic = True
> res_at_mpOutlineOn = False
> res_at_gsnRightString = "percent"
> res_at_gsnLeftString = "July Year 11"
> res_at_tiMainString = "Sea Ice Area"
> res_at_tmXBTickSpacingF = 60. ; every 60 degrees
> plot = gsn_csm_contour_map(wks,data(0,:,:),res)
> end

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:

Received on Fri May 08 2009 - 09:27:10 MDT

This archive was generated by hypermail 2.2.0 : Fri May 08 2009 - 10:05:07 MDT