[Thread Prev][Thread Next][Index]

Re: [ferret_users] problem to convert ASCII file to netcdf



Hi,
When defining your Y axis, do not use both /NPOINTS and  the list of points yaxis=ypoints[i=1:3049].  What that is doing is taking just the first 55 points in the list and using them. What you tried in your first email was the right idea.

yes? LET total = `ypoints,RETURN=isize`
 !-> DEFINE VARIABLE total = 3049
yes? DEFINE AXIS/Y/UNITS=degrees_south yaxis=ypoints[I=1:`total`:`npts`]
 !-> DEFINE AXIS/Y/UNITS=degrees_south yaxis=ypoints[I=1:3049:55]
 **ERROR: improper grid or axis definition: data for DEFINE AXIS/FROM_VARIABLE is not monotonic
This happened because ypoints[I=1:3049:55] is decreasing not increasing. The error message should really say,

**ERROR: improper grid or axis definition: data for DEFINE AXIS/FROM_VARIABLE is not monotonically increasing.

yes? list ypoints[I=1:3049:55]
             VARIABLE : YPOINTS
                        regrid: 55 delta on X
             FILENAME : temp.dat
             SUBSET   : 56 points (X)
 1      /  1:  20.00
 56     /  2:  19.96
 111    /  3:  19.92
 166    /  4:  19.88
 221    /  5:  19.83
 276    /  6:  19.79
 331    /  7:  19.75

So multiply by -1 to make it an increasing list, and define the axis in units of degrees north with negative values.
yes? DEFINE AXIS/Y/UNITS=degrees_north yaxis=(-1)*ypoints[I=1:`total`:`npts`]
And I think you'll be able to define the grid and read the temperature data on that grid.

Ansley

On 5/2/2013 3:02 AM, surja kanta Mishra wrote:
Thanks for reply

Now the new problem coming  while I am trying temperature contour pot as

 DEFINE AXIS/Y/UNITS=degrees_south/npoints=`npts` yaxis=ypoints[I=1:`total`]
 !-> DEFINE AXIS/Y/UNITS=degrees_south/npoints=55 yaxis=ypoints[I=1:3049]
 *** NOTE: Axis has repeated values -- micro-adjusting ...
can da temp.dat
 DEFINE GRID/X=xaxis/Y=yaxis xygrid
 FILE/VAR="temp_x, temp_y,temp"/GRID=xygrid  temp.dat 
 sh gr temp
    GRID XYGRID
 name       axis              # pts   start                end
 XAXIS     LONGITUDE           55mi   86.666E(86.667)      92.583E(92.583)
 YAXIS     LATITUDE            55 r   20N                  19.999N
 normal    Z
 normal    T

 list/I=30:35/J=20:25 temp
             VARIABLE : TEMP
             FILENAME : temp.dat
             SUBSET   : 6 by 6 points (LONGITUDE-LATITUDE)
         88.416E88.458E88.5E  88.541E88.583E88.625E
          30     31     32     33     34     35
  / 25:  0.792  0.391 -0.475 -0.475 -0.866 -1.139
  / 24: -0.561 -0.471 -0.313 -0.244 -0.342 -1.130
  / 23: -0.367 -0.341 -0.518 -0.998 -1.088 -1.197
  / 22: -0.716 -0.729 -0.587 -0.088 -0.527 -1.140
  / 21:  0.619 -0.095 -0.314 -1.212 -1.259 -1.259
  / 20: -0.393 -0.173 -0.404 -0.080 -1.269 -1.776

shade temp
 **ERROR: illegal limits: TEMP is not in the range Y=20N:20N
          Axis extremes are Y=20N:20N





On 2 May 2013 14:46, Akshay Hegde <akshay.k.hegde@xxxxxxxxx> wrote:
Dear Mishra

try this

file/var="xpoints,ypoints" temp.dat
let xdif = xpoints[I=@DDF]
let xcross = xdif[I=@EVNT:0.0415]
list/i=1:5  xpoints,xdif,xcross


LET npts = `xcross[I=@LOC:1]`

DEFINE AXIS/X/UNITS=degrees_east  xaxis = xpoints[I=1:`npts`]

LET total = `ypoints,RETURN=isize`

DEFINE AXIS/Y/UNITS=degrees_south/npoints=`npts` yaxis=ypoints[I=1:`total`]
 

sh axis y/yaxis

! Works try this

def grid/x=xaxis/y=yaxis mygrid

sh g mygrid

- Akshay Hegde




On Thu, May 2, 2013 at 1:38 PM, surja kanta Mishra <surmat84@xxxxxxxxx> wrote:
Dear all,
 
 while I am trying to convert an ASCII file to Netcdf file  for contour plot of temperature.  I have tried as an example is in the following link :
 http://ferret.pmel.noaa.gov/Ferret/faq/reading-ascii-data-representing-a-grid

The error is coming as

 yes?  file/var="xpoints,ypoints" temp.dat 
 yes? let xdif = xpoints[I=@DDF]
 yes? let xcross = xdif[I=@EVNT:0.0415]
 yes? list/i=1:5  xpoints,xdif,xcross

Column  1: XPOINTS
 Column  2: XDIF is XPOINTS[I=@DDF]
 Column  3: XCROSS is XDIF[I=@EVNT:0.0415]
          XPOINTS   XDIF  XCROSS
1    /  1:   86.67  0.042  0.000
2    /  2:   86.71  0.042  0.000
3    /  3:   86.75  0.042  0.000
4    /  4:   86.79  0.042  0.000
5    /  5:   86.83  0.375  0.000

yes?  LET npts = `xcross[I=@LOC:1]`
 !-> DEFINE VARIABLE npts = 55
yes?  DEFINE AXIS/X/UNITS=degrees_east  xaxis = xpoints[I=1:`npts`]
 !-> DEFINE AXIS/X/UNITS=degrees_east  xaxis = xpoints[I=1:55]
yes? LET total = `ypoints,RETURN=isize`
 !-> DEFINE VARIABLE total = 3049
yes? DEFINE AXIS/Y/UNITS=degrees_south yaxis=ypoints[I=1:`total`:`npts`]
 !-> DEFINE AXIS/Y/UNITS=degrees_south yaxis=ypoints[I=1:3049:55]
 **ERROR: improper grid or axis definition: data for DEFINE AXIS/FROM_VARIABLE is not monotonic

temperature data in ascii format is in attached file.

Please help me.
Surja
--
Surja...
...........................................................................................
Surja Kanta Mishra
Junior Research Fellow (CSIR-NET, Funded by UGC)
School of Oceanographic Studies
Jadavpur University
Kolkata - 700032
India.

Contacts: +91 9681091928
Alternate E-mail: sur_km@xxxxxxxxxxx 




--
Surja...
...........................................................................................
Surja Kanta Mishra
Junior Research Fellow (CSIR-NET, Funded by UGC)
School of Oceanographic Studies
Jadavpur University
Kolkata - 700032
India.

Contacts: +91 9681091928
Alternate E-mail: sur_km@xxxxxxxxxxx 


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement