Re: Masking a map correctly with a black background

From: Mark Branson <mark_at_nyahnyahspammersnyahnyah>
Date: Fri, 8 May 2009 13:56:48 -0600

Hi Mary.

Many thanks for coming up with this solution, and sorry for causing
you such grief with the ice shelves. I may just stick with the
original map database because I'm not crazy about all of the small
islands showing up as little white dots now, but I may let our end
user make the final call on that.

One final question: What font do you have set up on your end? The
labels on this latest png file you sent me look a million times better
than what I have. I have *Font : helvetica set in my .hluresfile.

Thanks again for all your hard work on this. It is very much
appreciated!
Mark

>
> Mark,
>
> 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
> shelves.
>
> 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. :-)
>
> --Mary
>
>
> 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:
>>
>> icearea1.ps - 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.
>>
>> icearea2.ps - 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.
>>
>> icearea3.ps - now also uncomment out the setvalues block to change
>> the foreground and background colors. This plot looks identical to
>> icearea2.ps 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/endworld3.csim.h.
>> 0011-07.nc", "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
>>
> <icearea_m.png><icearea_m.ncl>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 08 2009 - 13:56:48 MDT

This archive was generated by hypermail 2.2.0 : Mon May 11 2009 - 09:43:46 MDT