Changeset 128 for trunk/SRC/Utilities
- Timestamp:
- 07/06/06 16:32:02 (18 years ago)
- Location:
- trunk/SRC/Utilities
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Utilities/createfunc.pro
r121 r128 3 3 ;------------------------------------------------------------ 4 4 ;+ 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. 6 7 ; usefull to avoid the use of execute 7 8 ; 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 9 10 ; given back by the function. (see examples) 10 11 ; 11 ; @keyword FILENAMEIN {in} {default=for_createfunc.pro} 12 ; @keyword FILENAMEIN {in} {default=for_createfunc.pro} 12 13 ; name of the function to be created. 13 14 ; … … 18 19 ; @keyword _EXTRA used to pass your keywords to the created function. 19 20 ; 20 ; @restrictions 21 ; @restrictions 21 22 ; - arguments can be given only through keywords; 22 23 ; - ends the function name with '.pro' if needed. 23 24 ; 24 25 ; @examples 25 ; 26 ; 27 ; 26 ; IDL> print, createfunc('3*2', filename='test') 27 ; IDL> print, createfunc('3*two', filename = 'test' $ 28 ; IDL> , kwdlist ='two = two', two = 2) 28 29 ; 29 30 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) -
trunk/SRC/Utilities/createpro.pro
- Property svn:eol-style deleted
- Property svn:executable deleted
r121 r128 3 3 ;------------------------------------------------------------ 4 4 ;+ 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. 6 7 ; 7 8 ; @param command {in}{required} a string array defining the procedure to be created. each element will be a line of the created procedure. … … 24 25 ; 25 26 ; @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 32 32 ; 33 33 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) -
trunk/SRC/Utilities/def_myuniquetmpdir.pro
- Property svn:executable deleted
r118 r128 1 1 ;+ 2 ; @file_comments if needed, define and create myuniquetmpdir 2 ; @file_comments 3 ; if needed, define and create myuniquetmpdir 3 4 ; (common variable from cm_general) and add it to !path 4 5 ; 5 6 ; @categories utilities 6 7 ; 7 ; @examples 8 ; @examples 8 9 ; IDL> def_myuniquetmpdir 9 10 ; … … 28 29 myuniquetmpdir = file_search(getenv('IDL_TMPDIR'), /mark_directory) 29 30 myuniquetmpdir = myuniquetmpdir[0] + login[0] + '.' $ 30 + strtrim(long(systime(1)), 1) + '/' 31 + strtrim(long(systime(1)), 1) + '/' 31 32 ; create it 32 33 file_mkdir, myuniquetmpdir -
trunk/SRC/Utilities/demomode_compatibility.pro
- Property svn:executable deleted
r118 r128 18 18 ; 2) copy oldcm_full(_empty) to myuniquetmpdir+'oldcm_used.pro' 19 19 ; 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 21 21 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 24 24 ; create an empty file... 25 25 ; close the journal if already open … … 28 28 journal, myuniquetmpdir + 'cm_demomode_used.pro' 29 29 ; close it (-> it will be empty) 30 journal 31 ENDELSE 30 journal 31 ENDELSE 32 32 33 33 return -
trunk/SRC/Utilities/find.pro
- Property svn:eol-style deleted
- Property svn:executable deleted
r121 r128 3 3 ;------------------------------------------------------------ 4 4 ;+ 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. 9 12 ; 10 13 ; @categories find a file … … 21 24 ; 22 25 ; @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. 24 27 ; Different directories can be separated by 25 28 ; path_sep(/search_path) (':' on unix type machine) as it is done … … 39 42 ; 40 43 ; @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 42 45 ; subdirectories in the file hierarchy rooted at the IODIRECTORY 43 ; argument. 46 ; argument. 44 47 ; 45 48 ; @keyword REPERTOIRE obsolete. keep for compatibility, use directory keyword … … 50 53 ; @keyword _EXTRA used to pass your keywords 51 54 ; 52 ; @file_comments all file_search keywords can be used.53 55 ; 54 56 ; @returns A scalar or array variable of string type, containing the … … 57 59 ; the scalar string : 'NOT FOUND' 58 60 ; 59 ; @examples 61 ; @examples 60 62 ; 61 ; IDL> print, find('*loadct')63 ; IDL> print, find('*loadct') 62 64 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 63 65 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 64 ; 66 ; IDL> print, find('*loadct', iodir=!dir,/recursive) 65 67 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 66 68 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 67 ; IDL> print, find('*loadct.pro')69 ; IDL> print, find('*loadct.pro') 68 70 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 69 71 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 70 ; IDL> print, find('*loadct',/nopro)72 ; IDL> print, find('*loadct',/nopro) 71 73 ; 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') 73 75 ; /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) 75 77 ; 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) 77 79 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 78 80 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 79 ; 81 ; IDL> print, find('mesh*', iodirectory = [iodir, !path]) 80 82 ; /Users/sebastie/DATA/ORCA2/meshmaskORCA2closea.nc 81 83 ; /Users/sebastie/IDL/meshmaskclosesea.pro … … 103 105 ; 104 106 CASE 1 OF 105 keyword_set(lookalldir):BEGIN 107 keyword_set(lookalldir):BEGIN 106 108 @cm_general 107 109 dirnames = [iodir, homedir, !path] … … 142 144 ENDCASE 143 145 ; use dirnames only if dir eq '.' 144 IF dir EQ '.' THEN BEGIN 146 IF dir EQ '.' THEN BEGIN 145 147 if keyword_set(recursive) THEN $ 146 148 found = file_search(dirnames, base, _extra = ex) $ 147 149 ELSE found = file_search(dirnames + '/' + base, _extra = ex) 148 150 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 151 153 IF keyword_set(unique) THEN return, found[uniq(found, sort(found))] $ 152 154 ELSE return, found … … 158 160 ELSE fileout = fileout[1:*] 159 161 ; 160 IF n_elements(fileout) GT 1 THEN BEGIN 162 IF n_elements(fileout) GT 1 THEN BEGIN 161 163 IF keyword_set(unique) THEN fileout = fileout[uniq(fileout, sort(fileout))] 162 164 ENDIF ELSE fileout = fileout[0] -
trunk/SRC/Utilities/isadirectory.pro
- Property svn:eol-style deleted
- Property svn:executable deleted
r118 r128 3 3 ;------------------------------------------------------------ 4 4 ;+ 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. 7 8 ; 8 9 ; @categories io 9 10 ; 10 ; @param directoryin {in}{optional} a proposed directory. If neither dirname 11 ; @param directoryin {in}{optional} a proposed directory. If neither dirname 11 12 ; input parameter of IODIRECTORY keyword are defined, 12 13 ; the ask the user to choose a directory. … … 22 23 ; @returns the directory name 23 24 ; 24 ; @examples 25 ; @examples 25 26 ; 26 ; 27 ; IDL> print, !dir 27 28 ; /usr/local/rsi/idl_6.0 28 ; 29 ; IDL> print, isadirectory(!dir) 29 30 ; /usr/local/rsi/idl_6.0/ 30 ; 31 ; IDL> print, isadirectory(!dir+'notgood') 31 32 ; 32 33 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) -
trunk/SRC/Utilities/isafile.pro
- Property svn:eol-style deleted
- Property svn:executable deleted
r121 r128 3 3 ;------------------------------------------------------------ 4 4 ;+ 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. 7 8 ; 8 9 ; @categories io 9 10 ; 10 ;11 11 ; @param filein {in}{optional} a proposed name. If neither filein 12 12 ; input parameter of filename keyword are defined, … … 27 27 ; 28 28 ; @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 30 30 ; subdirectories in the file hierarchy rooted at the IODIRECTORY 31 ; argument. 31 ; argument. 32 32 ; 33 33 ; @keyword _EXTRA used to pass your keywords … … 37 37 ; @returns the filename with its path 38 38 ; 39 ; @examples 39 ; @examples 40 40 ; 41 ; 41 ; IDL> print, isafile('/Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro') 42 42 ; /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 43 ; 43 ; IDL> print, isafile('cm_4mesh.pro', iodir = '/Users/sebastie/SAXO_RD/Commons') 44 44 ; /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 45 ; 45 ; IDL> print, isafile('cm_4mesh.pro', iodir = !path) 46 46 ; /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 47 ; 47 ; IDL> print, isafile('cm_4mesh.pro', iodir = '/Users/sebastie/SAXO_RD', /recursive) 48 48 ; /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 49 ; 49 ; IDL> print, isafile('cm_4mesh.pro', iodir = getenv('HOME'), /recursive) 50 50 ; /Users/sebastie/SAXO_RD/Commons/cm_4mesh.pro 51 ; 51 ; IDL> print, isafile('fake_file.pro') 52 52 ; 53 53 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) -
trunk/SRC/Utilities/protype.pro
r118 r128 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; @file_comments test is a ".pro" file corresponds to an IDL procedure,6 ; 5 ; @file_comments 6 ; test is a ".pro" file corresponds to an IDL procedure, function or batch file. 7 7 ; 8 8 ; @categories utilities … … 14 14 ; @returns A scalar of string type: 'proc', 'func' or 'batch' 15 15 ; 16 ; @examples 16 ; @examples 17 17 ; 18 ; 18 ; IDL> print, protype('protype') 19 19 ; func 20 ; 20 ; IDL> print, protype('protype.pro') 21 21 ; func 22 ; 22 ; IDL> print, protype('init') 23 23 ; batch 24 ; 24 ; IDL> print, protype('plt') 25 25 ; proc 26 26 ; … … 51 51 ELSE:RETURN, 'batch' 52 52 ENDCASE 53 53 54 54 RETURN, -1 55 55 END
Note: See TracChangeset
for help on using the changeset viewer.