! reading_files.jnl *sh* 11/91 - updated 11/93 ! Description: shows examples of reading data from ASCII files CANCEL REGION ! in case there's region info left over from previous commands SET MODE VERIFY ! display the FERRET commands at the console ! This FERRET journal file presents examples of reading data from a file. ! The file SNOOPY.DAT is distributed with the FERRET demo data sets ! It contains 50 records with 6 columns of data. ! Columns 1,3,5 are variable number 1 ! Columns 2,4,6 are variable number 2 ! (The FERRET Users Guide has additional examples.) ! Our first file access will be as simple as possible - we will rely strictly ! on defaults. FERRET will by default access only the first column and will ! name it "v1" FILE snoopy.dat PLOT v1 MESSAGE ! Now we will access all the data by telling FERRET there are 2 variables ! located in 6 columns. FILE/VARIABLES="my_var1,my_var2"/COLUMNS=6 snoopy.dat PLOT my_var1,my_var2 MESSAGE ! Just for the heck of it lets add the two variables together. PLOT my_var1+my_var2 MESSAGE ! And just for the heck of it lets grab columns 3 and 4, only. FILE/VARIABLES="my_var1,my_var2"/FORMAT=(21X,F14.0,F8.0) snoopy.dat PLOT my_var1,my_var2 MESSAGE ! Now suppose that the data, instead, represent a 2D grid with ! 6 longitudes by 50 latitudes DEFINE AXIS/X=10e:60e:10/unit=degree xlong DEFINE AXIS/Y=0:49n:1/unit=degree y50 DEFINE GRID/x=xlong/y=y50 gsnoopy2D ! By default only one column will be read. The /COLUMNS= tells FERRET how many FILE/VARIABLES=my_2D_var/COLUMNS=6/GRID=gsnoopy2D snoopy.dat contour my_2D_var MESSAGE ! or suppose it was a time series of 10 lat/long grids - each grid ! having 6 longitudes by 5 latitudes DEFINE AXIS/Y=0:40n:10/unit=degree y5 DEFINE AXIS/T=1-jan-1981:10-jan-1981:1/unit=day t10 DEFINE GRID/x=xlong/y=y5/t=t10 gsnoopy3D FILE/VARIABLES=my_3D_var/COLUMNS=6/GRID=gsnoopy3D snoopy.dat contour/Y=10N my_3D_var SET MODE/LAST VERIFY