Re: Map tickmarks on regional cylindrical equidistant contour plot

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 29 2013 - 17:10:24 MDT

Hi Teresa,
Well I am not sure that an error response would be appropriate because a knowledgeable user can turn off the default tick marks and use the gsn_csm_contour_map routine successfully for a rotated lat/lon plot. Certainly if the tick marks need to be disabled, it would be appropriate to have a warning message that explains the reason and possible corrective action.
Thanks for the feedback. I do understand that it is not intuitive that setting the center lon is more or less required while setting the center lat may be a mistake. I should note that for most of the projections, your intuition would be right.
 -dave

On Oct 29, 2013, at 4:13 PM, Teresa Parker <tess.parker@monash.edu> wrote:

> Thanks for your comprehensive reply, Dave. I think changing the routine is a good idea, given that the projection changes without warning, and the plots with real data do not look obviously wrong.
> Perhaps generating an error or warning message when the default CE projection is used and mpCenterLatF is set, would be a better idea? It seems intuitive to the user to set both the center lat and lon, particularly as a warning is generated if mpCenterLonF is not set for a regional CE plot.
>
> Thanks and regards
> Tess
>
> --
> Tess Parker
> PhD Candidate
> School of Mathematical Sciences
> Room 225, Building 28
> Monash University, Clayton VIC 3800
> Phone: +61 3 9905 4458
>
>
> On 30 October 2013 06:09, David Brown <dbrown@ucar.edu> wrote:
> Hi Theresa,
> I will try to answer your questions and clarify this issue. There are really two separate types of projection that can be produced with the map projection set to "CylindricalEquidistant" (which is known also as "Platte Carree", or simply "latlon". As long as the center latitude is 0.0 you get a simple lat/lon projection which treats the latitude and longitude values as 1D cartesian coordinates and produces a rectangular plot. The tick marks created by the gsn plotting routines are built to handle this situation. However, as soon as the center latitude becomes non-zero, the projection changes to what is usually known as a "rotated lat/lon" projection; this projection is *not* rectangular and the tick marks produced by the gsn routines are no longer correct. Moreover, although the plot may look pleasing to you, if you are just using 1D lat/lon coordinate arrays, it will not be correct. I know your example just uses artificially generated data, but the fact is that it is not being warped into the curved projection. This would become more obvious if you used real data. In order to properly plot into a rotated lat/lon space you either need to have data that is pre-projected into that space in which case there will be specific center lat/lon values and specific corner points that you would need to determine and set correctly as resources, or you need to have 2D lat/lon coordinate arrays that specify the location of each element in the 2d grid. With 2D coordinates you can draw into any arbitrary projection and the plot will be warped correctly to fit into that space.
>
> That said, you can generate tick marks that conform to the rotated lat/lon space with a few simple changes to your script. They will not be as configurable as the gsn tick marks but they will be correct.
> Basically you should comment out (or get rid of) the lines:
>
> res@tmXBOn = True
> res@tmYLOn = True
>
> However you can leave these two lines if you don't want tick marks along these sides:
>
> res@tmYROn = False
> res@tmXTOn = False
>
> and then you should add the line:
>
> res@pmTickMarkDisplayMode = "always"
>
> This will give you tick marks that are correct relative to the map projection that you have specified. However, it will not do anything to fix the problems discussed above regarding the data.
>
> I will put it on our to-do list to disable the gsn level tick marks when a CE projection is specified but mpCenterLatF is non-zero.
> -dave
>
>
> On Oct 28, 2013, at 10:27 PM, Teresa Parker <tess.parker@monash.edu> wrote:
>
>> Thanks, Jatin. That certainly works (see attached), though it's not clear to me why it should...
>>
>> However, it does lose the "spherical" look of the original plot, which I found quite pleasing, and which ties in nicely with the look of polar stereographic projections. I wonder if the add_map_tickmarks function could be amended to work on CE plots? - it states that this function works only on rectangular projections, but I'm not sure which those might be.
>>
>> Thanks for your help.
>>
>> --
>> Tess Parker
>> PhD Candidate
>> School of Mathematical Sciences
>> Room 225, Building 28
>> Monash University, Clayton VIC 3800
>> Phone: +61 3 9905 4458
>>
>>
>> On 29 October 2013 14:36, Jatin Kala <jatin.kala.jk@gmail.com> wrote:
>> I think the problem is coming from:
>> res@mpCenterLatF = 30.
>>
>> If you comment it out, the plot looks like one would expect. Same if you set it to zero (the default value). I agree that setting it to 30 "makes sense" in this case and is the intuitive thing to do, especially when the code warns you in this case, if you do not set the mpCenterLon value.
>>
>> Cheers,
>> Jatin.
>>
>> On 29/10/2013, at 1:37 PM, Teresa Parker wrote:
>>
>> > When doing a cylindrical equidistant plot of contours over a regional map, using mpMaxLatF etc. commands, the lat/lon tickmarks are evenly spaced around the borders of the plot. They do not, however, correspond to the exact positions of the map gridlines, as the projection is curved over a plot of about 160 deg lon and 60 deg lat in extent. I have attached a simple script, which requires no external data files, and the resulting plot.
>> >
>> > The script mptick_9.ncl gives a function, "add_map_tickmarks", which allows the explicit indication of where to place tickmarks on a map. However, the add_map_tickmarks function does not apparently work on cylindrical equidistant (the default) maps. Any ideas for placing the tickmarks correctly, so that a plot with gridlines will have tickmarks in the right place, as per the result of mptick_9.ncl for a different map projection?
>> >
>> > Thanks for any assistance you can offer.
>> >
>> > --
>> > Tess Parker
>> > PhD Candidate
>> > School of Mathematical Sciences
>> > Room 225, Building 28
>> > Monash University, Clayton VIC 3800
>> > Phone: +61 3 9905 4458
>> > <tickmark_test.eps><tickmark.ncl>_______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> <tickmark_test.eps>_______________________________________________
>>
>> 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
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Oct 29 17:10:37 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 01 2013 - 08:58:14 MDT