Ignore:
Timestamp:
08/09/06 12:12:54 (18 years ago)
Author:
navarro
Message:

english and nicer header (3a)

Location:
trunk/SRC/ToBeReviewed/STRUCTURE
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/STRUCTURE/chkstru.pro

    r134 r150  
    1 ; $Id$ 
    21;------------------------------------------------------------- 
    32;+ 
    4 ; NAME: 
    5 ;        CHKSTRU  (function) 
     3; @file_comments 
     4; check validity of a structure and test if necessary 
     5; fields are contained 
    66; 
    7 ; PURPOSE: 
    8 ;        check validity of a structure and test if necessary 
    9 ;        fields are contained 
     7; @categories 
     8; tools 
    109; 
    11 ; CATEGORY: 
    12 ;        tools 
     10; @param  STRUCTURE {in}{required} 
     11; The structure to be tested. If STRUCTURE is 
     12; not of type structure, the function will return 0 
    1313; 
    14 ; CALLING SEQUENCE: 
    15 ;        res=CHKSTRU(STRUCTURE,FIELDS [,/VERBOSE])  
     14; @param FIELDS {in}{required} 
     15; A string or string array with field names to  
     16; be contained in STRUCTURE. CHKSTRU returns 1 (true) 
     17; only if all field names are contained in STRUCTURE. 
     18; The entries of FIELDS may be upper or lowercase. 
    1619; 
    17 ; INPUTS: 
    18 ;        STRUCTURE --> the structure to be tested. If STRUCTURE is 
    19 ;             not of type structure, the function will return 0 
     20; @keyword INDEX 
     21; A named variable that will contain the indices of 
     22; the required field names in the structure. They can then 
     23; be assessed through structure.(index[i]) . Index will 
     24; contain -1 for all fields entries that are not in the 
     25; structure. 
    2026; 
    21 ;        FIELDS --> a string or string array with field names to  
    22 ;             be contained in STRUCTURE. CHKSTRU returns 1 (true) 
    23 ;             only if all field names are contained in STRUCTURE. 
    24 ;             The entries of FIELDS may be upper or lowercase. 
     27; @keyword VERBOSE 
     28; set this keyword to return an error message  
     29; in case of an error. 
    2530; 
    26 ; KEYWORD PARAMETERS: 
    27 ;        INDEX --> a named variable that will contain the indices of 
    28 ;             the required field names in the structure. They can then 
    29 ;             be assessed through structure.(index[i]) . Index will 
    30 ;             contain -1 for all fields entries that are not in the 
    31 ;             structure. 
     31; @keyword EXTRACT 
     32; set this keyword to extract a fields from the 
     33; structure.  -1 is return is fields or structure. are 
     34; incorrect. 
    3235; 
    33 ;        /VERBOSE --> set this keyword to return an error message  
    34 ;             in case of an error. 
     36; @returns 
     37; CHKSTRU returns 1 if successful, otherwise 0. 
    3538; 
    36 ;        /EXTRACT --> set this keyword to extract a fields from the 
    37 ;        structure.  -1 is return is fields or structure. are 
    38 ;        incorrect. 
    39 ; 
    40 ; OUTPUTS: 
    41 ;        CHKSTRU returns 1 if successful, otherwise 0. 
    42 ; 
    43 ; SUBROUTINES: 
    44 ; 
    45 ; REQUIREMENTS: 
    46 ; 
    47 ; NOTES: 
    48 ; 
    49 ; EXAMPLE: 
     39; @examples 
    5040;        test = { a:1, b:2, c:3 } 
    5141;        required = ['a','c'] 
     
    5646;               2 
    5747; 
    58 ; MODIFICATION HISTORY: 
     48; @history 
    5949;        mgs, 02 Mar 1998: VERSION 1.00 
    6050;        mgs, 07 Apr 1998: - second parameter (FIELDS) now optional 
    6151;        12 Jan 2001: EXTRACT keyword by S. Masson (smasson@lodyc.jussieu.fr)  
     52; 
     53; @version 
     54; $Id$ 
    6255; 
    6356;- 
  • trunk/SRC/ToBeReviewed/STRUCTURE/extractstru.pro

    r134 r150  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME:extractstru 
     5; @file_comments 
     6; extract elements of a structure to constitute a new structure. 
    67; 
    7 ; PURPOSE:extrait des elements d''une structure pour constituer une 
    8 ;         nouvelle structure 
     8; @categories 
     9; utilities 
    910; 
    10 ; CATEGORY: dibouille sur les structures 
     11; @param STRU {in}{required} 
     12; A structure 
    1113; 
    12 ; CALLING SEQUENCE: res = extractstru(stru, liste) 
    13 ;  
    14 ; INPUTS: 
     14; @param LISTE {in}{required} 
     15; A vector of string including names of STRU to be deleted  
     16; (by default) or to be kept (if KEEP is activated). 
    1517; 
    16 ;    stru: une structure 
     18; @keyword KEEP 
     19; Specify that the given liste concern elements of STRU to be kept. 
    1720; 
    18 ;    liste: un vecteur de string comportant les noms des elements de 
    19 ;    stru a virer (par DEFAUT) ou a garder (si GARDE est active) 
     21; @keyword DELETE: 
     22; Specify  that the given liste concern elements of STRU to be deleted. 
     23; This keyword is activated by default. 
    2024; 
    21 ; KEYWORD PARAMETERS: 
     25; @returns 
     26; A structure or -1 in case of problem 
    2227; 
    23 ;    /GARDE: specifie que la liste donnee concerne les elements de 
    24 ;    stru a garder 
    25 ; 
    26 ;    /VIRE: specifie que la liste donnee concerne les elements de 
    27 ;    stru a virer. Ce mot cle est active par defaut 
    28 ; 
    29 ; OUTPUTS:une stucture ou -1 en cas de pb 
    30 ; 
    31 ; COMMON BLOCKS: 
    32 ; 
    33 ; SIDE EFFECTS: 
    34 ; 
    35 ; RESTRICTIONS: none !!! 
    36 ;    liste peut contenir des noms d''elements qui ne sont pas ds stru, 
    37 ;    le programme se debrouille avec 
    38 ; 
    39 ; EXAMPLE: 
     28; @examples 
    4029; 
    4130;    IDL> extra=get_extra(/ok, year=1999, age_capitaine=35 ) 
     
    4837;    ** Structure <831afac>, 1 tags, length=2, refs=1: 
    4938;       AGE_CAPITAINE   INT             35 
    50 ;    IDL> help, extractstru(extra,['ok','hhuihi','YEAR'],/garde),/stru 
     39;    IDL> help, extractstru(extra,['ok','hhuihi','YEAR'],/keep),/stru 
    5140;    ** Structure <834bbc4>, 2 tags, length=4, refs=1: 
    5241;       OK              INT              1 
    5342;       YEAR            INT           1999 
    5443; 
    55 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 
     44; @history 
     45; Sebastien Masson (smasson@lodyc.jussieu.fr) 
    5646;                      8/10/1999 
     47; 
     48; @version 
     49; $Id$ 
     50;  
    5751;- 
    5852;------------------------------------------------------------ 
    5953;------------------------------------------------------------ 
    6054;------------------------------------------------------------ 
    61 FUNCTION extractstru, stru, liste, GARDE = garde, VIRE = vire 
     55FUNCTION extractstru, stru, liste, KEEP = keep, DELETE = delete 
    6256; 
    6357  compile_opt idl2, strictarrsubs 
     
    6559   if size(stru, /type) NE 8 then return,  -1 
    6660   if size(liste, /type) NE 7 then return,  -1 
    67 ; cheking for garde and vire keywords 
    68    garde = keyword_set(garde)*(1-keyword_set(vire)) 
    69    vire = keyword_set(vire)*(1-keyword_set(garde)) +(keyword_set(vire) EQ garde) 
     61; cheking for keep and vire keywords 
     62   keep = keyword_set(keep)*(1-keyword_set(delete)) 
     63   delete = keyword_set(delete)*(1-keyword_set(keep)) +(keyword_set(delete) EQ keep) 
    7064; 
    7165   tname = tag_names(stru) 
    7266   index = make_selection(tname, strupcase(liste), /only_valid, /quiet) 
    7367; 
    74    if garde then BEGIN ; on garde que la liste 
     68   if keep then BEGIN ; We just keep the list 
    7569      if index[0] EQ -1 then return,  -1 
    7670      if n_elements(index) EQ n_elements(tname) then return, stru 
     
    7872      if n_elements(index) GT 1 then for i = 1, n_elements(index)-1 do $ 
    7973            res = create_struct(res, tname[index[i]], stru.(index[i])) 
    80    ENDIF ELSE BEGIN ; on vire la liste 
     74   ENDIF ELSE BEGIN ; We delete the list 
    8175      if n_elements(index) EQ n_elements(tname) then return,  -1 
    8276      if index[0] EQ -1 then return, stru 
    83 ; on prend le complementaire de index pour obtenir les indices que 
    84 ; l''on garde 
     77; We take the complementary one of index to obtain indexes we keep. 
    8578      index = different(indgen(n_elements(tname)), index) 
    8679      res = create_struct(tname[index[0]], stru.(index[0])) 
  • trunk/SRC/ToBeReviewed/STRUCTURE/mixstru.pro

    r134 r150  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME: mixstru 
    65; 
    7 ; PURPOSE: concatene 2 structures ensemble. La difference avec 
    8 ; CREATE_STRUCT etant que si les 2 stuctures ont les memes noms 
    9 ; d''elements alors mixstru ne plante pas mais choisit pour valeur de 
    10 ; l''element commun celle specifiee par la premiere structure. 
     6; @file_comments 
     7; Concatenate 2 structures together. The difference with CREATE_STRUCT  
     8; is  that if the 2 structure have same elements's name, then mixstru  
     9; do not break down but choose for the common element the value  
     10; specified by the first structure. 
    1111; 
    12 ; CATEGORY: structure 
     12; @categories 
     13; structure 
     14;  
     15; @param STRU1 {in}{required} 
     16; Structure which can have same elements's name than  
     17; STRU2 but with a different value. 
    1318; 
    14 ; CALLING SEQUENCE: rs=mixstru(stru1,stru2) 
    15 ;  
    16 ; INPUTS: stru1 et stu2 sont 2 structures qui peuvent avoir des 
    17 ; elements portant le meme nom mais avec une valeur differente. 
     19; @param STRU2 {in}{required} 
     20; Structure which can have same elements's name than  
     21; STRU1 but with a different value. 
    1822; 
    19 ; KEYWORD PARAMETERS: none 
     23; @returns 
     24; A stucture 
    2025; 
    21 ; OUTPUTS: une stucture 
     26; @restrictions 
     27; If STRU1 or  STRU2 is not a structure, mixstru send back -1 
    2228; 
    23 ; COMMON BLOCKS: 
    24 ; 
    25 ; SIDE EFFECTS: si stru1 ou stru2 ne sont pas des structures mixstru 
    26 ; renvoie -1 
    27 ; 
    28 ; RESTRICTIONS: 
    29 ; 
    30 ; EXAMPLE: 
     29; @examples 
    3130;      
    3231;     IDL> a=get_extra(/toto,ok=123) 
     
    5352;        YEAR            INT           1999 
    5453; 
    55 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 
     54; @history 
     55; Sebastien Masson (smasson@lodyc.jussieu.fr) 
    5656;                      7/10/1999 
     57; 
     58; @version 
     59; $Id$ 
     60; 
    5761;- 
    5862;------------------------------------------------------------ 
  • trunk/SRC/ToBeReviewed/STRUCTURE/struct2string.pro

    r134 r150  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME:struct2string 
     5;  
     6; @file_comments 
     7; Convert a structure to an "executable string" 
    68; 
    7 ; PURPOSE:convert a structure to an "executable string" 
     9; @categories 
     10; utilities 
     11;  
     12; @param STRUCT {in}{required} 
     13; A structure 
    814; 
    9 ; CATEGORY:bidouille 
     15; @keyword MAX_STRUCT_LENGTH 
     16; The maximum length of the structure 
     17; permetted to convert the structure to string. Default is 
     18; 10000l. 
    1019; 
    11 ; CALLING SEQUENCE:sting=struct2string(struct) 
    12 ;  
    13 ; INPUTS:struct: a structure 
     20; @keyword DIRECT2STRING 
     21; To get a string instead an "executable string" 
    1422; 
    15 ; KEYWORD PARAMETERS: 
     23; @keyword CUT_IN_STRING 
     24; Try it 
    1625; 
    17 ;      MAX_STRUCT_LENGTH : the maximum length of the structure 
    18 ;      permetted to convert the structure to string. Default is 
    19 ;      10000l. 
     26; @restrictions 
     27; Use tostr.pro, cf this function header! 
    2028; 
    21 ;      /DIRECT2STRING: to get a string instead an "executable string" 
    22 ; 
    23 ;      /CUT_IN_STRING: try it 
    24 ; 
    25 ; OUTPUTS: 
    26 ; 
    27 ; SIDE EFFECTS:use tostr.pro, cf this function header! 
    28 ; 
    29 ; RESTRICTIONS:use tostr.pro, cf this function header! 
    30 ; 
    31 ; EXAMPLE: 
     29; @examples 
    3230; 
    3331;      IDL> print, struct2string(!d) 
     
    3836;      ,[0,0],'ZOOM',[1,1]) 
    3937; 
    40 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 
     38; @history 
     39; Sebastien Masson (smasson@lodyc.jussieu.fr) 
    4140;                      2000 07 03 
     41; 
     42; @version 
     43; $Id$ 
     44; 
    4245;- 
    4346;------------------------------------------------------------ 
  • trunk/SRC/ToBeReviewed/STRUCTURE/where_tag.pro

    r134 r150  
    11;+ 
    2 ; NAME: 
    3 ;       WHERE_TAG 
    4 ; PURPOSE: 
    5 ;       Like WHERE but works on structure tag names 
    6 ; EXPLANATION: 
    7 ;       Obtain subscripts of elements in structure array for which 
    8 ;       a particular Tag has values in a range or matching specified values. 
    9 ;       Like the WHERE function but for use with structures 
    10 ; CATEGORY: 
    11 ;                       Structures 
    12 ; CALLING SEQUENCE: 
    13 ;        w = where_tag( struct, [ Nfound,  TAG_NAME=, TAG_NUMBER = , RANGE =,  
    14 ;                               VALUES =, RANGE =, ISELECT =, /NOPRINT ] 
     2; @file_comments 
     3; Like WHERE but works on structure tag names 
     4; Obtain subscripts of elements in structure array for which 
     5; a particular Tag has values in a range or matching specified values. 
     6; Like the WHERE function but for use with structures 
     7;  
     8; @categories 
     9; Structures 
    1510; 
    16 ; INPUTS: 
    17 ;       Struct = structure array to search. 
     11; @param STRUCT {in}{required} 
     12; structure array to search. 
    1813; 
    19 ; INPUT KEYWORDS: 
    20 ;       User *must* specify (1) TAG_NAME or TAG_NUMBER to search, and (2) 
    21 ;               the VALUES or RANGE to search on 
     14; @keyword TAG_NAME 
     15; Scalar string specifying Tag Name 
     16;  
     17; @keyword TAG_NUMBER 
     18; Otherwise give the Tag Number, 
     19;  
     20; @keyword RANGE 
     21;  [min,max] range to search for in Struct 
     22;  
     23; @keyword VALUES 
     24; One or array of numbers to match for in Struct, 
     25;  
     26; @keyword ISELECT 
     27; Specifies indices to select only part of structure array, 
     28; (use it to recycle subscripts from previous searches). 
     29;  
     30; @keyword NOPRINT 
     31; Suppress informational messages about nothing found. 
    2232; 
    23 ;       TAG_NAME = Scalar string specifying Tag Name 
    24 ;       TAG_NUMBER = otherwise give the Tag Number, 
    25 ;       RANGE = [min,max] range to search for in Struct, 
    26 ;       VALUES = one or array of numbers to match for in Struct, 
    27 ;       ISELECT= specifies indices to select only part of structure array, 
    28 ;               (use it to recycle subscripts from previous searches). 
    29 ;       /NOPRINT = suppress informational messages about nothing found. 
     33; @returns 
     34; Nfound {out} 
     35; # of occurences found. 
     36;  
     37; @restrictions 
     38; User *must* specify (1) TAG_NAME or TAG_NUMBER to search, and (2) 
     39; the VALUES or RANGE to search on; 
    3040; 
    31 ; OUTPUTS: 
    32 ;       Nfound = # of occurences found. 
    33 ; 
    34 ; RESULT: 
    35 ;       Function returns subscripts (indices) to desired elements. 
    36 ; 
    37 ; EXAMPLES: 
     41; @examples 
    3842;       Suppose STR is a structure with tags CAT_NO:indgen(10), and  
    3943;               NAME:strarr(10).   Find the indices where STR.CAT_NO is 
     
    4347;       IDL> print, WHERE_TAG( str, TAG_NUM = 0, RANGE = [3,5])  
    4448; 
    45 ; PROCEDURE: 
    46 ;       Get tag number and apply the WHERE function appropriately. 
    47 ; 
    48 ; MODIFICATION HISTORY: 
     49; @history 
    4950;       written 1990 Frank Varosi STX @ NASA/GSFC 
    5051;       Stop printing "Tag <xxx> not found" with /NOPRINT, CD Pike 8-Jun-93 
     52; 
     53; @version 
     54; $Id$ 
     55;  
    5156;- 
    5257function where_Tag, Struct, Nfound,     TAG_NAME=Tag_Name,      $ 
Note: See TracChangeset for help on using the changeset viewer.