SURVO 98 edit field: 151 1000 300 (32 bit version) 0001|*SAVE HELTERA3 / FILE MEDIT example 0002|*LOAD EX87 0004|*This edit field contains definitions for displaying long-term, monthly 0005|*weather data of Helsinki. 0006|*FILE MEDIT shows one year at a time by using January as the base month 0007|*(observation). 0008|*The monthly mean temperature and rainfall are tabulated and plotted 0009|*as profiles against the mean profile. 0010|*The graphs for each year are plotted automatically by another, temporary 0011|*Survo session obtaining its data from lines between and 0012|*below. This data is processed by a sucro (MEDITS) named in the page 0013|*header line. 0015|* - Examples of FILE MEDIT usage for this setting S | 11111111111111111111111111111111111111111111111 0017|*/TUTSHOW \U\S\MEDITS / List the code of MEDITS 0019|*The only page in this setting (Page1) is conditional. 0020|*It will be shown only when the month is January (i.e. Month is 1). 0022|*January=Month:1 / Definition of the condition 0023|*MEDIT:HELSINKI SIZE=33,108 PAGES=Page1 0025|*PAGE Page1: CONDITION:January SUCRO:MEDITS 0027|* Monthly 0028|* Mean temperature in Helsinki 1829-2000 0029|* Rainfall (mm) in Helsinki 1845-2000 0030|* Data from Finnish Meteorological Institute 0032|* Year: #### S | PPPP 0033|* Temperature (Celsius) Rainfall (mm) 0034|: / 0035|: / These comment lines will not be displayed. 0036|: / In Year: #### above shadow PPPP protects the field during FILE MEDIT. S | PPPP 0037|: / Characters with shadow '+' are hidden. 0038|: / Characters with shadow '-' (as T01: below) are also deleted. 0039|: / 0041|* January T01: ###.# R01: ### S | ---- ---- 0042|* February T02: ###.# R02: ### S | ---- ---- 0043|* March T03: ###.# R03: ### S | ---- ---- 0044|* April T04: ###.# R04: ### S | ---- ---- 0045|* May T05: ###.# R05: ### S | ---- ---- 0046|* June T06: ###.# R06: ### S | ---- ---- 0047|* July T07: ###.# R07: ### S | ---- ---- 0048|* August T08: ###.# R08: ### S | ---- ---- 0049|* September T09: ###.# R09: ### S | ---- ---- 0050|* October T10: ###.# R10: ### S | ---- ---- 0051|* November T11: ###.# R11: ### S | ---- ---- 0052|* December T12: ###.# R12: ### S | ---- ---- 0054|* The warmest month was %1 (%2) and / %1=Mname1 %2=MaxTemp 0055|* the coldest was %1 (%2). / %1=Mname2 %2=MinTemp 0056|* %1 / %1=Summer1 0057|* %1 (%2 mm) / %1=Summer2 %2=Rsum 0059|* data for sucro MEDITS 0060|:TEST=1 / Set this to 1 if you have problems with the code below! 0061|: Then you can break the sucro (of the 2nd Survo) by '.' 0062|:REPLACE !,.,C / Transform !!!!!!!!!!'s to border lines. 0063|:REPLACE ?xx.x,-,C / Convert to missing values. 0064|:REPLACE ?zz,-,C / Convert to missing values. 0065|: / These are comment lines: 0066|: / Lines to be activated by the sucro (MEDIT) must be denoted by . 0067|: / Page definitions must not contain any border lines. 0068|: / Therefore the first REPLACE converts !'s to .'s . 0069|: / Missing values for items indicated by xxx.x are represented 0070|: / as ?xx.x . Therefore the second REPLACE is needed for conversion 0071|: / to missing values (-). The same holds for the third REPLACE. 0072|: / FILE MEDIT will modify the data table HELSINKI for each year in turn. 0073|*DATA HELSINKI 0074|*Month Temp Mtemp Rain Mrain I R 0075|*January xxx.x -5.7 zzz 47.0 0 12 / x=Temp z=Rain % 0076|*February xxx.x -6.2 zzz 37.2 0 11 / x=Temp[+1] z=Rain[+1] % 0077|*March xxx.x -3.2 zzz 35.6 0 10 / x=Temp[+2] z=Rain[+2] % 0078|*April xxx.x 2.2 zzz 37.6 0 9 / x=Temp[+3] z=Rain[+3] % 0079|*May xxx.x 8.5 zzz 41.4 0 8 / x=Temp[+4] z=Rain[+4] % 0080|*June xxx.x 14.1 zzz 46.1 0 7 / x=Temp[+5] z=Rain[+5] % 0081|*July xxx.x 17.0 zzz 58.9 0 6 / x=Temp[+6] z=Rain[+6] % 0082|*August xxx.x 15.6 zzz 74.1 0 5 / x=Temp[+7] z=Rain[+7] % 0083|*September xxx.x 11.0 zzz 65.4 0 4 / x=Temp[+8] z=Rain[+8] % 0084|*October xxx.x 5.8 zzz 69.4 0 3 / x=Temp[+9] z=Rain[+9] % 0085|*November xxx.x 0.7 zzz 64.9 0 2 / x=Temp[+10] z=Rain[+10] % 0086|*December xxx.x -3.2 zzz 55.3 0 1 / x=Temp[+11] z=Rain[+11] % 0088|:GPLOT /FIX 1 0089|:GPLOT HELSINKI / TYPE=HBAR VARS=Month(L),I(A) XLABEL= YLABEL= 0090|: SCALE=-20(5)25 LEGEND=- HEADER= OUTFILE=A PEN=[Swiss(40)] 0091|: WHOME=0.33*WX+36,00 WSIZE=0.27*WX,0.27*WY MODE=960,700 0092|: XDIV=200,690,70 YDIV=65,505,130 0093|: FILL(-1)=0.1,0.12,0.1,0 FILL(-2)=0.05,0.06,0.05,0 0094|: FRAMES=F1,F2 F1=0,0,960,700,-1 F2=200,65,690,505,-2 0095|:!!!!!!!!!! 0096|:GPLOT HELSINKI,Mtemp,R 0097|: XSCALE=-20(5)25 XLABEL= YLABEL= HEADER= PEN=[Swiss(40)] 0098|: YSCALE=0.5:_,12.5:_ INFILE=A OUTFILE=A 0099|: LINE=[line_width(2)],1 POINT=0,5 0100|: WHOME=0.33*WX+36,00 WSIZE=0.27*WX,0.27*WY MODE=960,700 0101|: XDIV=200,690,70 YDIV=65,505,130 0102|:!!!!!!!!!! 0103|:GPLOT HELSINKI,Temp,R 0104|: HEADER=Profile_of_the_year_(red)__vs.__mean_profile_(black) 0105|: TEXTS=T1 T1=[Swissb(50)][RED],Mean_temperature_(C),435,575 0106|* YLABEL=[Swissb(50)][BLUE],%1 / %1=Year 0107|: XSCALE=-20(5)25 XLABEL= TOP=1 PEN=[Swiss(40)] 0108|: YSCALE=0.5:_,12.5:_ INFILE=A 0109|: LINE=[line_width(3)][RED],1 POINT=0,5 0110|: WHOME=0.33*WX+36,00 WSIZE=0.27*WX,0.27*WY MODE=960,700 0111|: XDIV=200,690,70 YDIV=65,505,130 0112|: GRID=[line_color(-1)],1000,1 FILL(-1)=0.1,0.1,0.1,0 0113|:!!!!!!!!!! 0114|:GPLOT /FIX 2 0115|:GPLOT HELSINKI / TYPE=HBAR VARS=Month(L),I(A) XLABEL= YLABEL= 0116|: SCALE=0(50)200 LEGEND=- HEADER= OUTFILE=B PEN=[Swiss(40)] 0117|: WHOME=0.33*WX+36,0.297*WY WSIZE=0.27*WX,0.27*WY MODE=960,700 0118|: XDIV=200,690,70 YDIV=65,505,130 0119|: FILL(-1)=0.12,0.1,0.1,0 FILL(-2)=0.06,0.05,0.05,0 0120|: FRAMES=F1,F2 F1=0,0,960,700,-1 F2=200,65,690,505,-2 0121|:!!!!!!!!!! 0122|:GPLOT HELSINKI,Mrain,R 0123|: XSCALE=0(50)200 XLABEL= YLABEL= HEADER= PEN=[Swiss(40)] 0124|: YSCALE=0.5:_,12.5:_ INFILE=B OUTFILE=B 0125|: LINE=[line_width(2)],1 POINT=0,5 0126|: WHOME=0.33*WX+36,0.297*WY WSIZE=0.27*WX,0.27*WY MODE=960,700 0127|: XDIV=200,690,70 YDIV=65,505,130 0128|:!!!!!!!!!! 0129|:GPLOT HELSINKI,Rain,R 0130|: HEADER=Profile_of_the_year_(red)__vs.__mean_profile_(black) 0131|: TEXTS=T1 T1=[Swissb(50)][BLUE],Rainfall_(mm),600,575 0132|* YLABEL=[Swissb(50)][BLUE],%1 / %1=Year 0133|: XSCALE=0(50)200 XLABEL= TOP=1 0134|: YSCALE=0.5:_,12.5:_ LINE=[RED],1 INFILE=B PEN=[Swiss(40)] 0135|: LINE=[line_width[3][BLUE],1 POINT=0,5 0136|: WHOME=0.33*WX+36,0.297*WY WSIZE=0.27*WX,0.27*WY MODE=960,700 0137|: XDIV=200,690,70 YDIV=65,505,130 0138|: GRID=[line_color(-1)],1000,1 FILL(-1)=0.1,0.1,0.1,0 0139|* data of sucro MEDITS 0140|*END of Page1 0142|*Definitions for various items needed on the page: 0143|*T01=Temp[+0] T05=Temp[+4] T09=Temp[+8] 0144|*T02=Temp[+1] T06=Temp[+5] T10=Temp[+9] 0145|*T03=Temp[+2] T07=Temp[+6] T11=Temp[+10] 0146|*T04=Temp[+3] T08=Temp[+7] T12=Temp[+11] 0148|*R01=Rain[+0] R05=Rain[+4] R09=Rain[+8] 0149|*R02=Rain[+1] R06=Rain[+5] R10=Rain[+9] 0150|*R03=Rain[+2] R07=Rain[+6] R11=Rain[+10] 0151|*R04=Rain[+3] R08=Rain[+7] R12=Rain[+11] 0153|*Tmax=max(Temp[+5],Temp[+6],Temp[+7]) 0154|*Tmaxn=maxn(Temp[+5],Temp[+6],Temp[+7]) 0155|*U1=if(Tmax<16)then(1)else(U2) 0156|*U2=if(Tmax<16.5)then(2)else(U3) 0157|*U3=if(Tmax<19)then(3)else(U4) 0158|*U4=if(Tmax<19.5)then(4)else(5) 0160|*Summer1=$CLASS(Summer,U1) 0161|*CLASSIFICATION Summer: 0162|*1: Extremely cold summer! 0163|*2: Summer was cold. 0164|*3: Normal summer temperature. 0165|*4: Warm summer! 0166|*5: Summer was hot. 0167|*END 0169|*Rsum0=Rain[+5]+Rain[+6]+Rain[+7] 0170|*Rsum=if(Year<1845)then(0)else(Rsum0) 0171|*V0=if(Rsum=0)then(0)else(V1) 0172|*V1=if(Rsum<80)then(1)else(V2) 0173|*V2=if(Rsum<140)then(2)else(V3) 0174|*V3=if(Rsum<220)then(3)else(V4) 0175|*V4=if(Rsum<300)then(4)else(V5) 0176|*V5=if(Rsum<1000)then(5)else(0) 0178|*Summer2=$CLASS(Rainfall,V0) 0179|*CLASSIFICATION Rainfall: 0180|*0: Rainfall not measured! 0181|*1: Extremely dry summer! 0182|*2: Dry summer! 0183|*3: Normal rainfall in summer! 0184|*4: Wet summer! 0185|*5: Extremely rainy summer! 0186|*END 0188|*Tmaxn2=maxn(Temp[+4],Temp[+5],Temp[+6],Temp[+7],Temp[+8]) 0189|*MaxTempn=Tmaxn2+4 MaxTemp=round(Temp[MaxTempn-1],1) 0190|*Mname1=$CLASS(Months,MaxTempn) 0191|*Tminn2=minn(Temp,Temp[+1],Temp[+2],Temp[+9],Temp[+10],Temp[+11]) 0192|*MinTempn=if(Tminn2<4)then(Tminn2)else(Tminn2+6) 0193|* MinTemp=round(Temp[MinTempn-1],1) 0194|*Mname2=$CLASS(Months,MinTempn) 0196|*CLASSIFICATION Months: 0197|*1: January 0198|*2: February 0199|*3: March 0200|*4: April 0201|*5: May 0202|*6: June 0203|*7: July 0204|*8: August 0205|*9: September 0206|*10: October 0207|*11: November 0208|*12: December 0209|*END 0212|*.................................................................................................... 0214|* - Examples of FILE MEDIT usage for this setting 0216|* - Simple usage 0217|* - Searching for cases by using keywords =max and =min 0218|* - Retrieval of background information 0223|*/WHICH MEDITS 0224|*TUTSAVE G:\e\u\S\MEDITS.TUT 0225|/ Sucro for performing tasks determined by the FILE MEDIT operation 0226|/ using another instance of SURVO MM (S.Mustonen, 5 July 2003) 0227|/ 0228|/ 0229|*{tempo -1}{break off}{R} 0230|* WIN MIN{act}{R} 0231|/ REDIM 1000,200{act}{R} Needed in demo ex87 S | 1111111111111111111111 0232|/ RESIZE 31,97{act}{R} S | 11111111 1 11111111 0233|/ 0234|+ S: LOADP \TMP\MEDITSUC.TXT{act}{R} 0235|/ 0236|*{save spec TEST W1}{break on} 0237|- if W1 > 0 then goto T 0238|*{break off} 0239|/ 0240|+ T: {save line W1}{u} 0241|- if W1 '<>' {} then goto A 0242|*{tempo +1}{wait 10}{tempo -1}{goto S} 0243|+ A: {R} 0244|*{save word W1} 0245|- if W1 '=' then goto F 0246|- if W1 '=' then goto E 0247|- if W1 '=' then goto C 0248|+ B: {find <}{save word W1} 0249|- if W1 '<>' then goto A 0250|*{erase}{act}{goto A} 0251|+ C: {R} 0252|*{erase}FILE DEL \TMP\MEDITSUC.TXT{act}{R} 0253|+ D: {tempo +1}{wait 10}{tempo -1}CHECK \TMP\MEDITSUC.TXT{act} 0254|*{r}{save char W1}{line start}{erase} 0255|- if W1 '=' N then goto D 0256|*{jump 1,1,1,1}SCRATCH {act}{line start}{goto S} 0257|+ F: {R} 0258|*{erase}GPLOT /DEL ALL{act}{goto C} 0259|+ E: {R} 0260|*{erase}FILE DEL \TMP\MEDITSUC.TXT{act}{R} 0261|*{exit}Y{R} 0262|*{end}