Re: map off by 180

From: David Ian Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Fri, 22 Jun 2007 16:11:47 -0600

Hi John,

I think you need to set mpCenterLonF to 180.
This will cause the map longitude limits to go from 0 to 360 instead of
the default -180 to 180.
  -dave

On Jun 22, 2007, at 3:54 PM, Ertl, John C CIV 63134 wrote:

> I am just not finding the solution to my problem.  I have a global
> grided data set (I think it starts at -90 lat 0 lon)  If I plot it I
> am only getting the 0 to 180 part of the map.  If I tell PyNGL the
> data starts at -180/-90 I get all of the data but the plot (as you
> would expect ) is off by 180deg.  How do I get the map and grid to
> line up?
>
> I read the data from a file and pass in the array (self.grid). 
> Because the grid looks OK except  for it being shifted I figure the
> array is good I just need to get the grid and map to line up.  I have
> been playing with a bunch of stuff but no luck...any ideas
>
> I know where is the data???  It is too big to include sorry.
>
>
> <CODE>
>       #### Uses PyNGL to view/image fields.
>         wks = Ngl.open_wks(self.outPutType,fileName,None)
>       
>         # set the color scheme for the plot
>         cmap = Numeric.array([[1.00, 1.00, 1.00], [0.00, 0.00, 0.00], \
>                        [.560, .500, .700], [.300, .300, .700], \
>                        [.100, .100, .700], [.000, .100, .700], \
>                        [.000, .300, .700], [.000, .500, .500], \
>                        [.000, .400, .200], [.000, .600, .000], \
>                        [.000, 1.00, .000], [.550, .550, .000], \
>                        [.570, .420, .000], [.700, .285, .000], \
>                        [.700, .180, .000], [.870, .050, .000], \
>                        [1.00, .000, .000], [0.00, 1.00, 1.00], \
>                        [.700, .700, .700]],Numeric.Float0)
>
>
>         ws_id = Ngl.get_workspace_id()
>         rlist = Ngl.Resources()
>         rlist.wsMaximumSize = 90000000
>         Ngl.set_values(ws_id,rlist)
>
>         rlist = Ngl.Resources()
>         rlist.wkColorMap = cmap
>         Ngl.set_values(wks,rlist)
>
>         grid_lon  =  Numeric.arange(self.maxLon,self.minLon +
> 1,self.scale)  # values of lon points
>             
>         # this makes a list of lat points start, finish, stride  
>         grid_lat  =  Numeric.arange(self.minLat,(self.maxLat +
> self.scale),self.scale) # values of lat points
>
>         grid_nlon =  len(grid_lon)             # number of lon points
>         grid_nlat =  len(grid_lat)             # number of lat points
>
>         resources = Ngl.Resources()    
>
>         resources.mpGeophysicalLineThicknessF = 3.
>
>         resources.cnLevelSelectionMode = "AutomaticLevels" 
>
>         resources.sfXCStartV = min(grid_lon)   # Set the plot based on
> grid lat lon
>         resources.sfXCEndV   = max(grid_lon) #######+ crossDateLine
>         resources.sfYCStartV = min(grid_lat)
>         resources.sfYCEndV   = max(grid_lat)
>        
>         resources.sfMissingValueV = 1.0e10
>         
>         resources.tiMainFontHeightF = .015              # Main title
> font size
>         resources.tiMainJust        = "CENTERCENTER"    # Main title
> justification
>
>         resources.tiMainString = title
>
>         resources.cnFillDrawOrder       = "Predraw"     # Draw
> contours first.
>
>         # if colorFill = true then plot with color fill in
>         if colorFill == "True":
>             print "In color fill"
>             resources.cnFillOn              = colorFill     # Turn on
> contour fill.
>             resources.cnLinesOn             = False
>             resources.cnLineLabelsOn        = False     # Turn off
> line labels.
>
>         # if colorFill = false then plot with contours only
>         else:
>             print "In contour"
>             resources.cnFillOn              = colorFill     # Turn off
> contour fill.
>             resources.cnLinesOn             = True
>             resources.cnLineLabelsOn        = True      # Turn on line
> labels.
>             resources.cnMonoLineColor       = False     # Allow
> multiple colors for contour lines.
>
>  
>         resources.cnInfoLabelOn         = False         # Turn off
> info label.
>
>         resources.lbPerimOn             = False         # Turn off
> label bar perim.
>         resources.pmLabelBarSide        = "Bottom"      # Change
> orientation of
>         resources.lbOrientation         = "Horizontal"  # label bar.
>         resources.lbLabelAngleF         = 90
>
>         try:
>                 map = Ngl.contour_map(wks,self.grid,resources)       #
> make the plot
>                 Ngl.destroy(wks)
>         except:
>                 print "sorry %s could not be made" % title
>
> </CODE>
>
> Thanks, 
>
> John Ertl
> Meteorologist
>
> FNMOC
> 7 Grace Hopper Ave.
> Monterey, CA 93943
> (831) 656-5704
> john.ertl_at_navy.mil
> <off by 180 deg.png>_______________________________________________
> pyngl-talk mailing list
> pyngl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Fri Jun 22 2007 - 16:11:47 MDT

This archive was generated by hypermail 2.2.0 : Mon Jul 02 2007 - 07:43:42 MDT