[Thread Prev][Thread Next][Index]

Re: [ferret_users] Reading text file and creating netcdf file by using define axis from variable



Hi Don,
Have you read the documentation?  What I do is bookmark the Users Guide Index in my browser,
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/index-1/index/

and then either browse through it or use the browser search function to look for things (in this instance, look for SCAT2GRID).  You want documentation for scat2gridgauss_xy, and you might also want to read about scat2gridlaplace_xy which uses different methods to interpolate the data to a grid.  Under the documentation for scat2gridgauss_xy, read down below the examples for a discussion of the radius and cutoff parameters.  The other thing to think about is the coarseness of the output grid that you define.  This will depend on your particular dataset; how much data you have and how it is distributed.

Here in the Ferret list we like to respond to questions first by pointing people to the resources such as documentation, FAQ's, scripts that come with Ferret; and then as you start trying the ideas, you are always welcome to ask more questions.

-Ansley

On 6/2/2013 10:19 AM, Don DNA wrote:
Thank you Ansley and Akshay, I could able to plot from your script but I didn't understand about radius and cutoff, please anyone explain about these two, and what this function exactly does, whether 0.1 interval is necessary in define axis field ?

awaiting for answer

- Dona Clara


From: Akshay Hegde <akshay.k.hegde@xxxxxxxxx>
To: Don DNA <don_vbe@xxxxxxxxx>
Cc: Ansley Manke <ansley.b.manke@xxxxxxxx>; "ferret_users@xxxxxxxx" <ferret_users@xxxxxxxx>
Sent: Saturday, June 1, 2013 6:24 PM
Subject: Re: [ferret_users] Reading text file and creating netcdf file by using define axis from variable

Hi Dona as  Ansley sir suggested you could use scat2gridgauss_xy function for more detail go through http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/appendix-a-external-functions/scat2grid_nobs_xy/

for usage of function and to save variable as netcdf have a look on sample script I just played little bit with your data,other may give better solution to you

copy below script and save as jnl file
just run on terminal

go filename.jnl


! Memory setting it depends on your system
set mem/size=800

! Define axis here
define axis/x=40:100:0.1/units=longitudes xlon
define axis/y=0:25:0.1/units=latitudes ylat

! Define Grid
define grid/x=xlon/y=ylat fun

! Read File Here....
file/skip=1/grid=fun/var="lat,lon,grd" Data.txt

! Regrid your variable into the grid fun
let Grad_1 = grd[g=fun@asn]

! Define limits here for scat2grid function
! Play with radius and cuttoff

define symbol radius = 1
define symbol cutoff = 4.0

let lon_1D = XSEQUENCE(lon)
let lat_1D = XSEQUENCE(lat)
let Grad_1D = XSEQUENCE(Grad_1)

!************************************************************************************************************************
! Call scat2gridgauss_xy function
! for more detail go through http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/appendix-a-external-functions/scat2grid_nobs_xy/
!************************************************************************************************************************

let Grad_2 = scat2gridgauss_xy(lon_1D,lat_1D,Grad_1D,\
x[gx=fun],y[gy=fun],($radius),($radius),($cutoff),($cutoff))

! If required then set title and units
set var/title="My title "/units="my units"  Grad_2

! Have a look on grid
sh grid Grad_2

contour/fill/key/line/lev=(0,4,0.25) grad_2
go fland 20
go land thick

! For saving use either save

save/file=myfile_1.nc/clobber grad_2

! OR list

list/file=myfile_2.nc/clobber grad_2

frame/file=test.gif




Akshay Hegde,
National Institue of Oceanography
Dona Paula, Goa







On Sat, Jun 1, 2013 at 12:12 PM, Don DNA <don_vbe@xxxxxxxxx> wrote:
Yes, Ansley what you said is right, points are scattered, but I don't understand scat2grid function usage, and how much accurate it is, which interpolation I need to use, is there any functions for interpolation ? In fact right now I am completely depending on forum

- Dona Clara



From: Ansley Manke <ansley.b.manke@xxxxxxxx>
To: Don DNA <don_vbe@xxxxxxxxx>
Cc: "ferret_users@xxxxxxxx" <ferret_users@xxxxxxxx>
Sent: Friday, May 31, 2013 10:13 PM
Subject: Re: [ferret_users] Reading text file and creating netcdf file by using define axis from variable

Hi Don,
Defining an axis directly from the data only makes sense if the data is actually organized as a grid.

Your data looks like it's at a set of scattered points. Is that the case? To check what the distribution of the points looks like, you can plot them as marks on a map

   yes? file/skip=1/var="lat,lon,grd" Data.txt
   yes? go basemap
   yes? plot/vs lon, lat

If the points are scattered, you could use one of the SCAT2GRID functions. Define a grid,  and call the function to interpolate the variable GRD onto the grid.

--Ansley

On 5/31/2013 6:44 AM, Don DNA wrote:


Please anyone help me, I am having text file, I could able to read it using following command

yes? file/skip=1/var="lat,lon,grd" Data.txt
yes? sh d
     currently SET data sets:
    1> ./Data.txt  (default)
 name     title                             I         J         K         L         M         N
 LAT      LAT                              1:20480   ...       ...       ...       ...       ...
 LON      LON                              1:20480   ...       ...       ...       ...       ...
 GRD      GRD                              1:20480   ...       ...       ...       ...       ...


 list /i=1:10 lat,lon,grd
             DATA SET: ./Data.txt
             X: 0.5 to 10.5
 Column  1: LAT
 Column  2: LON
 Column  3: GRD
             LAT    LON    GRD
1    /  1:  11.83  88.93  0.3000
2    /  2:  11.95  87.95  0.1000
3    /  3:  12.10  86.98  0.3000
4    /  4:  17.67  40.43  0.3000
5    /  5:  24.82  57.92  0.3000
6    /  6:  13.28  42.93  0.0500
7    /  7:   7.93  73.32  0.1800
8    /  8:   7.25  72.00  0.2400
9    /  9:   4.33  67.43  0.0600
10   / 10:  24.07  57.59  0.0200


define axis/X/units=Degrees_East xaxis=lon[i=1:2791]
 **ERROR: improper grid or axis definition: data for DEFINE AXIS/FROM_VARIABLE is not monotonic at index 2

define axis/Y/units=Degrees_north yaxis=lat[i=1:2791]
 **ERROR: improper grid or axis definition: data for DEFINE AXIS/FROM_VARIABLE is not monotonic at index 6

Now I want to create netcdf file, I searched in user list and in ferret website, in that I found that axis can be defined by using variable, but in my case I am unable to define axis from variable, I don't have much idea about ferret programming, please those who know kindly help me, and please go through attachment.


- Dona Clara.



























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

Privacy Policy | Disclaimer | Accessibility Statement