.
! Make an expanded SHOW DATA listing with all the attribute information yes? SHOW DATA/ATTR ! List the value of an attribute yes? LIST var.units ! Find out the number of attributes a variable has yes? LET natt = var.nattrs ! Define a Ferret variable whose value is an attribute ! (This is the syntax for accessing a global attribute) yes? LET my_string = ..history ! Add an attribute, or redefine an existing one yes? DEFINE ATTRIBUTE var.units = "Degrees" ! Determine which attributes are written to netCDF files yes? SET ATTRIBUTE/output var.add_offset yes? SET ATTRIBUTE/output var.scale_factor
Full documentation may be found in the Users Guide, Ch3 Sec 1.8, Variable and dataset attributes. Look up
"attributes" in the index.
yes? SET DATA etopo60 yes? SET VAR/OUTTYPE=short rose yes? SAVE/X=180/FILE=r_int.nc rose
Note that Ferret still always converts data to single-precision floats on input, except for coordinate data which is represented internally as double-precision floating point. If a different output data type is requested, netCDF calls are used to convert floating-point data to the requested type.
Care must be taken to reset the missing value flag if needed so that its value may be represented in the output data type. Ferret will issue an error if the flag cannot be represented in the new type. For the above example we would have to change the missing-value flag for rose before the data could be written
yes? SET DATA etopo60 yes? SET VAR/OUTTYPE=short rose yes? SET ATTRIBUTE rose.missing_value = -20000 yes? SAVE/X=180/FILE=r_int.nc rose *** NOTE: Converting data type of missing_value NC_FLOAT to match output type of variable NC_SHORT
yes? CANCEL MODE UPCASE_OUTPUT
and the original upper- or lower-case spellings to be used.
Example:
yes? SET DATA nofile.nc **TMAP ERR: non-existent or not on line nofile.nc yes? SHOW SYM FER_LAST_ERROR FER_LAST_ERROR = "**TMAP ERR: non-existent or not on line nofile.nc "
yes? DEF AXIS/X/BOUNDS xax = {1,2,5,6}, {0.5,1.5, 1.5,2.5, 2.5,5.5, 5.5,6.5} yes? DEF AXIS/X/BOUNDS xax = {1,2,5,6}, {0.5, 1.5, 2.5, 5.5, 6.5}
tcoords - variable containing time values, e.g. t[gt=var,L=40:42]
var - variable from which time encoding will be inferred
yes? use "http://www.ferret.noaa.gov/cgi-bin/nph-dods/data/PMEL/smith_sandwell_topo_v8_2.nc" yes? fill/set/x=222.9:223.1/y=28.22:29.1 rose yes? ppl xfor (dm) yes? ppl yfor (dm) yes? ppl fill
To request degrees, minutes, and seconds the syntax is PPL XFOR (DMS) or PPL YFOR (DMS). Here is an example where two lists of points are defined as longitudes and latitudes and plotted using plot/vs, with degrees, minutes, and seconds on the Y axis.
yes? plot/vs/set/title="DMS on y axis"/vlim=2.28:2.4/hlim=144.5:144.8 xpts, ypts yes? ppl xfor (dm) yes? ppl yfor (dms) yes? ppl plot
the plot; on a horizontal axis they may overwrite one another. The margins may be adjusted by defining and plotting in a viewport or by the PPL XORG or PPL YORG commands; the tic interval may be changed with the PPL tics command.
Now, comma-delimited and tab-delimited formats are treated the same as automatically formatted LISTings for multiple variables. If we want the old behavior, then LIST/SINGLY/FORM=tab etc. can be specified. The header line listing the variable names uses the same delimiter between names. A new qualifier LIST/NOROWHEAD removes the coordinate labels from each row of output. For example
! Define some variables yes? let country = {"CN", "CN", "US"} yes? let id = {1,2,3} yes? let aa = 4000* id yes? let bb = 1000000* id + 500 ! List with default LIST formatting yes? LIST id, country, aa, bb X: 0.5 to 3.5 Column 1: ID is {1,2,3} Column 2: COUNTRY is {"CN", "CN", "US"} Column 3: AA is 4000* ID Column 4: BB is 1000000* ID + 500 ID COUN AA BB 1 / 1: 1.000 "CN" 4000. 1000500. 2 / 2: 2.000 "CN" 8000. 2000500. 3 / 3: 3.000 "US" 12000. 3000500. ! List with /COMMA formatting yes? LIST/FORMAT=COMMA id, country, aa, bb X: 0.5 to 3.5 Column 1: ID is {1,2,3} Column 2: COUNTRY is {"CN", "CN", "US"} Column 3: AA is 4000* ID Column 4: BB is 1000000* ID + 500 ID,COUNTRY,AA,BB 1 / 1:1,"CN",4000,1000500 2 / 2:2,"CN",8000,2000500 3 / 3:3,"US",12000,3000500 ! List with /TAB formatting yes? LIST/FORMAT=TAB id, country, aa, bb X: 0.5 to 3.5 Column 1: ID is {1,2,3} Column 2: COUNTRY is {"CN", "CN", "US"} Column 3: AA is 4000* ID Column 4: BB is 1000000* ID + 500 ID COUNTRY AA BB 1 / 1:1 "CN" 4000 1000500 2 / 2:2 "CN" 8000 2000500 3 / 3:3 "US" 12000 3000500 ! /NOROWHEAD removes the coordinate labels for each row yes? list/format=tab/NOROWHEAD id, country, aa, bb X: 0.5 to 3.5 Column 1: ID is {1,2,3} Column 2: COUNTRY is {"CN", "CN", "US"} Column 3: AA is 4000* ID Column 4: BB is 1000000* ID + 500 ID COUNTRY AA BB 1 "CN" 4000 1000500 2 "CN" 8000 2000500 3 "US" 12000 3000500 ! Or use /NOHEAD and /NOROWHEAD for no header at all yes? list/format=tab/NOROWHEAD/NOHEAD id, country, aa, bb 1 "CN" 4000 1000500 2 "CN" 8000 2000500 3 "US" 12000 3000500
yes? list id, country X: 0.5 to 3.5 Column 1: ID is {1,2,3} Column 2: COUNTRY is {"CA", "CA", "US"} COUNTRY 1 / 1: 1.000N"CA" 2 / 2: 2.000N"CA" 3 / 3: 3.000N"US" ! Now, this listing is yes? list id, country X: 0.5 to 3.5 Column 1: ID is {1,2,3} Column 2: COUNTRY is {"CA", "CA", "US"} COUNTRY 1 / 1: 1.000 "CA" 2 / 2: 2.000 "CA" 3 / 3: 3.000 "US"
yes? SHOW FUNC *dateNow correctly returns SAMPLET_DATE.
! create a dataset with subspan modulo x axis yes? set data coads_climatology yes? save/clobber/file=sst.nc/y=0/x=130e:80w sst yes? cancel dat/all yes? use sst.nc yes? set v left; shade/x=120e:80w sst yes? set v right; fill/x=120e:80w sst ! This plot was incorrect
IF 0 THEN LET a = 12 IF `a` THEN say "variable a is defined" ENDIF ENDIFShould just skip all the contents of the IF. Instead it resulted in an error: "**ERROR: variable unknown or not in data set: A"