Re: map projection problem

From: David Ian Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu, 5 Oct 2006 15:40:28 -0600

Dear Mr. Turuncoglu,

I notice that you sent this message to ncl-talk though the syntax of
your sample code suggests you are
using PyNGL. No matter. The issues are the same either way and the code
is easily adapted from one
language to the other. I am responding here using NCL.

trDoNDCOverlay should be set to "NDCViewport" (or equivalently True)
*only* when the data is natively
in the projection of the plot and set to exactly the same map limits of
the data. Data that is represented using
a lat/lon grid (i.e. a CylindricalEquidistant projection) can easily be
reprojected to any of NCL/PyNGL's supported
projections. I am enclosing two plots: one of some lat/lon gridded data
plotted using the default CE projection
and the other showing the same data mapped into a LambertConformal
projection. Here is the code that
produces both plots. You will notice that only the projection resources
need to be set to change the plot from
CE to LC. I used the "LatLon" limit mode in this case because it
produced better boundaries for the LC plot.
This is not fundamental to the issue though. You could adjust the
corner resources a bit to get the same plot.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
; ================================================;
begin

  dir = "~/data/"
  f = addfile(dir + "irrxTCC1SuA4i-1.nc","r")

  wks = gsn_open_wks("ps","ce-lc")
  gsn_define_colormap(wks,"gui_default")

  res = True ; plot mods desired
  res_at_gsnMaximize = True

  lat = f->lat
  lon = f->lon
  res_at_sfYArray = lat
  res_at_sfXArray = lon
  res_at_gsnAddCyclic = False
  res_at_cnFillOn = True
  res_at_cnLineLabelsOn = False
  res_at_cnLinesOn = False
  res_at_cnFillMode = "RasterFill"
  res_at_cnRasterSmoothingOn = True
  res_at_pmTickMarkDisplayMode = "always"
; res_at_mpLimitMode="Corners"
; res_at_mpLeftCornerLatF = lat(dimsizes(lat)-1)
; res_at_mpLeftCornerLonF = lon(0)
; res_at_mpRightCornerLatF = lat(0)
; res_at_mpRightCornerLonF = lon(dimsizes(lon)-1)
  res_at_mpLimitMode = "LatLon"
  res_at_mpMinLatF = lat(dimsizes(lat)-1)
  res_at_mpMinLonF = lon(0)
  res_at_mpMaxLatF = lat(0)
  res_at_mpMaxLonF = lon(dimsizes(lon)-1)
  res_at_mpGridAndLimbOn = True
  res_at_gsnSpreadColors = True

  plot = gsn_csm_contour_map(wks,f->irrx(0,:,:),res)

res_at_mpProjection = "LambertConformal"
  res_at_mpLambertMeridianF = -100
  res_at_mpLambertParallel1F = 40
  res_at_mpLambertParallel2F = 40

  plot = gsn_csm_contour_map(wks,f->irrx(0,:,:),res)

end

On Oct 5, 2006, at 8:20 AM, Ufuk Utku Turuncoglu wrote:

> Hi,
>
> I try to plot the two dataset (CRU and MM5 output) that are in
> different
> map projection. So, CRU data can be plotted successfully in Cylindrical
> Equidistant projection and i want to plot it in Lambert Conformal. So,
> when i try to plot in Lambert projection the data (CRU) does not match
> with the coast lines. The part of the code as follows (same with MM5
> output plotting part),
>
> res.sfMissingValueV = clim_cru[0][0]
> res.mpProjection = "LambertConformal"
> res.mpLimitMode="Corners"
> res.mpLeftCornerLatF = float(lat[0][r1-1])
> res.mpLeftCornerLonF = float(lon[0][r1-1])
> res.mpRightCornerLatF = float(lat[r2-1][0])
> res.mpRightCornerLonF = float(lon[r2-1][0])
> res.mpLambertParallel1F = 30.
> res.mpLambertParallel2F = 60.
> res.mpLambertMeridianF = 26.
> res.tfDoNDCOverlay = "NDCViewport"
>
> I use the tfDoNDCOverlay but it fail. I put some example plot in to
> following html link,
>
> http://kullanici.be.itu.edu.tr/~turuncu/sample.jpg
>
> does it need to interpolate one grid to another or is there any simple
> solution of it?
>
> Thanks for your any suggestions,
> Best wishes
>
> Ufuk Utku Turuncoglu
> Istanbul Technical University
> Informatics Institute
> Computational Earth System Science Group
>
>
> _______________________________________________
> 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 Thu Oct 05 2006 - 15:40:28 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 05 2006 - 17:01:32 MDT