Changeset 128 for trunk/SRC/Utilities


Ignore:
Timestamp:
07/06/06 16:32:02 (18 years ago)
Author:
pinsard
Message:

improvements of Utilities/*.pro header

Location:
trunk/SRC/Utilities
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Utilities/createfunc.pro

    r121 r128  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; @file_comments write an idl function, compile it and execute it. 
     5; @file_comments 
     6; write an idl function, compile it and execute it. 
    67; usefull to avoid the use of execute 
    78; 
    8 ; @param command {in}{required} a scalar string defining the result to be  
     9; @param command {in}{required} a scalar string defining the result to be 
    910; given back by the function. (see examples) 
    1011; 
    11 ; @keyword FILENAMEIN {in} {default=for_createfunc.pro}  
     12; @keyword FILENAMEIN {in} {default=for_createfunc.pro} 
    1213; name of the function to be created. 
    1314; 
     
    1819; @keyword _EXTRA used to pass your keywords to the created function. 
    1920; 
    20 ; @restrictions  
     21; @restrictions 
    2122; - arguments can be given only through keywords; 
    2223; - ends the function name with '.pro' if needed. 
    2324; 
    2425; @examples 
    25 ;      IDL> print, createfunc('3*2', filename='test') 
    26 ;      IDL> print, createfunc('3*two', filename = 'test' $ 
    27 ;                                    , kwdlist ='two = two', two = 2) 
     26; IDL> print, createfunc('3*2', filename='test') 
     27; IDL> print, createfunc('3*two', filename = 'test' $ 
     28; IDL>                          , kwdlist ='two = two', two = 2) 
    2829; 
    2930; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 
  • trunk/SRC/Utilities/createpro.pro

    • Property svn:eol-style deleted
    • Property svn:executable deleted
    r121 r128  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; @file_comments write an idl procedure, compile it and execute it. 
     5; @file_comments 
     6; write an idl procedure, compile it and execute it. 
    67; 
    78; @param command {in}{required} a string array defining the procedure to be created. each element will be a line of the created procedure. 
     
    2425; 
    2526; @examples 
    26 ;      IDL> createpro, ['print,''OK'''], filename='test' 
    27 ;      IDL> createpro, ['if keyword_set(ok) then print,''OK'' else print, ''No'''] $ 
    28 ;      IDL>   , filename = 'test', kwdlist =', ok = ok' 
    29 ;      IDL> createpro, ['if keyword_set(ok) then print,''OK'' else print, ''No'''] $ 
    30 ;      IDL>   , filename = 'test', kwdlist = ', ok = ok', /ok 
    31 ; 
     27; IDL> createpro, ['print,''OK'''], filename='test' 
     28; IDL> createpro, ['if keyword_set(ok) then print,''OK'' else print, ''No'''] $ 
     29; IDL>   , filename = 'test', kwdlist =', ok = ok' 
     30; IDL> createpro, ['if keyword_set(ok) then print,''OK'' else print, ''No'''] $ 
     31; IDL>   , filename = 'test', kwdlist = ', ok = ok', /ok 
    3232; 
    3333; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 
  • trunk/SRC/Utilities/def_myuniquetmpdir.pro

    • Property svn:executable deleted
    r118 r128  
    11;+ 
    2 ; @file_comments if needed, define and create myuniquetmpdir 
     2; @file_comments 
     3; if needed, define and create myuniquetmpdir 
    34; (common variable from cm_general) and add it to !path 
    45; 
    56; @categories utilities 
    67; 
    7 ; @examples  
     8; @examples 
    89; IDL> def_myuniquetmpdir 
    910; 
     
    2829    myuniquetmpdir = file_search(getenv('IDL_TMPDIR'), /mark_directory) 
    2930    myuniquetmpdir = myuniquetmpdir[0] + login[0] + '.' $ 
    30                   + strtrim(long(systime(1)), 1) + '/'  
     31                  + strtrim(long(systime(1)), 1) + '/' 
    3132; create it 
    3233    file_mkdir, myuniquetmpdir 
  • trunk/SRC/Utilities/demomode_compatibility.pro

    • Property svn:executable deleted
    r118 r128  
    1818; 2) copy oldcm_full(_empty) to myuniquetmpdir+'oldcm_used.pro' 
    1919; select which file should be copied to oldcm_used.pro 
    20   IF lmgr(/demo) EQ 1 THEN BEGIN  
     20  IF lmgr(/demo) EQ 1 THEN BEGIN 
    2121     democm = find('cm_demomode') 
    22      file_copy, democm, myuniquetmpdir + 'cm_demomode_used.pro', /overwrite   
    23   ENDIF ELSE BEGIN  
     22     file_copy, democm, myuniquetmpdir + 'cm_demomode_used.pro', /overwrite 
     23  ENDIF ELSE BEGIN 
    2424; create an empty file... 
    2525; close the journal if already open 
     
    2828    journal, myuniquetmpdir + 'cm_demomode_used.pro' 
    2929; close it (-> it will be empty) 
    30     journal    
    31   ENDELSE  
     30    journal 
     31  ENDELSE 
    3232 
    3333  return 
  • trunk/SRC/Utilities/find.pro

    • Property svn:eol-style deleted
    • Property svn:executable deleted
    r121 r128  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; @file_comments based on file_search, but it is possible to specify 
    6 ;          a set of possibles names and a different set of 
    7 ;          possibles directories names. 
    8 ;          By default look for files included in !path 
     5; @file_comments 
     6; based on file_search, but it is possible to specify 
     7; a set of possibles names and a different set of 
     8; possibles directories names. 
     9; By default look for files included in !path 
     10; 
     11; all file_search keywords can be used. 
    912; 
    1013; @categories find a file 
     
    2124; 
    2225; @keyword IODIRECTORY {default=!path} A scalar or array variable of string type, containing 
    23 ;        directories names where we are looking for the file.   
     26;        directories names where we are looking for the file. 
    2427;        Different directories can be separated by 
    2528;        path_sep(/search_path) (':' on unix type machine) as it is done 
     
    3942; 
    4043; @keyword RECURSIVE performs recursive searching of directory hierarchies. 
    41 ;        In a recursive search, find looks recursively for any and all  
     44;        In a recursive search, find looks recursively for any and all 
    4245;        subdirectories in the file hierarchy rooted at the IODIRECTORY 
    43 ;        argument.  
     46;        argument. 
    4447; 
    4548; @keyword REPERTOIRE obsolete. keep for compatibility, use directory keyword 
     
    5053; @keyword _EXTRA used to pass your keywords 
    5154; 
    52 ; @file_comments all file_search keywords can be used. 
    5355; 
    5456; @returns A scalar or array variable of string type, containing the 
     
    5759;       the scalar string : 'NOT FOUND' 
    5860; 
    59 ; @examples  
     61; @examples 
    6062; 
    61 ;   IDL> print, find('*loadct')   
     63; IDL> print, find('*loadct') 
    6264;   /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 
    6365;   /usr/local/rsi/idl_6.0/lib/loadct.pro 
    64 ;   IDL> print, find('*loadct', iodir=!dir,/recursive) 
     66; IDL> print, find('*loadct', iodir=!dir,/recursive) 
    6567;   /usr/local/rsi/idl_6.0/lib/loadct.pro 
    6668;   /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 
    67 ;   IDL> print, find('*loadct.pro')   
     69; IDL> print, find('*loadct.pro') 
    6870;   /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 
    6971;   /usr/local/rsi/idl_6.0/lib/loadct.pro 
    70 ;   IDL> print, find('*loadct',/nopro)   
     72; IDL> print, find('*loadct',/nopro) 
    7173;   NOT FOUND 
    72 ;   IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib')   
     74; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib') 
    7375;   /usr/local/rsi/idl_6.0/lib/loadct.pro 
    74 ;   IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /test_write)   
     76; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /test_write) 
    7577;   NOT FOUND 
    76 ;   IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /recursive)   
     78; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /recursive) 
    7779;   /usr/local/rsi/idl_6.0/lib/loadct.pro 
    7880;   /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 
    79 ;   IDL> print, find('mesh*', iodirectory = [iodir, !path]) 
     81; IDL> print, find('mesh*', iodirectory = [iodir, !path]) 
    8082;   /Users/sebastie/DATA/ORCA2/meshmaskORCA2closea.nc 
    8183;   /Users/sebastie/IDL/meshmaskclosesea.pro 
     
    103105; 
    104106  CASE 1 OF 
    105     keyword_set(lookalldir):BEGIN  
     107    keyword_set(lookalldir):BEGIN 
    106108@cm_general 
    107109      dirnames = [iodir, homedir, !path] 
     
    142144    ENDCASE 
    143145; use dirnames only if dir eq '.' 
    144     IF dir EQ  '.' THEN BEGIN  
     146    IF dir EQ  '.' THEN BEGIN 
    145147      if keyword_set(recursive) THEN $ 
    146148        found = file_search(dirnames, base, _extra = ex) $ 
    147149        ELSE found = file_search(dirnames + '/' + base, _extra = ex) 
    148150    ENDIF ELSE found = file_search(dir + '/' + base, _extra = ex) 
    149     IF found[0] NE '' THEN BEGIN  
    150       IF keyword_set(firstfound) THEN BEGIN  
     151    IF found[0] NE '' THEN BEGIN 
     152      IF keyword_set(firstfound) THEN BEGIN 
    151153        IF keyword_set(unique) THEN return, found[uniq(found, sort(found))] $ 
    152154        ELSE return, found 
     
    158160  ELSE fileout = fileout[1:*] 
    159161; 
    160   IF n_elements(fileout) GT 1 THEN BEGIN  
     162  IF n_elements(fileout) GT 1 THEN BEGIN 
    161163    IF keyword_set(unique) THEN fileout = fileout[uniq(fileout, sort(fileout))] 
    162164  ENDIF ELSE fileout = fileout[0] 
  • trunk/SRC/Utilities/isadirectory.pro

    • Property svn:eol-style deleted
    • Property svn:executable deleted
    r118 r128  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; @file_comments check if a directory exists and make sure that it ends  
    6 ;         with the directory separator mark. 
     5; @file_comments 
     6; check if a directory exists and make sure that it ends 
     7; with the directory separator mark. 
    78; 
    89; @categories io 
    910; 
    10 ; @param directoryin {in}{optional} a proposed directory. If neither dirname  
     11; @param directoryin {in}{optional} a proposed directory. If neither dirname 
    1112;        input parameter of IODIRECTORY keyword are defined, 
    1213;        the ask the user to choose a directory. 
     
    2223; @returns the directory name 
    2324; 
    24 ; @examples  
     25; @examples 
    2526; 
    26 ;    IDL> print, !dir 
     27; IDL> print, !dir 
    2728;    /usr/local/rsi/idl_6.0 
    28 ;    IDL> print, isadirectory(!dir) 
     29; IDL> print, isadirectory(!dir) 
    2930;    /usr/local/rsi/idl_6.0/ 
    30 ;    IDL> print, isadirectory(!dir+'notgood') 
     31; IDL> print, isadirectory(!dir+'notgood') 
    3132; 
    3233; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 
  • trunk/SRC/Utilities/isafile.pro

    • Property svn:eol-style deleted
    • Property svn:executable deleted
    r121 r128  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; @file_comments same as find.pro except that as long as the file is 'NOT FOUND', 
    6 ;          isafile calls dialog_pickfile, to ask the user to select a file. 
     5; @file_comments 
     6; same as find.pro except that as long as the file is 'NOT FOUND', 
     7; isafile calls dialog_pickfile, to ask the user to select a file. 
    78; 
    89; @categories io 
    910; 
    10 ;  
    1111; @param filein {in}{optional} a proposed name. If neither filein 
    1212;        input parameter of filename keyword are defined, 
     
    2727; 
    2828; @keyword RECURSIVE performs recursive searching of directory hierarchies. 
    29 ;        In a recursive search, find looks recursively for any and all  
     29;        In a recursive search, find looks recursively for any and all 
    3030;        subdirectories in the file hierarchy rooted at the IODIRECTORY 
    31 ;        argument.  
     31;        argument. 
    3232; 
    3333; @keyword _EXTRA used to pass your keywords 
     
    3737; @returns the filename with its path 
    3838; 
    39 ; @examples  
     39; @examples 
    4040; 
    41 ;  IDL> print, isafile('/Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro') 
     41; IDL> print, isafile('/Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro') 
    4242;  /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 
    43 ;  IDL> print, isafile('cm_4mesh.pro', iodir = '/Users/sebastie/SAXO_RD/Commons') 
     43; IDL> print, isafile('cm_4mesh.pro', iodir = '/Users/sebastie/SAXO_RD/Commons') 
    4444;  /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 
    45 ;  IDL> print, isafile('cm_4mesh.pro', iodir = !path) 
     45; IDL> print, isafile('cm_4mesh.pro', iodir = !path) 
    4646;  /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 
    47 ;  IDL> print, isafile('cm_4mesh.pro', iodir = '/Users/sebastie/SAXO_RD', /recursive) 
     47; IDL> print, isafile('cm_4mesh.pro', iodir = '/Users/sebastie/SAXO_RD', /recursive) 
    4848;  /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 
    49 ;  IDL> print, isafile('cm_4mesh.pro', iodir = getenv('HOME'), /recursive) 
     49; IDL> print, isafile('cm_4mesh.pro', iodir = getenv('HOME'), /recursive) 
    5050;  /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 
    51 ;  IDL> print, isafile('fake_file.pro') 
     51; IDL> print, isafile('fake_file.pro') 
    5252; 
    5353; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 
  • trunk/SRC/Utilities/protype.pro

    r118 r128  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; @file_comments test is a ".pro" file corresponds to an IDL procedure, 
    6 ;         function or batch file. 
     5; @file_comments 
     6; test is a ".pro" file corresponds to an IDL procedure, function or batch file. 
    77; 
    88; @categories utilities 
     
    1414; @returns A scalar of string type: 'proc', 'func' or 'batch' 
    1515; 
    16 ; @examples  
     16; @examples 
    1717; 
    18 ;      IDL> print, protype('protype') 
     18; IDL> print, protype('protype') 
    1919;      func 
    20 ;      IDL> print, protype('protype.pro') 
     20; IDL> print, protype('protype.pro') 
    2121;      func 
    22 ;      IDL> print, protype('init') 
     22; IDL> print, protype('init') 
    2323;      batch 
    24 ;      IDL> print, protype('plt') 
     24; IDL> print, protype('plt') 
    2525;      proc 
    2626; 
     
    5151    ELSE:RETURN, 'batch' 
    5252  ENDCASE 
    53    
     53  
    5454  RETURN, -1 
    5555END 
Note: See TracChangeset for help on using the changeset viewer.