shiftgrid 'cyclic point not included' error

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.

Thanks,
Anton

···

--
View this message in context: http://old.nabble.com/shiftgrid-'cyclic-point-not-included'-error-tp27819848p27819848.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

Hi Jeff,

Thanks for the quick reply! I've updated to the latest shiftgrid and now I
get the chart :smiley:
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

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.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

--
View this message in context: http://old.nabble.com/shiftgrid-'cyclic-point-not-included'-error-tp27819848p27824785.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

antonv wrote:

Hi Jeff,

Thanks for the quick reply! I've updated to the latest shiftgrid and now I
get the chart :smiley:
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.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

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

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 :smiley:
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.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

--
View this message in context: http://old.nabble.com/shiftgrid-'cyclic-point-not-included'-error-tp27819848p27826457.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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 :smiley:
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.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

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 <jswhit@…146…>
To: antonv <vasilescu_anton@…9…>
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 :smiley:
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.Whitaker@…259…
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@…1220…sts.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.Whitaker@…2583…9…
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.Whitaker@…259…
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Anton Vasilescu wrote:

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

Anton: Probably because the original value of lons has been overwritten with the shifted grid longitudes. You need to save the original lons array to pass to shiftgrid for the second grid.

-Jeff

···

------------------------------------------------------------------------
*From:* Jeff Whitaker <jswhit@...146...>
*To:* antonv <vasilescu_anton@...9...>
*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 <http://_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 :smiley:
>>> 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.Whitaker@...259... <mailto:Jeffrey.S.Whitaker@…259…>
>>>> 325 Broadway Office : Skaggs Research Cntr 1D-113
>>>> Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory
>>>>
>>>> ------------------------------------------------------------------------------
>>>> 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 <mailto:Matplotlib-users@lists.sourceforge.net>
>>>> matplotlib-users List Signup and Options
>>>>
>>>> >>> >> -- Jeffrey S. Whitaker Phone : (303)497-6313
>> Meteorologist FAX : (303)497-6449
>> NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259... <mailto:Jeffrey.S.Whitaker@…259…>
>> 325 Broadway Office : Skaggs Research Cntr 1D-113
>> Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory
>>
>> ------------------------------------------------------------------------------
>> 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 <mailto:Matplotlib-users@lists.sourceforge.net>
>> matplotlib-users List Signup and Options
>>
>> >
>

-- Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259... <mailto:Jeffrey.S.Whitaker@…259…>
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

You’re right, the lons was getting overwritten! Thanks again for the help!

Anton

···

From: Jeff Whitaker <jswhit@…83…146…>
To: Anton Vasilescu <vasilescu_anton@…9…>
Cc: matplotlib-users@lists.sourceforge.net
Sent: Wed, March 10, 2010 8:57:16 AM
Subject: Re: [Matplotlib-users] shiftgrid ‘cyclic point not included’ error

Anton Vasilescu wrote:

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

Anton: Probably because the original value of lons has been overwritten with the shifted grid longitudes. You need to save the original lons array to pass to shiftgrid for the second grid.

-Jeff


From: Jeff Whitaker <jswhit@…1836…46…>
To: antonv <vasilescu_anton@…9…>
Cc: matplotlib-users@…504…et
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 <http://_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 :smiley:
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.Whitaker@…259… mailto:Jeffrey.S.Whitaker@...259...
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 mailto:Matplotlib-users@...504...et
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.Whitaker@…259… mailto:Jeffrey.S.Whitaker@...259...
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 mailto: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.Whitaker@…259… mailto:Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

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

Hi Jeff,

I have a similar problem as Anton where I am trying to shiftgrid and get the
same error of

"lon0 outside of range of lonsin"

when the second plot is trying to run through.

Also the data does not follow with the longitude, in other words the map is
in the right projection (over the Atlantic) however the data associated does
not move as longitude has been shifted. Is there a simple way to rectify
this?

Thanks
Michelle

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/shiftgrid-cyclic-point-not-included-error-tp24866p43855.html
Sent from the matplotlib - users mailing list archive at Nabble.com.