Re: map shifting

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 06 2011 - 12:58:26 MST

Hi Ahmed,

The plot is correct but the tickmarks are not correct because the gsn_csm_contour_map_ce routine creates its own set of tickmarks that assume a non-rotated cylindrical equidistant projection, or in other words that the mpCenterLatF resource is set to 0.0. It should probably be modified to recognize this condition, but in the meantime you can get correct tickmarks and labels by setting one more resource:

res@pmTickMarkDisplayMode = "always"

This will cause the standard map tickmarks and labels to be used.
 -dave

On Jan 6, 2011, at 12:14 PM, ahmed lasheen wrote:

> Hello
> thanks for you help, the picture is really wonderful . but there is one issue that the longitude
> is westerly shifted , for example Cairo(Egypt) should be about 30 degrees east , but in the picture it is at 50 degree east .
> thanks in advance
>
> On Thu, Jan 6, 2011 at 7:10 PM, Mary Haley <haley@ucar.edu> wrote:
> Ahmed,
>
> Thanks for providing your file.
>
> In order to do an overlay of contours on a map with tfDoNDCOverlay set to True, you must have the
> *exact* map projection that the data are on. I think the reason why you are seeing the shift is partly
> because you don't have the correct projection.
>
> You can get around this problem by not setting tfDoNDCOverlay to True, and instead using your
> lat2d/lon2d values to get your projection correct.
>
> Also, instead of using mpMin/MaxLat/LonF resources, I would use mpRight/LeftCornerLat/LonF resources
> with an "mpLimitMode" set to "corners"
>
> Finally, you don't need to hard-code the values for mpCenterLatF and mpCenterLonF. Since they are
> provided on your file, you can set them by referencing the CEN_LAT and CEN_LON global attributes:
>
> res@mpCenterLatF = a@CEN_LAT
> res@mpCenterLonF = a@CEN_LON
>
> Please see the attached modified script and image.
>
> --Mary
>
>
>
> On Jan 6, 2011, at 1:46 AM, ahmed lasheen wrote:
>
>> Hello
>> I have uploaded the data file to the ftp server. about the center values
>> i got them from the wrf namelist ref_lat and ref_lon which indicate the center in which the domain is rotated.
>> thanks in advance
>> ahmed
>>
>> On Wed, Jan 5, 2011 at 1:41 PM, David Brown <dbrown@ucar.edu> wrote:
>> Hi Ahmed,
>>
>> Where did you get the values for the center lat and lon? Are they part of the metadata for the file? It would help if you can upload your data file to our ftp server. See the directions at
>> http://www.ncl.ucar.edu/report_bug.shtml. Thanks,
>> -dave
>>
>>
>> On Jan 5, 2011, at 10:44 AM, ahmed lasheen wrote:
>>
>>> Hello
>>> I trying to plot the terrain of the NMM-WRF ,but the map is being shifted from the terrain (or reverse) , the projection of data is rotated lat lon .
>>> i have used the CylindricalEquidistant projection ,as i read from the ncl-talk archive that is like the rotated lat lon.
>>> here is the code i wrote
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> ;******************************************************
>>> begin
>>> ;****************** Open file and get variables *************
>>> a = addfile("../../data/wrf_10111200//geo_nmm_nest.l01.nc","r")
>>> ter = a->HGT_M (0,:,:)
>>> lat2d = a->XLAT_M (0,:,:)
>>> lon2d = a->XLONG_M(0,:,:)
>>> ;*******************make the graphics ***********************
>>> wks = gsn_open_wks("pdf" ,"terrain") ; ps,pdf,x11,ncgm,eps
>>> gsn_define_colormap(wks,"gui_default") ; select color map
>>>
>>> res = True ; plot mods desired
>>> res@cnFillOn = True ; turn on color
>>> res@cnLinesOn = False ; turn contour lines
>>> res@mpMaxLatF = max(lat2d)
>>> res@mpMinLatF = min(lat2d)
>>> res@mpMaxLonF = max(lon2d)
>>> res@mpMinLonF = min(lon2d)
>>> res@gsnSpreadColors = True
>>> res@lbLabelStride = 2
>>> res@mpLimitMode = "latlon" ; use lat/lon coordinates to limit area
>>> res@mpProjection = "CylindricalEquidistant"
>>> res@mpGreatCircleLinesOn = True
>>> res@gsnCenterString = res@mpProjection+" Projection"
>>> res@tfDoNDCOverlay = True
>>> res@mpOutlineBoundarySets = "National"
>>> res@mpCenterLatF = 37
>>> res@mpCenterLonF = 22
>>> plot = gsn_csm_contour_map_ce(wks,ter(:,:),res)
>>> end
>>>
>>> thanks in advance
>>>
>>> --
>>> ===============
>>> Ahmed Lasheen
>>> Egyptian Meteorological Authority(EMA)
>>> Cairo,Egypt
>>> ===============
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>>
>> --
>> ===============
>> Ahmed Lasheen
>> Egyptian Meteorological Authority(EMA)
>> Cairo,Egypt
>> ===============
>>
>> _______________________________________________
>> 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
>
>
>
>
> --
> ===============
> Ahmed Lasheen
> Junior researcher at Cairo Numerical Weather Prediction Center (CNWPC)
> Egyptian Meteorological Authority(EMA)
> Cairo,Egypt
> ===============
>
> _______________________________________________
> 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 Jan 6 12:58:32 2011

This archive was generated by hypermail 2.1.8 : Thu Jan 13 2011 - 09:24:21 MST