# Re: [Fwd: longitude problem]

```Hi Thomas,

Just a little background:

The root of this problem lies in a limitation of Ferret V5.41 that will be
lifted in the next version.  Ferret has the concept of a "modulo axis" -- an
axis that wraps around.  A full global data set will utilize this concept, so
that the problems of longitude that you are describing do not occur.  In
V5.41, however, the modulo cycle length of an axis must always equal to its
actual length.  Thus a sub-global longitude axis cannot be modulo -- and hence
X=-40 and X=320 appear to be different coordinate requests.

The next version of Ferret (nearly ready) includes the concept of a "sub-span
modulo" axis -- which means that sub-global longitude spans will be handled
properly.  It will also apply to time axes which contain, say, only a 3 months
out of a climatological year.

- steve

===================================================

Thomas LOUBRIEU wrote:

> Hi again,
>
> It's now working, I have commented these lines in Ferret.pl :
>
> sub fixLongitude {
>     # Ferret has problems with longitudes < 0
>     my (\$xlo, \$xhi) = @_;
> # test TL
> #    if (\$xlo ne "" && \$xlo < 0){
> #       \$xlo += 360;
> #       if (\$xhi ne ""){
> #           \$xhi += 360;
> #       }
> #    }
> #    if (\$xhi ne "" && \$xhi < 0){
> #       \$xhi += 360.;
> #    }
>     return (\$xlo, \$xhi);
> }
>
> I will now check Ferret references...
> However Ferret has a "translation" bug when I set a region this way :
>
> set region/x="320":"330"/y="20.0":"62.0"/k=1/l=1
>
> But Ferret is working when I do :
>
> set region/x="-40":"-30"/y="20.0":"62.0"/k=1/l=1
>
> I use Ferret 4.51 for linux, perhaps there has been a change in
> longitudes convention.
>
> Bye,
>
> Thomas.
>
>   ------------------------------------------------------------------------
>
> Subject: longitude problem
> Date: Thu, 14 Nov 2002 11:04:42 +0100
> From: Thomas LOUBRIEU <thomas.loubrieu@ifremer.fr>
> Organization: ifremer
> To: las_users@ferret.wrc.noaa.gov
>
> Hi,
>
> I use LAS 6.0
>
> I have included a COARDS netcdf dataset through the perl script :
>
> ../xml/perl/addXml.pl las.xml las.xml <my netcdf file>
> ../xml/perl/genLas.pl las.xml
>
> My netcdf file is covering longitudes from -40 to 0 degrees east with a
> measurement every 2 degrees.
> In my las.xml file I have a longitude axis :
>
> <EPPE_WAM_Atl_200203200300_nc_lon units="degrees_east" type="x">
>   <arange start="-40" step="2" size="21"/>
> </EPPE_WAM_Atl_200203200300_nc_lon>
>
> On the LAS User Interface my plotted grid appears with :
>         las_longitude = -40 + (real_longitude -22) mod 40
>
> Thus, if I plot the full region, the frame is well located but the
> top-left corner of my grid is located at longitude -22E instead of -40E.
> The top-right corner is located at longitude -22E instead of 0 and every
> points in my grid are translated as well.
>
> The same thing happens if my longitude axis is (changing "start"
> attribute to "320" and re-launching "../xml/perl/genLas.pl las.xml"):
> <EPPE_WAM_Atl_200203200300_nc_lon units="degrees_east" type="x">
>   <arange start="320" step="2" size="21"/>
> </EPPE_WAM_Atl_200203200300_nc_lon>
>
> Do someone have an idea of what happens to my netcdf file.
>
> Thanks,
>
> Thomas.

```