Hi Jeff,

Thank you for looking at the code for me! It works perfect for the first image 
but when it tries to do the second it errors out saying: "lon0 outside of range 
of lonsin". Any idea why is that happening? Is it happening for you too?

Thanks,
Anton




________________________________
From: Jeff Whitaker <jsw...@fastmail.fm>
To: antonv <vasilescu_an...@yahoo.com>
Cc: matplotlib-users@lists.sourceforge.net
Sent: Mon, March 8, 2010 12:50:48 PM
Subject: Re: [Matplotlib-users] shiftgrid 'cyclic point not included' error

antonv wrote:
> Hi Jeff,
> 
> Here is the whole script: 
> http://old.nabble.com/file/p27826457/_test_shiftgrid.py _test_shiftgrid.py 
> And here are the grib data files:
> http://socalscubainfo.com/downloads/GRIB2_files.zip
> 
> Also, if there is not too much to ask, is there a sample anywhere that shows
> how to use shiftgrid for a mercator projection? If you look at the script, I
> was initially trying to make the images using the mercator projection (there
> is a commented basemap function there) but it would display just the data
> starting from the origin. I was wondering how would I be able to display
> let's say the whole globe but shift the grid 180 so that great britain would
> be in the center of the map rather than being cut at the edge.
> 
> Thanks,
> Anton  

Anton:  You weren't updating the lons and lats to be consistent with the 
shifted grid.  I changed the lines

       #z, lons[i] = shiftgrid(180.0, z, lons[i], start=False, cyclic=360.0)
       #zq, lons_a[i] = shiftgrid(180.0, zq, lons_a[i], start=False, 
cyclic=360.0)

in your script to

       lons1 = lons[0,:]
       z, lonsnew = shiftgrid(180.0, z, lons1, start=False)
       zq, lonsnew = shiftgrid(180.0, zq, lons1, start=False)
       lons, lonsnew = shiftgrid(180.0, lons, lons1, start=False)
       lats, lonsnew = shiftgrid(180.0, lats, lons1, start=False)

and it works fine.

-Jeff
> 
> 
> 
> Jeff Whitaker wrote:
>  
>> antonv wrote:
>>    
>>> Hi Jeff,
>>> 
>>> Thanks for the quick reply! I've updated to the latest shiftgrid and now
>>> I
>>> get the chart :D
>>> I still have a small issue as there is a half degree sliver missing from
>>> the
>>> mapping at the greenwich meridian. Any idea how to solve that issue? 
>>> Here is an image showing that (above england):
>>> http://old.nabble.com/file/p27824785/Global-HTSGW_DIRPW-0.png 
>>> Thanks,
>>> Anton
>>>        
>> Anton:  Looks like the values at the Greenwich meridian got messed up 
>> somehow.  Can you post your script somewhere so I can try it out?
>> 
>> -Jeff
>>    
>>> Jeff Whitaker wrote:
>>>        
>>>> antonv wrote:
>>>>            
>>>>> Hi all,
>>>>> 
>>>>> I am getting a 'cyclic point not included' error using shiftgrid on a
>>>>> grib
>>>>> file from NOAA. I've checked and it seems that the file has the lons
>>>>> from
>>>>> 0
>>>>> to 359.5 every .5 degree but I get that error whenever I try to run
>>>>> this. 
>>>>> What I need to achieve is to shift the grid from 0 / 360 to -180 / 180
>>>>> so
>>>>> that I can create a map over Great Britain. I am using a Cassini
>>>>> projection.
>>>>>                  
>>>> Anton:  You can add the wraparound, or cyclic point using the addcyclic 
>>>> function.  Or, you can update to the latest svn version of basemap which 
>>>> does not have this restriction.
>>>> 
>>>> 
>>>> -Jeff
>>>> 
>>>> 
>>>> -- Jeffrey S. Whitaker         Phone  : (303)497-6313
>>>> Meteorologist               FAX    : (303)497-6449
>>>> NOAA/OAR/PSD  R/PSD1        Email  : jeffrey.s.whita...@noaa.gov
>>>> 325 Broadway                Office : Skaggs Research Cntr 1D-113
>>>> Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg
>>>> 
>>>> 
>>>> ------------------------------------------------------------------------------
>>>> Download IntelĀ® Parallel Studio Eval
>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>> proactively, and fine-tune applications for parallel performance.
>>>> See why Intel Parallel Studio got high marks during beta.
>>>> http://p.sf.net/sfu/intel-sw-dev
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Matplotlib-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>> 
>>>> 
>>>>            
>>>        
>> -- Jeffrey S. Whitaker         Phone  : (303)497-6313
>> Meteorologist               FAX    : (303)497-6449
>> NOAA/OAR/PSD  R/PSD1        Email  : jeffrey.s.whita...@noaa.gov
>> 325 Broadway                Office : Skaggs Research Cntr 1D-113
>> Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg
>> 
>> 
>> ------------------------------------------------------------------------------
>> Download IntelĀ® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
>> 
>>    
> 
>  


-- Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/PSD  R/PSD1        Email  : jeffrey.s.whita...@noaa.gov
325 Broadway                Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg


      
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to