Re: gsn_csm_contour_map_overlay

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 1 Oct 2008 09:07:52 -0600 (MDT)

Hi Wolfgang,

As long as the data you are overlaying has coordinate arrays that define
where on the base plot to over it, you can overlay several fields
using the "overlay" procedure.

See example 1 at:

   http://www.ncl.ucar.edu/Applications/conOncon.shtml

This can be applied to multiple plots (you are not limited to one).

You can still use gsn_csm_contour_map_overlay in your case. This
will become your base plot (since it's the one with the map),
and then just use gsn_csm_contour to generate the contours of
your field height:

    ...
    res1 = True
    res2 = True
    res1_at_gsnDraw = False ; Turn off draw and frame,
    res1_at_gsnFrame = False ; because we want to do
    res2_at_gsnDraw = False ; overlay first.
    res2_at_gsnFrame = False
    ...
    plot = gsn_csm_contour_map_overlay(wks,data1,data2,res1,res2)
    ...
    res3 = True
    res3_at_gsnDraw = False
    res3_at_gsnFrame = False
    ...
    ter = gsn_csm_cntour(wks,hgt,res3)

    overlay(plot,ter)
    draw(plot)
    frame(wks)

Note that data1, data2, and hgt should all have lat/lon coordinate
arrays, in order to be properly overlaid, *unless* your data is
already projected in some map projection. In this case, then, you
must know the exact map projection, and be sure to set
tfDoNDCOverlay = True for all resource lists.

--Mary

On Wed, 1 Oct 2008, Wolfgang Langhans wrote:

> Hi,
> is it possible to overlay more than two fiels? I produce maps of
> humidity+geopotential with gsn_csm_contour_map_overlay, but I'd like to add
> also the field of the terrain height. How can I manage this?
> Thanks in advance!
> Wolfgang
>
>
>
> ncl-talk-request_at_ucar.edu wrote:
>> Send ncl-talk mailing list submissions to
>> ncl-talk_at_ucar.edu
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> or, via email, send a message with subject or body 'help' to
>> ncl-talk-request_at_ucar.edu
>>
>> You can reach the person managing the list at
>> ncl-talk-owner_at_ucar.edu
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of ncl-talk digest..."
>>
>>
>> Today's Topics:
>>
>> 1. HDFEOS_v2.5 swath (Chiara Antoniazzi)
>> 2. Re: HDFEOS_v2.5 swath (David Brown)
>> 3. Re: log axis using gsn_csm_contour (Mary Haley)
>> 4. Re: contouring weirdness with FillValues (Mary Haley)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 29 Sep 2008 10:55:59 -0700
>> From: Chiara Antoniazzi <chiara78_at_atmos.ucla.edu>
>> Subject: HDFEOS_v2.5 swath
>> To: ncl-talk_at_ucar.edu
>> Message-ID: <0190C2B7-5F20-44FC-A43E-59BFA0F30226_at_atmos.ucla.edu>
>> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>>
>> Hi,
>> I'm trying to read data in hdfeos format (2B-GEOPROF-LIDAR: http://
>> www.cloudsat.cira.colostate.edu/dataHome.php)
>>
>> If I open the file:
>> f = addfile(diro+fname+".hdf", "r")
>> printVarSummary(f)
>> this is part of the output:
>>
>> granule_number : 9375
>> ID_SITE : Cooperative Institute for Research in the Atmosphere
>> ID_CENTER : CloudSat Data Processing Center
>> ID_CENTER_URL : http://cloudsat.cira.colostate.edu
>> ID_MACHINE : SKINKO
>> ID_CREATED : Sun May 25 17:19:27 2008
>> algorithm_name : 2B-GEOPROF-LIDAR
>> algorithm_version : 1.1
>> product_name : 2B-GEOPROF-LIDAR
>> product_version : 003
>> start_time : 20080201025505
>> end_time : 20080201043358
>> dimensions:
>> nray_2B_GEOPROF_LIDAR = 37081
>> nbin_2B_GEOPROF_LIDAR = 125
>> ncloud_2B_GEOPROF_LIDAR = 5
>>
>> GROUP=GeoField
>> OBJECT=GeoField_1
>> GeoFieldName="Profile_time"
>> DataType=DFNT_FLOAT32
>> DimList=("nray")
>> END_OBJECT=GeoField_1
>> OBJECT=GeoField_2
>> GeoFieldName="UTC_start"
>> DataType=DFNT_FLOAT32
>> DimList=("scalar")
>> END_OBJECT=GeoField_2
>> OBJECT=GeoField_3
>> GeoFieldName="TAI_start"
>> DataType=DFNT_FLOAT64
>> DimList=("scalar")
>> END_OBJECT=GeoField_3
>> OBJECT=GeoField_4
>> GeoFieldName="Latitude"
>> DataType=DFNT_FLOAT32
>> DimList=("nray")
>> END_OBJECT=GeoField_4
>> OBJECT=GeoField_5
>> GeoFieldName="Longitude"
>> DataType=DFNT_FLOAT32
>> DimList=("nray")
>> END_OBJECT=GeoField_5
>> OBJECT=GeoField_6
>> GeoFieldName="Height"
>> DataType=DFNT_INT16
>> DimList=("nray","nbin")
>> END_OBJECT=GeoField_6
>>
>>
>>
>>
>> variables:
>> short Height ( nray_2B_GEOPROF_LIDAR, nbin_2B_GEOPROF_LIDAR )
>> _FillValue : -9999
>> factor : 1
>> offset : 0
>> long_name : Height of range bin in Reflectivity/Cloud Mask
>> above reference surface (~ mean sea level).
>> units : m
>> valid_range : ( -5000, 30000 )
>> missing : -9999
>> missop : ==
>> hdf_name : Height
>>
>> byte CloudFraction ( nray_2B_GEOPROF_LIDAR, nbin_2B_GEOPROF_LIDAR )
>> _FillValue : 0xf7
>> factor : 1
>> offset : 0
>> long_name : Cloud Fraction
>> valid_range : ( 0x00, 0x64 )
>> missing : 0xf7
>> missop : ==
>> hdf_name : CloudFraction
>>
>> But I cannot read time, latitude and longitude that I need.
>> Is there any way to read these data correctly using NCL?
>>
>>
>> Thanks.
>> Chiara
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Mon, 29 Sep 2008 12:15:54 -0600
>> From: David Brown <dbrown_at_ucar.edu>
>> Subject: Re: HDFEOS_v2.5 swath
>> To: Chiara Antoniazzi <chiara78_at_atmos.ucla.edu>
>> Cc: ncl-talk_at_ucar.edu
>> Message-ID: <C844E27F-4C89-48F7-BDE3-681F9A08022A_at_ucar.edu>
>> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>>
>> Hi Chiara,
>>
>> The geolocation fields supported by HDFEOS are only visible if you read
>> the file using the HDFEOS reader, which links
>> to the HDFEOS library, built on top of the HDF library.
>> So rather than opening the file as HDF you need to open it as HDFEOS.
>> That simply requires modifying your addfile call to:
>>
>> f = addfile(diro+fname+".hdfeos", "r")
>>
>> -dave
>>
>>
>> On Sep 29, 2008, at 11:55 AM, Chiara Antoniazzi wrote:
>>
>>
>>> Hi,
>>> I'm trying to read data in hdfeos format (2B-GEOPROF-LIDAR: http://
>>> www.cloudsat.cira.colostate.edu/dataHome.php)
>>>
>>> If I open the file:
>>> f = addfile(diro+fname+".hdf", "r")
>>> printVarSummary(f)
>>> this is part of the output:
>>>
>>> granule_number : 9375
>>> ID_SITE : Cooperative Institute for Research in the Atmosphere
>>> ID_CENTER : CloudSat Data Processing Center
>>> ID_CENTER_URL : http://cloudsat.cira.colostate.edu
>>> ID_MACHINE : SKINKO
>>> ID_CREATED : Sun May 25 17:19:27 2008
>>> algorithm_name : 2B-GEOPROF-LIDAR
>>> algorithm_version : 1.1
>>> product_name : 2B-GEOPROF-LIDAR
>>> product_version : 003
>>> start_time : 20080201025505
>>> end_time : 20080201043358
>>> dimensions:
>>> nray_2B_GEOPROF_LIDAR = 37081
>>> nbin_2B_GEOPROF_LIDAR = 125
>>> ncloud_2B_GEOPROF_LIDAR = 5
>>>
>>> GROUP=GeoField
>>> OBJECT=GeoField_1
>>> GeoFieldName="Profile_time"
>>> DataType=DFNT_FLOAT32
>>> DimList=("nray")
>>> END_OBJECT=GeoField_1
>>> OBJECT=GeoField_2
>>> GeoFieldName="UTC_start"
>>> DataType=DFNT_FLOAT32
>>> DimList=("scalar")
>>> END_OBJECT=GeoField_2
>>> OBJECT=GeoField_3
>>> GeoFieldName="TAI_start"
>>> DataType=DFNT_FLOAT64
>>> DimList=("scalar")
>>> END_OBJECT=GeoField_3
>>> OBJECT=GeoField_4
>>> GeoFieldName="Latitude"
>>> DataType=DFNT_FLOAT32
>>> DimList=("nray")
>>> END_OBJECT=GeoField_4
>>> OBJECT=GeoField_5
>>> GeoFieldName="Longitude"
>>> DataType=DFNT_FLOAT32
>>> DimList=("nray")
>>> END_OBJECT=GeoField_5
>>> OBJECT=GeoField_6
>>> GeoFieldName="Height"
>>> DataType=DFNT_INT16
>>> DimList=("nray","nbin")
>>> END_OBJECT=GeoField_6
>>>
>>>
>>>
>>>
>>> variables:
>>> short Height ( nray_2B_GEOPROF_LIDAR, nbin_2B_GEOPROF_LIDAR )
>>> _FillValue : -9999
>>> factor : 1
>>> offset : 0
>>> long_name : Height of range bin in Reflectivity/Cloud Mask
>>> above reference surface (~ mean sea level).
>>> units : m
>>> valid_range : ( -5000, 30000 )
>>> missing : -9999
>>> missop : ==
>>> hdf_name : Height
>>>
>>> byte CloudFraction ( nray_2B_GEOPROF_LIDAR, nbin_2B_GEOPROF_LIDAR )
>>> _FillValue : 0xf7
>>> factor : 1
>>> offset : 0
>>> long_name : Cloud Fraction
>>> valid_range : ( 0x00, 0x64 )
>>> missing : 0xf7
>>> missop : ==
>>> hdf_name : CloudFraction
>>>
>>> But I cannot read time, latitude and longitude that I need.
>>> Is there any way to read these data correctly using NCL?
>>>
>>>
>>> Thanks.
>>> Chiara
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Mon, 29 Sep 2008 13:28:10 -0600
>> From: Mary Haley <haley_at_ucar.edu>
>> Subject: Re: log axis using gsn_csm_contour
>> To: James Correia <jimmyc42_at_gmail.com>
>> Cc: ncl-talk_at_ucar.edu
>> Message-ID: <6464ADA1-9B09-426D-9867-B605292BF030_at_ucar.edu>
>> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>>
>> Hi Jimmy,
>>
>> Please see our FAQ question on this:
>>
>> http://www.ncl.ucar.edu/FAQ/#vis_020
>>
>> I think setting trY/XLog to True should work (and don't
>> set the trAxisType resources), but if this doesn't, try the
>> gsnYAxisIrregular2Log resource that's mentioned.
>>
>> --Mary
>>
>> On Sep 29, 2008, at 9:53 AM, James Correia wrote:
>>
>>
>>> Hi all-
>>> I am trying to construct my plot to be a log-log plot. I tried setting
>>> the log axis options for gsn_csm_contour but it did not ork presumably
>>> because I have not specified the axis to have the values I am labeling.
>>> Rather the axis is defined in terms of grid points. Is there a way to
>>> modify this?
>>> Thanks
>>> jimmyc
>>>
>>> Here is the code I am using:
>>> wmin = 10.
>>> wmax = 10000.
>>> wcint= 100.
>>>
>>> rmin = 0.
>>> rmax = 46.
>>> rcint= 2.
>>>
>>> flag = 1. ; 1:log of occurences or 0:just number of occurences
>>> nn = doubletointeger(((wmax-wmin)/wcint)+1)
>>> mm = doubletointeger(((rmax-rmin)/rcint)+1)
>>>
>>> if(flag .eq. 1)then
>>> result = log(result+1.)
>>> end if
>>>
>>>
>>> levels = fspan(wmin+wcint/2.,wmax+(wcint/2.)-wcint,6)
>>> level = fspan(rmin+(rcint/2.),rmax+(rcint/2.)-rcint,3)
>>> aaxis = fspan(0,nn-1,6)
>>> baxis = fspan(0,mm-1,3)
>>>
>>> ;set up mapping resources
>>> wks = gsn_open_wks("ps", "tsdiag")
>>> res = True
>>> res_at_cnLinesOn = True
>>> res_at_cnLineLabelsOn = True
>>> res_at_cnLevelSpacingF = .75 ;set lower if you want more levels
>>> res_at_cnMaxLevelCount = 10
>>> res_at_gsnDraw = True
>>> res_at_cnFillOn = True
>>> res_at_gsnSpreadColors = True
>>> res_at_gsnMaximize = True
>>> colors =
>>> (/"white","black","white","blue","pink","Green","Yellow","Orange","Red
>>> ","purple","Violet","brown"/)
>>> gsn_define_colormap(wks,colors)
>>>
>>> ; res_at_trXLog = True
>>> ; res_at_trYLog = True
>>> res_at_trXAxisType = "LogAxis"
>>> res_at_trYAxisType = "LogAxis"
>>> res_at_tmXBMode = "Explicit"
>>> res_at_tmXBValues = aaxis
>>> res_at_tmXBLabels = levels
>>> res_at_tmYLMode = "Explicit"
>>> res_at_tmYLValues = baxis
>>> res_at_tmYLLabels = level
>>>
>>> plot = gsn_csm_contour(wks,result,res)
>>>
>>>
>>> --
>>> James Correia Jr.
>>> Post Doc
>>> Climate Physics Group, PNNL
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Mon, 29 Sep 2008 15:46:49 -0600
>> From: Mary Haley <haley_at_ucar.edu>
>> Subject: Re: contouring weirdness with FillValues
>> To: David Reusch <dbr_at_geosc.psu.edu>
>> Cc: ncl-talk_at_ucar.edu
>> Message-ID: <C25F73AF-8B72-4757-BD5B-70530854D9FB_at_ucar.edu>
>> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>>
>> Hi Dave,
>>
>> I have your files and was able to run them last night. The contouring
>> code inside NCL is pretty solid,
>> but there may be some things we can do, like smoothing, linearizing an
>> axis, etc. I will need to get more
>> familiar with your data before I know what's going.
>>
>> --Mary
>>
>> On Sep 28, 2008, at 7:11 PM, David Reusch wrote:
>>
>>
>>> Hello,
>>>
>>> I have come across some "weirdness" in NCL contouring that I have not
>>> been able to resolve and was hoping for some help. The attached figures
>>> show what I hope to produce and what I'm getting for specific datasets
>>> that have _FillValue data in them. In the "bad_plot" image, the central
>>> unfilled area is being plotted correctly as it represents _FillValue
>>> data. The areas "above" and "below" are also handled correctly. It's
>>> only the areas to each side that go crazy with contours (and I get the
>>> same result without the color fill).
>>>
>>> I am building these netCDF files myself using Python/pycdf (script
>>> cod_to_nc, in the tar file) and have not been able to find any oddities
>>> in these files that would explain the contouring madness. I have also
>>> looked at the data extensively as the NCL script is running with no
>>> insights. At this point it seems like something amiss in NCL -- though
>>> this is my first real experience using files with FillValues so I can't
>>> rule out entirely that it's my fault.
>>>
>>> The link below is to a tgz-file with the script, data and larger (4x3
>>> panels) examples of my output. The script (plot_var.ncl) takes a netCDF
>>> file as input and produces a postscript output. To reproduce the files
>>> that have these sample images, use these commands respectively:
>>> ncl 'var="h500z"' plot_var.ncl
>>> ncl 'var="h700z_msk"' plot_var.ncl
>>>
>>> I am using NCL 5.0.0 and seeing the same results on both Mac OS 10.5.5
>>> and 10.4.11.
>>>
>>> Script, data, output here: http://www.geosc.psu.edu/fetch.php?file=976
>>>
>>> Thanks for your time,
>>> Dave Reusch
>>>
>>> --
>>> 517 Deike Building
>>> Earth & Environmental Systems Institute
>>> Penn State University
>>> University Park, PA 16802
>>>
>>>
>>>
>>> <contour_images.png>_______________________________________________
>>> 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
>>
>>
>> End of ncl-talk Digest, Vol 58, Issue 48
>> ****************************************
>>
>>
>
> _______________________________________________
> 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
Received on Wed Oct 01 2008 - 09:07:52 MDT

This archive was generated by hypermail 2.2.0 : Wed Oct 01 2008 - 09:47:13 MDT