Re: [python-users] Need clarification on shiftgrid and addcylic

  • To: "ashwinD12 ." <winash12@xxxxxxxxx>
  • Subject: Re: [python-users] Need clarification on shiftgrid and addcylic
  • From: Ryan May <rmay@xxxxxxxx>
  • Date: Mon, 27 Jun 2016 11:47:00 -0500
Ashwin,

Did you get this worked out? My first inclination is that the problem might
be that the hgt array doesn't have lons as the "right-most dimension"
(which is needed according to the docs
http://matplotlib.org/basemap/api/basemap_api.html#mpl_toolkits.basemap.shiftgrid).
In other words, hgt should have a shape of (M, N) where N is the size of
lons.

Ryan

On Tue, Jun 21, 2016 at 5:06 AM, ashwinD12 . <winash12@xxxxxxxxx> wrote:

> Hello,
>           I am just starting to learn how to plot NCEP reanalysis data
> using Python3 and matplotlib and basemap. I have some clarifications on how
> to go about doing it.
>
> My dataset is between latitude 5 N to 40 N and 65 E and 100 E.
> I am trying to plot geopotential height from NCEP reanalysis data. Here is
> my code -
>
> <code>
> level = 5
> time = 0
>
> meters_per_grid = 277830
>
> d = Dataset("hgt_500_2014_12_5_00Z.nc")
> hgt =  d.get_variables_by_attributes(axis="hgt")
> lon =  d.get_variables_by_attributes(axis="lon")
> lat =d.get_variables_by_attributes(axis="lat")
> hgt = hgt[::-1]
> hgt, lon = shiftgrid(180, hgt, lon, start = False
> </code>
>
> Why do I get an IndexError: index out of range on shiftgrid call ?
>
> BR,
> Ashwin.
>
>
>
> _______________________________________________
> NOTE: All exchanges posted to Unidata maintained email lists are
> recorded in the Unidata inquiry tracking system and made publicly
> available through the web.  Users who post to any of the lists we
> maintain are reminded to remove any personal information that they
> do not want to be made public.
>
>
> python-users mailing list
> python-users@xxxxxxxxxxxxxxxxxxxxxxxx
> For list information, to unsubscribe, or change your membership options,
> visit: http://www.unidata.ucar.edu/mailing_lists/
>



-- 
Ryan May, Ph.D.
Software Engineer
UCAR/Unidata
Boulder, CO
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: