title: Changing map projections when using basemap
body: <p>I've changed map projections in basemap before, so I know this should be an easy fix but nothing seems to work for me. I've used meshgrid, and mapping my x,y values etc. and I just get distorted or crazy plots.  I think it has something to do with the fact that the data I'm using is automatically set to be plotted on a Lambert Conformal (which I don't want), also the dimensions are in km not lat and lon.  I'm not sure where to go from here...</p>
  
  <p>Data source:  <a href="http://thredds.ucar.edu/thredds/dodsC/grib/NCEP/RAP/CONUS_13km/RR_CONUS_13km_20150415_0600.grib2/GC.html" rel="nofollow">http://thredds.ucar.edu/thredds/dodsC/grib/NCEP/RAP/CONUS_13km/RR_CONUS_13km_20150415_0600.grib2/GC.html</a></p>
  
  <p>Here is my working code. I've got a bunch of commented stuff that I've been trying with no luck.</p>
  
  <pre><code>import numpy as np
  import math as m
  import urllib2
  import time
  import datetime as dt
  import matplotlib.pyplot as plt
  from mpl_toolkits.axes_grid1 import make_axes_locatable
  from mpl_toolkits.basemap import Basemap, shiftgrid
  from matplotlib.colors import LinearSegmentedColormap
  from pydap.client import open_url
  from pydap.proxy import ArrayProxy
  import scipy
  
  data_url = 'http://thredds.ucar.edu/thredds/dodsC/grib/NCEP/RAP/CONUS_13km/RR_CONUS_13km_' + '20150415' + '_' + '01' + '00.grib2/GC'
  
  print('Getting Data from URL:\n\n    "{0}"\n'.format(data_url))
  
  # Create Array of all data from URL
  dataset = open_url(data_url)
  
  # Map Projection Info
  
  proj_attributes = dataset['LambertConformal_Projection'].attributes
  rsphere = proj_attributes['earth_radius']
  
  lat_0 = proj_attributes['latitude_of_projection_origin']
  lon_0 = proj_attributes['longitude_of_central_meridian'] 
  lat_1 = proj_attributes['standard_parallel']
  
  llcrnrlat = 16.28100013732909 # (1,1)
  llcrnrlon = 360-126.18 # (1,1)
  
  urcrnrlat = 55.552133975329625 # (614,428)
  urcrnrlon = 360-59.15590040502627 # (614,248)
  
  x = np.array(dataset['x'][:])
  y = np.array(dataset['y'][:])
  
  def xy_converter(var):
      """
      Downloads entered variable (x or y) coordinates 
      and converts from m to km.  Inputs for var 
      should be 'x' or 'y'.
      """
      values = dataset[var][:]
      data_array = values * 1000
      newarray = data_array + abs(data_array.min())
      return newarray
  
  # Download x &amp; y coord. and convert m to km
  x = xy_converter('x')
  y = xy_converter('y')
  
  # Temp Contour
  temp_2m = dataset['Temperature_height_above_ground'].array[1,:,:,:]-273.
  temp_2m = temp_2m * (9./5.) + 32.
  temp_2m    = temp_2m.squeeze() 
  
  #plot
  fig = plt.figure(figsize=(11,11))
  ax = fig.add_subplot(1,1,1)
  
  map = Basemap(projection='lcc', lat_0 = lat_0, lon_0 = lon_0,
                                       llcrnrlon = llcrnrlon, llcrnrlat = llcrnrlat,
                                       urcrnrlat = urcrnrlat, urcrnrlon = urcrnrlon,
                                       area_thresh = 1000., rsphere = rsphere, resolution='i')
  map.drawcoastlines(linewidth=0.3)
  map.drawcountries(linewidth=0.3)
  map.drawcounties(linewidth=0.1)
  map.drawstates(linewidth=0.3)
  map.drawmapboundary(linewidth=0.5)
  
  #lons,lats = basemap_parameters.map(x,y)
  #lon,lat = basemap_parameters.map(lons,lats,inverse=True)
  
  #ny = range(len(y)); nx = range(len(x))
  #ny = temp_2m.shape[0]; nx = temp_2m.shape[1]
  #lons, lats = map(x, y) # get lat/lons of ny by nx evenly space grid.
  #xx, yy = map(lons, lats)
  
  levels = np.linspace(-42,122,320)
  ticks = [-60,-50,-40,-30,-20,-10,0,10,20,30,40,50,60,70,80,90,100,110,120]  
  
  plot = plt.contourf(x,y,temp_2m,levels,cmap='jet',extend='both')
  
  # Set Colorbar Text Color
  color_bar = map.colorbar(plot)
  color_bar.set_ticks(ticks)
  
  # CONUS
  plt.xlim(x[30],x[440])
  plt.ylim(y[30],y[290])    
  plt.savefig('/home/public_html/conus_temp.png', dpi=100, bbox_inches='tight', pad_inches = .05)
  </code></pre>