A modified version of IDL, that features tight integration with the RPN standard files, is available.
The package offers the following functionalities:
initrmnlib
Users that employed the old FST integration package, fstprocs, can still use it using the command
.run fstprocs98
after having started idl.
However, fstprocs98 is required only if one wants to use FSTLIR.This function will continue to be supported, however users are encouraged to use the newer ones, especially if they are building code from scratch.
The scripts that were using fstprocs will run under the new package without much modification; slight adjustments are necessary for fstouv and fstfrm.
ref_tt1000 = fstinf(unit=iun, nomvar='TT', ip1=1000,
ip2=0)
prm_tt1000 = fstprm(ref=ref_tt1000)
data_tt1000 = fstluk(ref=ref_tt1000)
with fstlir, it was more like
tt1000=fstlir(unit=iun, nomvar='TT', ip1=1000, ip2=0)
the parameter and the data part of the structure are part of the same record, and the data has to be accessed via the "data" field of the structure (eg. tt1000.data)
"newvar=fstprm(ref= -1)"
pollux 4% idl Loading Standard File Extensions (RPN-1997) New functions : FSTOUV, FSTFRM, FSTPRM, FSTINF, FSTLUK, FSTECR, NEWDATE, DATARITH For calling sequence information junk=FUNCTION_NAME(/HELP) IDL Version 5.0.2 (IRIX mipseb). Research Systems, Inc. Installation number: 10424-0. Licensed for use by: ENVIRONNEMENT CANADA For basic information, enter "IDLInfo" at the IDL> prompt.
;
; The following show what we get when we invoke the help option
;
IDL> initrmnlib % Compiled module: INITRMNLIB. Loading Standard File Extensions (RPN-1997) New functions : FSTOUV, FSTFRM, FSTPRM, FSTINF, FSTLUK, FSTECR, NEWDATE, DATARITH For calling sequence information junk=FUNCTION_NAME(/HELP) IDL> junk=fstouv(/help) USAGE: file_number=FSTOUV(UNIT=nnn, FILE='some_file_name'[,/LINK]) IDL> ier=newdate(/help) USAGE: status=NEWDATE(DATE1=,DATE2=,DATE3=,MODE=) IDL> ier=datarith(/help) USAGE: status=DATARITH(DATE1=,DATE2=,NHOURS=,MODE=+1/-1) IDL> IDL> ier=fstecr(/help) USAGE: status=FSTECR(UNIT=fileno,DESCR=descriptors,DATA=) IDL> ier=fstinf(/help) USAGE: record_handle=FSTINF(UNIT=file_number[,IP1=][,IP2=][,IP3=][,DATE=] [,NOMVAR='name'][,TYPVAR='typ'][,ETIKET='etik'][,/SUI]) USAGE: (UNSPECIFIED keywords will be WILDCARDED) IDL> ier=fstfrm(/help) USAGE: file_number=FSTFRM(UNIT=nnn) IDL> ier=fstprm(/help) USAGE: key_struct=FSTPRM(REF=record_handle) IDL> ier=fstluk(/help) USAGE: data_array=FSTLUK(REF=record_handle)
;
; Here we open 3 standard files that will be linked as one.
;
iun=fstouv(u=0,file='/data/gridpt/dbase/prog/regpres/1997121100_000',/link) UNIT =999 EST OUVERT RANDOM iun=fstouv(u=0,file='/data/gridpt/dbase/prog/regpres/1997121100_006',/link) UNIT =998 EST OUVERT RANDOM iun=fstouv(u=0,file='/data/gridpt/dbase/prog/regpres/1997121100_012') UNIT =997 EST OUVERT RANDOM LINKING 3 files as unit 999
;
; We get the attributes of the 12 hour forecast temperature field at 1000
mb.
; The name of the variable is totally arbitrary.
;
IDL> tt1000_012_ref=fstinf(u=999,n='TT',ip1=1000,ip2=12) IDL> tt1000_012_prm=fstprm(r=tt1000_012_ref) IDL> help,/struct,tt1000_012_prm ** Structure <10063408>, 23 tags, length=108, refs=1: IP1 LONG 1000 IP2 LONG 12 IP3 LONG 0 IG1 LONG 367 IG2 LONG 574 IG3 LONG 1174 IG4 LONG 0 DATE LONG 121197001 DEET LONG 1350 NPAS LONG 32 DATYP LONG 1 NBITS LONG 12 NI LONG 256 NJ LONG 289 NK LONG 1 SWA LONG 4998241 LNG LONG 27748 DLTF LONG 0 UBC LONG 0 NOMVAR STRING 'TT' TYPVAR STRING 'P' ETIKET STRING 'GR35L28N' GRTYP STRING 'Z'
;
; Here we create an empty structure
;
IDL> ref_vide=fstprm(ref=-1) IDL> help,/struct, ref_vide ** Structure <1007c008>, 23 tags, length=108, refs=1: IP1 LONG 0 IP2 LONG 0 IP3 LONG 0 IG1 LONG 0 IG2 LONG 0 IG3 LONG 0 IG4 LONG 0 DATE LONG 0 DEET LONG 0 NPAS LONG 0 DATYP LONG 0 NBITS LONG 0 NI LONG 0 NJ LONG 0 NK LONG 0 SWA LONG 0 LNG LONG 0 DLTF LONG 0 UBC LONG 0 NOMVAR STRING ' ' TYPVAR STRING ' ' ETIKET STRING ' ' GRTYP STRING ' ';
;
; We read the data part of the record and get some statistics.
;
IDL> tt1000_012_data=fstluk(r=tt1000_012_ref) LU(**) 183-TT P 1000 12 0 256 289 1 GR35L28N 5121197001 1350 32 Z 367 574 1174 0 R12 4998241 27748 IDL> print,max(tt1000_012_data) 37.4565 IDL> IDL> print,max(tt1000_012_data) -43.9185 IDL> print,mean(tt1000_012_data) % Compiled module: MEAN. 4.69523
;
; We now read the 1000 mb temperature field, but at time 0.
;
IDL> tt1000_000_ref=fstinf(u=999,n='TT',ip1=1000,ip2=0) IDL> tt1000_000_prm=fstprm(ref=tt1000_000_ref) IDL> tt1000_000_data=fstluk(ref=tt1000_000_ref) LU(**) 4-TT P 1000 0 0 256 289 1 GR35L28N 5121197001 1350 0 Z 367 574 1174 0 R12 57601 27748
;
; We now define a new data array, equal to the difference between the 2
fields
;
IDL> dt1000_012_000_data = tt1000_012_data - tt1000_000_data IDL> print, max(dt1000_012_000_data), min(dt1000_012_000_data), mean(dt1000_012_000_data) 13.0398 -13.5227 -0.317030
;
; We now open another file in which we will write the results
;
iun=fstouv(u=0,f='idltest') UNIT =996 RANDOM EST CREE UNIT =996 EST OUVERT RANDOM LINKING 1 files as unit 996
;
; Before writing the record, we initialize a new structure that will
; contain the parameters part,and we change the IP3 part of the field.
; We then write the field.
;
IDL> dt1000_012_000_prm=tt1000_000_prm IDL> dt1000_012_000_prm.ip3=12 IDL> iun=fstecr(u=iun,prm=dt1000_012_000_prm,data=dt1000_012_000_data) UNIT=996 IP1=1000,IP2=0,IP3=12 NI=256,NJ=289,NK=1 DATE=121197001,DEET=1350,NPAS=0 SWA=57601,LNG=27748,UBC=0 NBITS=12,DATYP=1,DLTF=0 NOMVAR=TT,TYPVAR=P,ETIKET=GR35L28N,GRTYP=Z IG1=367,IG2=574,IG3=1174,IG4=0 ARRAY DIMENSIONS = 256,289,1 ECRIT(**) 0-TT P 1000 0 12 256 289 1 GR35L28N 5121197001 1350 0 Z 367 574 1174 0 R12 1531 27748
;
; We close the file that was opened in write mode and exit
;
IDL> ier=fstfrm(u=996) UNITE FORTRAN IUN= 996 EST FERME IDL> exit