Changeset 69 for trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildcmd.pro
- Timestamp:
- 05/11/06 12:35:53 (18 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildcmd.pro
r68 r69 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:buildc ommand5 ; NAME:buildcmd 6 6 ; 7 7 ; PURPOSE:cette fonction reourne un string qui contient la commande de … … 32 32 ;------------------------------------------------------------ 33 33 ;------------------------------------------------------------ 34 FUNCTION buildcommand, base, FORPLTH = forplth, FORPLTZ = forpltz, FORPLTT = forpltt, BOXZOOM = boxzoom 35 ; 36 ;------------------------------------------------------------ 37 ; on recuper les ID des differents widgets 38 ;------------------------------------------------------------ 39 filelistid = widget_info(base, find_by_uname = 'filelist') 40 champid = widget_info(base, find_by_uname = 'champ') 41 nomexpid = widget_info(base, find_by_uname = 'nom_exp') 42 date1id = widget_info(base, find_by_uname = 'calendar1') 43 date2id = widget_info(base, find_by_uname = 'calendar2') 44 domainid = widget_info(base, find_by_uname = 'domain') 45 graphtypeid = widget_info(base, find_by_uname = 'action') 34 FUNCTION buildcmd, base, BOXZOOM = boxzoom, FORCETYPE = forcetype 35 ; 36 ;------------------------------------------------------------ 37 ; we get back the ids of the widget parts 38 ;------------------------------------------------------------ 39 txtcmdid = widget_info(base, find_by_uname = 'txtcmd') 40 domainid = widget_info(base, find_by_uname = 'domain') 41 actionid = widget_info(base, find_by_uname = 'action') 46 42 ; optionid = widget_info(base, find_by_uname = 'option') 47 43 ;------------------------------------------------------------ 48 widget_control,base, get_uvalue = top_uvalue 49 smallin = extractatt(top_uvalue, 'smallin') 50 numdessinin = smallin[2]-1 51 smallout = extractatt(top_uvalue, 'smallout') 52 numdessinout = smallout[2]-1 44 widget_control, base, get_uvalue = top_uvalue 45 smallin = extractatt(top_uvalue, 'smallin') 46 numdessinin = smallin[2]-1 47 smallout = extractatt(top_uvalue, 'smallout') 48 numdessinout = smallout[2]-1 49 ; 50 options = extractatt(top_uvalue, 'options') 51 optionsflag = extractatt(top_uvalue, 'optionsflag') 52 portrait = (strtrim(optionsflag[where(options EQ 'Portrait/Landscape'), 0], 1))[0] 53 53 ;------------------------------------------------------------ 54 54 ;--------------- … … 56 56 ; et le type 57 57 ;--------------- 58 widget_control,graphtypeid, get_uvalue = graphtype_uvalue 59 type = graphtype_uvalue.choix[widget_info(graphtypeid, /droplist_select)] 60 ; type = top_uvalue.nameprocedures[numdessinin] 61 case type of 62 'plt':procedure = 'plt' 63 'pltz':procedure = 'pltz' 64 'pltt':procedure = 'pltt' 65 'xy':procedure = 'plt' 66 'xz':procedure = 'pltz' 67 'yz':procedure = 'pltz' 68 'xt':procedure = 'pltt' 69 'yt':procedure = 'pltt' 70 'zt':procedure = 'pltt' 71 'x':procedure = 'plt1d' 72 'y':procedure = 'plt1d' 73 'z':procedure = 'plt1d' 74 't':procedure = 'pltt' 75 endcase 76 if keyword_set(forplth) then BEGIN 77 procedure = 'plt' 78 type = 'plt' 79 ENDIF 80 if keyword_set(forpltz) then BEGIN 81 procedure = 'pltz' 82 type = 'pltz' 83 ENDIF 84 if keyword_set(forpltt) then BEGIN 85 procedure = 'pltt' 86 type = 'pltt' 87 ENDIF 58 IF keyword_set(forcetype) THEN type = forcetype $ 59 ELSE type = widget_info(actionid, /combobox_gettext) 60 case type of 61 'plt':procedure = 'plt' 62 'pltz':procedure = 'pltz' 63 'pltz_diag':procedure = 'pltz' 64 'pltt':procedure = 'pltt' 65 'pltt_diag':procedure = 'pltt' 66 'xy':procedure = 'plt' 67 'xz':procedure = 'pltz' 68 'yz':procedure = 'pltz' 69 'xt':procedure = 'pltt' 70 'yt':procedure = 'pltt' 71 'zt':procedure = 'pltt' 72 'x':procedure = 'plt1d' 73 'y':procedure = 'plt1d' 74 'z':procedure = 'plt1d' 75 't':procedure = 'pltt' 76 endcase 88 77 ; 89 78 ; recherche des options 90 79 ; 91 92 93 94 95 96 97 98 ; 99 100 101 80 options = extractatt(top_uvalue, 'options') 81 optionsflag = extractatt(top_uvalue, 'optionsflag') 82 flags = optionsflag[*, numdessinin] 83 xindex = (flags[where(options EQ 'Longitude / x index')])[0] 84 yindex = (flags[where(options EQ 'Latitude / y index')])[0] 85 drawvecteur = (flags[where(options EQ 'Vecteur')])[0]*(procedure eq 'plt') 86 drawover = (flags[where(options EQ 'Overlay')])[0] 87 ; 88 alreadyread = extractatt(top_uvalue, 'alreadyread') 89 alreadyvector = extractatt(top_uvalue, 'alreadyvector') 90 alreadyover = extractatt(top_uvalue, 'alreadyoer') 102 91 ; que devons-nous lire ? 103 case 1 of 104 alreadyover NE -1:BEGIN 105 toread = alreadyover+1 106 whichread = 'over' 107 END 108 alreadyvector NE -1 AND alreadyvector NE !pi:BEGIN 109 toread = alreadyvector+1 110 whichread = 'vector' 111 END 112 alreadyread NE -1 AND alreadyread NE !pi AND alreadyread NE 2.*!pi:BEGIN 113 toread = alreadyread+1 114 whichread = 'classic' 115 END 116 else:BEGIN 117 case 1 of 118 alreadyvector eq !pi:BEGIN 119 toread = alreadyover+1 120 whichread = 'over' 121 END 122 alreadyread EQ !pi:BEGIN 123 toread = alreadyvector+1 124 whichread = 'vector' 125 END 126 alreadyread EQ 2.*!pi:BEGIN 127 toread = alreadyover+1 128 whichread = 'over' 129 END 130 ELSE:BEGIN 131 toread = alreadyread+1 132 whichread = 'classic' 133 END 134 endcase 135 END 136 ENDCASE 137 ; 138 widget_control, nomexpid, get_value = widcommand 139 widcommand = strcompress(widcommand[0], /remove_all) 140 cutcommand, widcommand, toread, coef, numberofread, operation, nameexp, separator, add 141 ; 142 readcommande = buildreadcommand(base, ''''+nameexp+'''', procedure, type, BOXZOOM = boxzoom, complete = whichread EQ 'classic' AND alreadyread EQ -1) 143 ; on choppe la ligne ou il y a litchamp pour appliquer coef et operateur 144 i = 0 145 while strpos(readcommande[i], 'litchamp') EQ -1 do i = i+1 146 ;----------------------- 147 ;----------------------- 148 ;----------------------- 149 ;----------------------- 150 ;----------------------- 151 case whichread of 152 'classic':BEGIN 153 if alreadyread+1 EQ 0 then BEGIN 154 ; on commence a ecrire la commande de lecture... 155 readcommande = ['; beginning of reading the field to draw' $ 156 , '; field number: '+strtrim(alreadyread+2, 1), readcommande] 157 readcommande[i+2] = 'field = '+coef+operation+readcommande[i+2] 158 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 159 ENDIF ELSE BEGIN 160 readcommande = ['; field number: '+strtrim(alreadyread+2, 1), readcommande] 161 readcommande[i+1] = 'field = field'+separator+coef+operation+readcommande[i+1] 162 readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande] 163 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 164 ENDELSE 165 if alreadyread+1 NE numberofread-1 THEN BEGIN 166 ; si il faut lire d''autres champs on sort 167 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = alreadyread+1 168 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field number '+strtrim(alreadyread+3, 1)) 92 case 1 of 93 alreadyover NE -1:BEGIN 94 toread = alreadyover+1 95 readswitch = 'over' 96 END 97 alreadyvector NE -1 AND alreadyvector NE !pi:BEGIN 98 toread = alreadyvector+1 99 readswitch = 'vector' 100 END 101 alreadyread NE -1 AND alreadyread NE !pi AND alreadyread NE 2.*!pi:BEGIN 102 toread = alreadyread+1 103 readswitch = 'classic' 104 END 105 else:BEGIN 106 case 1 of 107 alreadyvector eq !pi:BEGIN 108 toread = alreadyover+1 109 readswitch = 'over' 110 END 111 alreadyread EQ !pi:BEGIN 112 toread = alreadyvector+1 113 readswitch = 'vector' 114 END 115 alreadyread EQ 2.*!pi:BEGIN 116 toread = alreadyover+1 117 readswitch = 'over' 118 END 119 ELSE:BEGIN 120 toread = alreadyread+1 121 readswitch = 'classic' 122 END 123 endcase 124 END 125 ENDCASE 126 ; 127 widget_control, txtcmdid, get_value = widcmd 128 IF widcmd[0] EQ '' THEN widcmd = 'zzz' 129 130 cutcmd, widcmd[0], toread, numberofread, prefix, nameexp, ending 131 ; 132 readcmd = buildreadcmd(base, ''''+nameexp+'''', procedure, type $ 133 , BOXZOOM = boxzoom, complete = readswitch EQ 'classic' AND alreadyread EQ -1) 134 ; we look for the line containing funclec_name 135 currentfile = extractatt(top_uvalue, 'currentfile') 136 readparameters = *(extractatt(top_uvalue, 'readparameters'))[currentfile] 137 i = 0 138 while strpos(readcmd[i], readparameters.funclec_name + '(') EQ -1 do i = i+1 139 140 ;----------------------- 141 ;----------------------- 142 ;----------------------- 143 ;----------------------- 144 ;----------------------- 145 case readswitch of 146 'classic':BEGIN 147 if alreadyread+1 EQ 0 then BEGIN 148 ; we start the reading command 149 readcmd = ['; beginning of reading the field to draw', readcmd] 150 readcmd[i+1] = 'field = ' + prefix + readcmd[i+1] 151 ENDIF ELSE BEGIN 152 ; we complet the reading command 153 oldrdcmd = extractatt(top_uvalue, 'currentreadcmd') 154 nl = n_elements(oldrdcmd) 155 oldrdcmd[nl-1] = oldrdcmd[nl-1] + ' $' 156 readcmd[i] = prefix + readcmd[i] 157 readcmd = [temporary(oldrdcmd), temporary(readcmd)] 158 ENDELSE 159 ; exit if we have to read other fields... 160 if alreadyread+1 NE numberofread-1 THEN BEGIN 161 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 162 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = alreadyread+1 163 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field number '+strtrim(alreadyread+3, 1)) 164 return, '' 165 ENDIF 166 ; we finalize the reading command 167 IF ending NE '' THEN BEGIN 168 nl = n_elements(readcmd) 169 readcmd[nl-1] = readcmd[nl-1] + ' $' 170 readcmd = [temporary(readcmd), ending] 171 ENDIF 172 readcmd = [temporary(readcmd) $ 173 , 'field = create_struct({arr:temporary(field), grid:vargrid, unit:varunit, experiment:varexp, name:varname})' $ 174 , '; end of reading the field to draw', ';'] 175 ; we get back _EXTRA: 176 extra = extractatt(top_uvalue, 'extra') 177 if xindex NE 0 then extra = create_struct(extra, 'xindex', xindex) 178 if yindex NE 0 then extra = create_struct(extra, 'yindex', yindex) 179 exextra = cw_specifie_get_value(base) 180 extra = mixstru(exextra, extra) 181 sextra = struct2string(extra) 182 readcmd = [temporary(readcmd), 'extra = '+sextra] 183 ; 184 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 185 case 1 of 186 drawvecteur:BEGIN 187 ; we have to read the vectors 188 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = !pi 189 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the zonal component of vector') 190 return, '' 191 END 192 drawover:BEGIN 193 ; we have to read the field to overlay... 194 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = 2.*!pi 195 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay') 196 return, '' 197 END 198 ; finished, we draw the plot... 199 ELSE:*top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1 200 endcase 201 END 202 'vector':BEGIN 203 ; for the vectors, there is 2 components. we read u when alreadyvector 204 ; is a interger and v when alreadyvector is a interger+0.5 205 if floor(alreadyvector)+1 EQ 0 then begin 206 if floor(alreadyvector) EQ alreadyvector then begin 207 readcmd = ['; beginning of reading the zonal component of vector', readcmd] 208 readcmd[i+1] = 'fieldu = ' + prefix + readcmd[i+1] 209 ENDIF ELSE BEGIN 210 readcmd = ['; beginning of reading the meridional component of vector', readcmd] 211 readcmd[i+1] = 'fieldv = ' + prefix + readcmd[i+1] 212 ENDELSE 213 readcmd = [extractatt(top_uvalue, 'currentreadcmd'), temporary(readcmd)] 214 ENDIF ELSE BEGIN 215 oldrdcmd = extractatt(top_uvalue, 'currentreadcmd') 216 nl = n_elements(oldrdcmd) 217 oldrdcmd[nl-1] = oldrdcmd[nl-1] + ' $' 218 readcmd[i] = prefix + readcmd[i] 219 readcmd = [temporary(oldrdcmd), temporary(readcmd)] 220 ENDELSE 221 ; 222 case alreadyvector+1 of 223 numberofread-1:BEGIN 224 ; we finalize the reading command 225 IF ending NE '' THEN BEGIN 226 nl = n_elements(readcmd) 227 readcmd[nl-1] = readcmd[nl-1] + ' $' 228 readcmd = [temporary(readcmd), ending] 229 ENDIF 230 readcmd = [temporary(readcmd) $ 231 , 'fieldu = create_struct({arr:temporary(fieldu), grid:vargrid, unit:varunit, experiment:varexp, name:varname})' $ 232 , '; end of reading the zonal component of vector', ';'] 233 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 234 ; we finished zonal component reading... 235 ; we know switch to meridional component... 236 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -.5 237 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the meridional component of vector') 238 return, '' 239 END 240 numberofread-0.5:BEGIN 241 ; we finalize the reading command 242 IF ending NE '' THEN BEGIN 243 nl = n_elements(readcmd) 244 readcmd[nl-1] = readcmd[nl-1] + ' $' 245 readcmd = [temporary(readcmd), ending] 246 ENDIF 247 readcmd = [temporary(readcmd) $ 248 , 'fieldv = create_struct({arr:temporary(fieldv), grid:vargrid, unit:varunit, experiment:varexp, name:varname})' $ 249 , '; end of reading the meridional component of vector', ';'] 250 ; we finished meridional component reading... 251 ; 252 ; we get back _EXTRA of the vector and we complet extra already build 253 extra = extractatt(top_uvalue, 'extra') 254 exextra = cw_specifie_get_value(base) 255 extra = mixstru(exextra, extra) 256 sextra = struct2string(extra) 257 readcmd = [readcmd, 'vectorextra = '+sextra, 'extra=mixstru(extra,vectorextra)'] 258 ; 259 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 260 ; 261 if drawover then BEGIN 262 ; shall we do an overlay??? 263 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = !pi 264 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay') 169 265 return, '' 170 ENDIF 266 ENDIF ELSE BEGIN 267 ; it is done know! 268 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1 269 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -1 270 ENDELSE 271 END 272 ELSE:BEGIN 273 ; we still need to read some vector components... 274 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 275 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = alreadyvector+1 276 if floor(alreadyvector) EQ alreadyvector then text = ' zonal ' $ 277 ELSE text = ' meridional ' 278 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the '+strtrim(floor(alreadyread)+3, 1)+text+'component of vector') 279 return, '' 280 END 281 endcase 282 END 283 'over':BEGIN 284 if alreadyover+1 EQ 0 then begin 285 ; we start the reading... 286 readcmd = ['; beginning of reading the field to overdraw', readcmd] 287 readcmd[i+1] = 'fieldover = '+ prefix +readcmd[i+1] 288 readcmd = [extractatt(top_uvalue, 'currentreadcmd'), temporary(readcmd)] 289 ENDIF ELSE BEGIN 290 oldrdcmd = extractatt(top_uvalue, 'currentreadcmd') 291 nl = n_elements(oldrdcmd) 292 oldrdcmd[nl-1] = oldrdcmd[nl-1] + ' $' 293 readcmd[i] = prefix + readcmd[i] 294 readcmd = [temporary(oldrdcmd), temporary(readcmd)] 295 ENDELSE 296 ; 297 if alreadyover+1 NE numberofread-1 THEN BEGIN 298 ; we still need to read some files... 299 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 300 *top_uvalue[1, findline(top_uvalue, 'alreadyover')] = alreadyover+1 301 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field number '+strtrim(alreadyover+3, 1)+' to overlay') 302 return, '' 303 ENDIF 304 ; we finalize the reading command 305 IF ending NE '' THEN BEGIN 306 nl = n_elements(readcmd) 307 readcmd[nl-1] = readcmd[nl-1] + ' $' 308 readcmd = [temporary(readcmd), ending] 309 ENDIF 171 310 ; on finalise la commande de lecture 172 readcommande = [readcommande, 'field = field'+add $ 173 , 'field = create_struct({tab:field, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $ 174 , '; end of reading the field to draw', ';'] 175 ; on recupere le _EXTRA: 176 extra = extractatt(top_uvalue, 'extra') 177 if xindex NE 0 then extra = create_struct(extra, 'xindex', xindex) 178 if yindex NE 0 then extra = create_struct(extra, 'yindex', yindex) 179 exextra = cw_specifie_get_value(base) 180 extra = mixstru(exextra,extra) 181 sextra = struct2string(extra) 182 readcommande = [readcommande, 'extra = '+sextra] 183 ; 184 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 185 case 1 of 186 drawvecteur:BEGIN 187 ; quelle function de lecture utilisons nous? trace des vecteurs de 188 ; facon automatique ou non? 189 currentfile = extractatt(top_uvalue, 'currentfile') 190 funclec_name = *(extractatt(top_uvalue, 'readparameters'))[currentfile] 191 funclec_name = funclec_name.funclec_name 192 if funclec_name EQ 'read_ncdf' then begin 193 ; il faut lire des vecteurs maintenant? 194 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = !pi 195 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the zonal component of vector') 196 return, '' 197 ENDIF ELSE BEGIN 198 ; on fait un trace automatique en appelant un et vn ... 199 readuncommande = buildreadcommand(base, ''''+nameexp+'''', procedure, type, BOXZOOM = boxzoom, complete = 0, namefield = 'un') 200 i = 0 201 while strpos(readuncommande[i], 'litchamp') EQ -1 do i = i+1 202 readuncommande = ['; reading the zonal component of vector', readuncommande] 203 readuncommande[i+1] = 'fieldu = '+readuncommande[i+1] 204 readuncommande = [readuncommande,'fieldu = create_struct({tab:fieldu, grille:vargrid, unite:varunit, experience:varexp, nom:varname})'] 205 ; 206 readvncommande = buildreadcommand(base, ''''+nameexp+'''', procedure, type, BOXZOOM = boxzoom, complete = 0, namefield = 'vn') 207 i = 0 208 while strpos(readvncommande[i], 'litchamp') EQ -1 do i = i+1 209 readvncommande = ['; reading the zonal component of vector', readvncommande] 210 readvncommande[i+1] = 'fieldv = '+readvncommande[i+1] 211 readvncommande = [readvncommande,'fieldv = create_struct({tab:fieldv, grille:vargrid, unite:varunit, experience:varexp, nom:varname})'] 212 ; 213 readcommande = [readcommande,';', readuncommande, ';', readvncommande] 214 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 215 ; on enchaine sur un over plot??? 216 if drawover then begin 217 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = 2.*!pi 218 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay') 219 return, '' 220 ENDIF ELSE *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1 221 ENDELSE 222 END 223 drawover:BEGIN 224 ; il faut lire un autre champ a surcontourer? 225 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = 2.*!pi 226 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay') 227 return, '' 228 END 229 ; c'est tout pour la lecture, on va tracer! 230 ELSE:*top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1 231 endcase 232 END 233 'vector':BEGIN 234 ; pour lesvecteurs, il y a 2 composantes! en u et en v donc il faut 235 ; doubler la lecture. pour alreadyvector entier, on lit u pour 236 ; alreadyvector entier+0.5, on lit v! 237 if floor(alreadyvector)+1 EQ 0 then begin 238 if floor(alreadyvector) EQ alreadyvector then begin 239 readcommande = ['; beginning of reading the zonal component of vector' $ 240 , '; fieldu number: '+strtrim(alreadyvector+2, 1), readcommande] 241 readcommande[i+2] = 'fieldu = '+coef+operation+readcommande[i+2] 242 readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande] 243 ENDIF ELSE BEGIN 244 readcommande = ['; beginning of reading the meridional component of vector' $ 245 , '; fieldv number: '+strtrim(floor(alreadyvector)+2, 1), readcommande] 246 readcommande[i+2] = 'fieldv = '+coef+operation+readcommande[i+2] 247 readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande] 248 ENDELSE 249 ENDIF ELSE BEGIN 250 if floor(alreadyvector) EQ alreadyvector then begin 251 readcommande = ['; fieldu number: '+strtrim(alreadyvector+2, 1), readcommande] 252 readcommande[i+1] = 'fieldu = fieldu'+separator+coef+operation+readcommande[i+1] 253 readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande] 254 ENDIF ELSE BEGIN 255 readcommande = ['; fieldv number: '+strtrim(floor(alreadyvector)+2, 1), readcommande] 256 readcommande[i+1] = 'fieldv = fieldv'+separator+coef+operation+readcommande[i+1] 257 readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande] 258 ENDELSE 259 ENDELSE 260 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 261 ; 262 case alreadyvector+1 of 263 numberofread-1:BEGIN 264 ; on finalise la commande de lecture 265 readcommande = [readcommande, 'fieldu = fieldu'+add $ 266 , 'fieldu = create_struct({tab:fieldu, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $ 267 , '; end of reading the zonal component of vector', ';'] 268 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 269 ; on vient de finir le lecture des U 270 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -.5 271 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the meridional component of vector') 272 return, '' 273 END 274 numberofread-0.5:BEGIN 275 ; on finalise la commande de lecture 276 readcommande = [readcommande, 'fieldv = fieldv'+add $ 277 , 'fieldv = create_struct({tab:fieldv, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $ 278 , '; end of reading the meridional component of vector', ';'] 279 ; on vient de finir le lecture des V 280 ; 281 ; on recupere le _EXTRA de vector et on complete eventuellement le extra 282 ; deja constitue: 283 extra = extractatt(top_uvalue, 'extra') 284 exextra = cw_specifie_get_value(base) 285 extra = mixstru(exextra,extra) 286 sextra = struct2string(extra) 287 readcommande = [readcommande, 'vectorextra = '+sextra, 'extra=mixstru(extra,vectorextra)'] 288 ; 289 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 290 ; 291 if drawover then BEGIN 292 ; on enchaine sur un surcontour 293 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = !pi 294 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay') 295 return, '' 296 ENDIF ELSE BEGIN 297 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1 298 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -1 299 ENDELSE 300 END 301 ELSE:BEGIN 302 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = alreadyvector+1 303 if floor(alreadyvector) EQ alreadyvector then text = ' zonal ' $ 304 ELSE text = ' meridional ' 305 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the '+strtrim(floor(alreadyread)+3, 1)+text+'component of vector') 306 return, '' 307 END 308 endcase 309 END 310 'over':BEGIN 311 if alreadyover+1 EQ 0 then begin 312 ; on commence a ecrire la commande de lecture... 313 readcommande = ['; beginning of reading the field to overdraw' $ 314 , '; fieldover number: '+strtrim(alreadyread+2, 1), readcommande] 315 readcommande[i+2] = 'fieldover = '+coef+operation+readcommande[i+2] 316 readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande] 317 ENDIF ELSE BEGIN 318 readcommande = ['; fieldover number: '+strtrim(alreadyover+2, 1), readcommande] 319 readcommande[i+1] = 'fieldover = fieldover'+separator+coef+operation+readcommande[i+1] 320 readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande] 321 ENDELSE 322 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 323 ; 324 if alreadyover+1 NE numberofread-1 THEN BEGIN 325 ; si il faut lire d''autres champs on sort 326 *top_uvalue[1, findline(top_uvalue, 'alreadyover')] = alreadyover+1 327 *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field number '+strtrim(alreadyover+3, 1)+' to overlay') 328 return, '' 329 ENDIF 330 ; on finalise la commande de lecture 331 readcommande = [readcommande, 'fieldover = fieldover'+add $ 332 , 'fieldover = create_struct({tab:fieldover, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $ 333 , '; end of reading the field to overdraw', ';'] 334 ; on recupere le _EXTRA de over et on complete eventuellement le extra 335 ; deja constitue: 336 extra = extractatt(top_uvalue, 'extra') 337 exextra = cw_specifie_get_value(base) 338 extra = mixstru(exextra,extra) 339 sextra = struct2string(extra) 340 readcommande = [readcommande, 'overextra = '+sextra, 'extra=mixstru(extra,overextra)'] 341 ; 342 *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande 343 ; on remet les compteurs a 0 344 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1 345 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -1 346 *top_uvalue[1, findline(top_uvalue, 'alreadyover')] = -1 347 END 348 endcase 311 readcmd = [readcmd $ 312 , 'fieldover = create_struct({arr:temporary(fieldover), grid:vargrid, unit:varunit, experiment:varexp, name:varname})' $ 313 , '; end of reading the field to overdraw', ';'] 314 ; we get back _EXTRA of over and we complet extra already build 315 extra = extractatt(top_uvalue, 'extra') 316 exextra = cw_specifie_get_value(base) 317 extra = mixstru(exextra, extra) 318 sextra = struct2string(extra) 319 readcmd = [readcmd, 'overextra = '+sextra, 'extra=mixstru(extra,overextra)'] 320 ; 321 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 322 ; we reinitialize 323 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1 324 *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -1 325 *top_uvalue[1, findline(top_uvalue, 'alreadyover')] = -1 326 END 327 endcase 349 328 ; 350 329 ;----------------------- … … 357 336 ; determination du nom de la boxzoom 358 337 ;--------------- 359 338 if NOT keyword_set(boxzoom) then widget_control, domainid, get_value = boxzoom 360 339 ; ecriture de celle-ci sous forme d''un string 361 362 340 box = '['+strtrim(boxzoom[0], 1) 341 for i = 1, (n_elements(boxzoom)-1) < (3+2*(strpos(type, 'z') EQ -1)) do $ 363 342 box = box+', '+strtrim(boxzoom[i], 1) 364 343 ; pour les [plots en z, box doit avoir par defaut 0,profmax 365 344 if strpos(type, 'z') NE -1 then BEGIN 366 345 ; si + de 1 niveau est selectionne: 367 widget_control, widget_info(base, find_by_uname = 'depthlev1'), get_value = niv1 368 niv1 = niv1.droplist_select 369 widget_control, widget_info(base, find_by_uname = 'depthlev2'), get_value = niv2 370 niv2 = niv2.droplist_select 371 if niv1 NE niv2 then begin 372 box = box+','+strtrim(boxzoom[4], 1)+','+strtrim(boxzoom[5], 1) 373 ENDIF ELSE BEGIN 374 if chkstru(exextra, 'profmax') then pmax = exextra.profmax $ 375 ELSE pmax = 200 376 box = box+',0,'+strtrim(pmax, 1) 377 ENDELSE 378 endif 379 box = box+']' 346 widget_control, widget_info(base, find_by_uname = 'dthlv1'), get_value = niv1 347 niv1 = niv1.combobox_index 348 widget_control, widget_info(base, find_by_uname = 'dthlv2'), get_value = niv2 349 niv2 = niv2.combobox_index 350 if niv1 NE niv2 then begin 351 box = box+','+strtrim(boxzoom[4], 1)+','+strtrim(boxzoom[5], 1) 352 ENDIF ELSE BEGIN 353 if chkstru(exextra, 'profmax') then pmax = exextra.profmax $ 354 ELSE pmax = 200 355 box = box+',0,'+strtrim(pmax, 1) 356 ENDELSE 357 endif 358 box = box+']' 359 IF strpos(type, '_diag') NE -1 THEN BEGIN 360 sendpoints = '[' + strtrim(boxzoom[0], 1) + ', ' + strtrim(boxzoom[2], 1) + $ 361 ', ' + strtrim(boxzoom[1], 1) + ', ' + strtrim(boxzoom[3], 1) + ']' 362 ENDIF 380 363 ;--------------- 381 364 ; on determine typein 382 365 ;--------------- 383 typein = ''''+type+'''' 366 IF strpos(type, '_diag') NE -1 THEN typein = ''''+strmid(type, 0, 4)+'''' $ 367 ELSE typein = ''''+type+'''' 384 368 ;--------------- 385 369 ;--------------- 386 370 ; determination de small 387 371 ;--------------- 388 372 ssmall = tostr(smallout) 389 373 ;------------------------------------------------------------ 390 374 ; on va definir le string qui contiendra la commande a executer par widgetdessine.pro 391 375 ;------------------------------------------------------------ 392 Commande = [readCommande, procedure+', field $', ', boxzoom=' $ 393 +box+', typein='+typein+', small='+ssmall+' $'] 394 IF drawvecteur then Commande = [Commande, ', vecteur = {u: fieldu,v: fieldv} $'] 395 IF drawover then Commande = [Commande, ', contour = fieldover $'] 396 Commande = [Commande, ', _extra= mixstru(ex, extra), NOERASE=noerase'] 376 Cmd = [readCmd, procedure+ ', field $' $ 377 , ' , boxzoom = '+box+', typein='+typein+', small='+ssmall+' $'] 378 IF drawvecteur then Cmd = [Cmd, ' , vecteur = {u: fieldu,v: fieldv} $'] 379 IF drawover then Cmd = [Cmd, ' , contour = fieldover $'] 380 IF n_elements(sendpoints) NE 0 then Cmd = [Cmd, ' , endpoints = ' + sendpoints + ' $'] 381 Cmd = [Cmd, ' , _extra= mixstru(ex, extra), portrait = ' + portrait + ', NOERASE=noerase'] 397 382 398 383 ; print, '---------------' 399 ; for i = 0, n_elements(C ommande)-1 do print, Commande[i]384 ; for i = 0, n_elements(Cmd)-1 do print, Cmd[i] 400 385 ; print, '---------------' 401 386 ;--------------- 402 387 ; on complete et/ou actualise la structure top_uvalue... 403 388 ;--------------- 404 405 406 407 (*top_uvalue[1, findline(top_uvalue, 'prefixes')])[numdessinout] = widcommand408 409 410 ;------------------------------------------------------------ 411 return, Commande389 (*top_uvalue[1, findline(top_uvalue, 'nameprocedures')])[numdessinout] = procedure 390 (*top_uvalue[1, findline(top_uvalue, 'types')])[numdessinout] = type 391 (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinout] = boxzoom 392 (*top_uvalue[1, findline(top_uvalue, 'txtcmd')])[numdessinout] = widcmd 393 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[*, numdessinout] = flags 394 *((*top_uvalue[1, findline(top_uvalue, 'exextra')])[numdessinout]) = extra 395 ;------------------------------------------------------------ 396 return, Cmd 412 397 end 413 398
Note: See TracChangeset
for help on using the changeset viewer.