Cherry Blossom Viewing Equation and eTCL Slot Calculator Demo Example , numerical analysis

Cherry Blossom Viewing Equation and eTCL Slot Calculator Demo Example

This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, gold 12dec2018



Introduction

gold Here is some eTCL starter code for calculating the cherry blossom equation, used for predicting mean temperature days (DTS) until peak cherry blossom viewing at Japanese weather stations and cities. This report will use less strict definitions and not consider confidence levels, since the main interest is developing a simple and quick slot calculator. The problem of predicting Japanese cherry (sakura) blossom viewing is similar to predicting harvest dates of fruits and vegetables worldwide, so there is considerable economic interest in the equation. Most of the testcases involve replicas or models, using assumptions and rules of thumb.

Software Planning

In planning any software, it is advisable to gather a number of testcases to check the results of the program. The results of the testcases are estimated using the hand calculator and then checked in the eTCL slot calculator. Pseudocode and equations are developed from the hand calculations and theory. Small console programs are written to check or proof the alternate subroutines or procedures, rather than keeping the unblessed code and comment lines in the main slot calculator. Finally the improved or alternate subroutines are loaded into the slot calculator. The eTCL slot calculator is effectively a shell program to input entries, host calculation routines, and display results. Additional significant figures are used to check the eTCL calculator, not to infer the accuracy of inputs and product reports.

Estimation of DTS standard temperature days

Each site or city has selected DOY ( date of year) to start measurements of daily mean temperature in Kelvin degrees. The mean temperature for 25 days (temperature series entered or list in program) is calculated for the daily value of DTS, mean standard temperature equivalent day. The individual DTS value is exp(combined exponential constant). Typical daily value of calculated DTS ranges from 0.4 to 1.0 equivalent day during spring in Japan. The cumulative DTS estimate is divided by 25 days for the bloom prediction DTS delta days. Hence the DTS delta days are a standard measure of environment temperature or heating days that bring the blossoms into plum. The julian date for the sakura bloom viewing is the DOY or julian equivalent of the monitoring start plus the DTS delta days. More concisely, the viewing date = julian start day + DTS delta days The cherry blossom equation is very sensitive to the blossom exponential constant, which is selected for the several sakura and plum varieties across Japan.

There are several forms of the cherry blossom viewing equation. The abbreviated form is DTS delta = exp<{ (bc1/R_gas)*((t1-ts)/(t1*ts))}. The DTS (distributed temperature standard) calculation uses the R gas constant as 8.31432 Joules per (Mole* degree kelvin) and blossom exponential constant (bc1) which ranges from 6 to 60 Kilojoules per Mole. Testcase 1 uses blossom constant of 17 KJ/Mole. For the longer form of the equation used in the calculator, the combined exponential constant is (blossom exponential constant / R_gas_constant)*{(mean_temperature1-standard_temperature2)/(mean_temperature1*standard_temperature2)}. The individual DTS value is exp(combined exponential constant). As with most exponentials, the values of constants can be multiplied or devided inside the exp{} brackets. For single site or city in hand calculations, it may be usefull to combine constants as exp<33-(9500/t1)> from Rich Farmbrough, 2 March 2012. The expression with the mixed temperatures is equivalent to {(1/standard_temperature2)- (1/mean_temperature1)}. Substituiing for the temperatures expression, the abbreviated form is delta = exp<{ (bc1/R_gas)*((1/ts)-(1/t1))}. The standard_temperature ts is a constant given as 288.2 degrees kevin and the reciprocal constant is 1/ts or 0.00347. Rearranging terms, delta = exp<{( (17E3/8.314)*(.00347))-((17E3/8.314)*(1/t1))} and so on.

Testcases

Testcase 1: Each site has selected DOY ( date of year) to start measurements of daily mean temperature in Kelvin degrees. Testcase 1 uses blossom constant of 17 KJ/Mole.

Push Button Operation

For the push buttons in the eTCL slot calculator, the recommended procedure is push testcase to fill entry frame, change first three entries etc, push solve, and then push report. Report allows copy and paste from console. For testcases in a computer session, the eTCL calculator increments a new testcase number internally, eg. TC(1), TC(2) , TC(3) , TC(N). The testcase number is internal to the calculator and will not be printed until the report button is pushed for the current result numbers. The current result numbers will be cleared on the next solve button. The calculator display has a caution flag subroutine for negative numbers, unrecognizable text characters, and operation outside expected operation range. On a degrading scale, the calculator will post warning flags to the console report, issue degraded accuracy notices, and may reset some negative and offscale numbers to positive defaults. Errors pass through the warning flag routine once on the same testcase and multiple error calls on the same fault are possible. Aside from the TCL calculator display, when one presses the report button on the calculator, one will have console show access to the functions (subroutines).

Pseudocode and Equations

     #pseudocode can be developed from rules of thumb.
     #pseudocode: some problems can be solved by proportions (rule of three), to some order of magnitude
     #pseudocode: enter quantity1,  quantity2, quantity3 and expected output (quantity4) for testcases.
     #pseudocode: enter time in years, number of remaining items
     #pseudocode: output fraction of (remaining items) over (items at time zero)
     #pseudocode: ouput remaining items as fraction or percent
     #pseudocode: output fraction of (quantity4 ) over ( quantity1 at time zero)
     #pseudocode: output fraction of (quantity2) * (quantity3 ) over (quantity1 at time zero)
     #pseudocode: outputs should be in compatible units.
     #pseudocode: rules of thumb can be 3 to 15 percent off, partly since g..in g..out.
     #pseudocode: need test cases > small,medium, giant
     #pseudocode: need testcases within range of expected operation.
     #pseudocode: are there any cases too small or large to be solved?

Testcases Section

Testcase 1

table 1printed in tcl wiki format
quantity value comment, if any
testcase number:1
weather site number :1.0
julian date start day :42.0
mean day temperature in Kelvin (optional):300.0
standard temperature constant (optional) :288.2
blossom constant (optional) :17000.0
answers: internal constant days :0.0001364
internal constant days : 6.6748e-8
DTS mean temperature days : 7.0
DTS delta days plus julian of start day : 49.0

Testcase 2


Testcase 3


References:

  • Influence of air temperature on the first flowering date of Prunus yedoensis Matsum, chinese paper,China Meteorological Administration , Peijian Shi,1 Zhenghong Chen,2 Qingpei Yang
  • Aono Y. Climatological studies on blooming of cherry tree (Prunus yedoensis) by means of DTS method.
  • Bull. Univ. Osaka Pref. Ser. B. 1993;45:155–192.
  • www.data.jma.go.jp/sakura/data
  • Clarifying springtime temperature reconstructions of the medieval period by gap-filling the cherry blossom phenological data series at Kyoto, Japan
  • Yasuyuki Aono and Shizuka Saito, Osaka Prefecture University, Osaka, Japan
  • Climatelogical Studies on Bloeming of Cherry Tree (Prunus yedoensis)by Means of DTS Method, Yasuyuki Aono
  • Laboratory of Agricultura] and Environmental Meteorology, College of Agriculture
  • Cherry blossom phenological data since the seventeenth century for Edo (Tokyo), Japan, and their application to estimation of March temperatures,Yasuyuki Aono
  • Aono, Y. Omoto, Y. 1990. (青野靖之・小元敬男) Estimation of blooming date for Prunus yedoensis using DTS combined with chill-unit accumulation (in Japanese)(チルユニットを用いた温度変換日数法によるソメイヨシノの開花日の推定). J. Agric. Meteorol. 45: 243-249.
  • Ebata, M. Ishikawa, M. 1987. (江幡守-2衛・石川雅士) Phenology and growing degree days: Analysis of flowering date for cherry tree (Prunus yedoensis) in Nagoya (in Japanese)(植物季節と有効積算気温-名古屋におけるソメイヨシノの開花について-).Mag. Tokai Branch Soc. Agric. Meteorol. Jpn. 45: 27-29. Eguchi, T. 1931. (江口庸雄) Relation between bud-differentiation and blooming periods of fruit trees. (in Japanese)(果樹の花芽分化期と開花期との関係に就いて(予報)).Jour. Hort. Assoc. Japan 2: 26-39.
  • Goi, M. 1982. (五井正憲) Studies on the flower formation and forcing of some ornamental trees and shrubs native to east asia (in Japanese)(温帯花木の花芽形成ならびに開花調節に関する研究).Memoirs of Faculty of Agriculture Kagawa University 38: 1-120.
  • Hanaoka, Y. 1974. (花岡喜重) Studies on the flower bud differentiation and development in Onamental trees and shrubs I. Flower bud development in prunus japonica Thunb, Malus Halliana Koehne, Corylopsis pauciflora Sieb et Zucc, Prunus Mume Sieb, Prunus Persica Batsch, Prunus yedoensis Matsum, and Cercis chinensis Bunge (in Japanese)(花木類の花芽分化に関する研究 I ニワウメ(リンショウバイ),ハナカイドウ,ヒュウガミズキ,ハナモモ,ハナウメ,サクラ,ハナズホウの花芽分化) Bull. Gunma Hort. Exp. Stn. 3: 22-39.
  • Hanaoka, Y. Mogi, T. Mori, A. (花岡喜重・茂木孝夫・森  昭).1980. Ecological Studies on Flowering Trees and Shrubs at Resions of Different Altitude II On Prunus subhirtella Miq, Prunus perusica Batsch, Prunus Mume Sieb. et Zucc (in Japanese)(標高差による花木の生態学的研究 II ヒガンザクラ,モモ,ウメについて).Bull. Gunma Hort. Res. 8: 1-18. *
  • Katsuki, K. (勝木謙蔵) 1989. Studies on the early forcing of cherry cut branches (in Japanese)(サクラ枝物の早期促成に関する研究) Special report of the Yamagata prefectural horticultural experiment station 4: 1-63.
  • Kosugi, K. (小杉 清) 1951. Flowering physiology and cultivation of flowering trees (in Japanese)(花木の開花生理と栽培) Hakuyuusya (博友社),Tokyo, 148-149.
  • Mito, K. (水戸喜平) 2002. Use of natural growth plant in Minamiizu region (in Japanese)(南伊豆地域における自生植物の利活用).Agriculture and Horticulture 77: 468-474.
  • Murakami, S. Suematsu, N. Mito, K. Nakamura, S. (村上 覚・末松信彦・水戸喜平・中村新市). 2006. (Flowering time of ‘Kawazu-zakura’(Prunus lannesiana Wils.) cherry trees in Minamiizu (in japanese)(南伊豆地域の‘カワヅザクラ’の開花期).Hort. Res. (Japan)(in press).
  • Murata, H. (村田治重) 1997. Cherry trees blooming in early spring at southern Izu district in Japan (in Japanese)(南伊豆の早咲きサクラ).Bull. Shizuoka Agr. Exp. Stn. 42: 67-75.
  • Nagata, H. Yurugi, Y. (永田 洋・万木 豊) 2005.Phenological studies in woody plants (I) Flowering in cherry trees (I) (in Japanese) (サクラはなぜ春に咲くのか(I) -生物季節学入門(I). Sakura Science 12. 37-46.
  • Noguchi, K. Kudo, M. Okuyama, N. (野口協一・工藤 信・奥山仁六) 2000. Effect of temperature and daylength on flower-bud differentiation and development in sweet cherry ‘Satonishiki’(in Japanese)(オウトウ‘佐藤錦’の花芽形成に及ぼす気温及び日長の影響).Jour. Japan. Soc. Hort. Sci. 69 (Suppl. 2): 213.
  • Noguchi, K. Kudou, M. Satou, T. (野口協一・工藤 信・佐藤孝宣) 2003. The differentiation and development of flower buds in sweet cherry in various years, regions and cropping methods (in Japanese)(オウトウの花芽形成における年次,地域,作型の影響).Bull. Yamagata Hort. Res. 15. 11-28.
  • Suematsu, N. Mito, K. (末松信彦・水戸喜平) 2003.Characteristics of cherry trees reproduced by seedlings from the mother tree of ‘kawaduzakura’(Prunus lannesiana Wils. cv. Kawazu-zakura)(in japanese)(‘カワヅザクラ’の実生と思われるサクラの特性).Bull.Shizuoka Agr. Exp. Stn. 48: 47-56.
  • Tamura, J. Iyama, S. (田村仁一・井山審也) 1989. The cherrys of National institute of Genetics (in japanese)(遺伝研の桜) National institute of Genetics (国立遺伝学研究所). Shizuoka, 18.
  • Tsunoda, H. (角田春彦) 1976. Cherry (in japanese) (桜) Shizuokaken Sakuranokai (静岡県さくらの会).Shizuoka, 40-60.
  • Mizuhiko Nishida , Nitrogen budget of cattle manure compost incorporated into paddy field. (uses DTS methods in grateful English), Mizuhiko Nishida ,National Agricultural Research Center for Tohoku Region, National Agriculture and Food Research Organization, Daisen
  • Estimation of Temperature at Kyoto since the 11th Century Using Flowering Data of Cherry Trees in Old Documents,Yasuyuki AONO and Yukio OMOTO,
  • Lab. of Agricultural and Environmental Meteorology, College of Agriculture (English abstract)
  • Historical Series of Phenological data for Cherry Tree Flowering at Kyoto City(and March Mean Temperature Reconstructions),Yasuyuki AONO

Appendix Code

appendix TCL programs and scripts

        # pretty print from autoindent and ased editor
        # Cherry Blossom Viewing Equation calculator
        # written on Windows XP on eTCL
        # working under TCL version 8.5.6 and eTCL 1.0.1
        # gold on TCL WIKI, 20oct2014
        package require Tk
        namespace path {::tcl::mathop ::tcl::mathfunc}
        frame .frame -relief flat -bg aquamarine4
        pack .frame -side top -fill y -anchor center
        set names {{} {site name number :} }
        lappend names {julian date start day :}
        lappend names {mean day temperature in Kelvin (optional) :}
        lappend names {standard temperature constant (optional) :}
        lappend names {sakura blossom constant (optional) :}
        lappend names {answers: internal constant days: }
        lappend names {internal constant days : }
        lappend names {DTS mean temperature days:}
        foreach i {1 2 3 4 5 6 7 8} {
            label .frame.label$i -text [lindex $names $i] -anchor e
            entry .frame.entry$i -width 35 -textvariable side$i
            grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1 }
        proc about {} {
            set msg "Calculator for Cherry Blossom Equation             
            from TCL WIKI,
            written on eTCL "
            tk_messageBox -title "About" -message $msg }   
        proc break_flag_routine {     } {
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global spares 
            global testcase_number
            set t9 $testcase_number
            set product_entries [* $side1 $side2 $side3 $side4 $side5 $side6 $side7 $side8] 
            if { $product_entries < 0.0 } { puts " warning flag! negative numbers detected in product entries ref. tc$t9" }
            foreach item { 1 2 3 4 5 6 7 8 9 10 } {
            set error$item 0 }
            if { $side1 < 0.0 } { set side1 .000001 ; set error1 1 ; set error2 1 }
            if { $side2 < 0.0 } { set side2 .000001 ; set error1 1 ; set error3 1 }
            if { $side3 < 0.0 } { set side3 .000001 ; set error1 1 ; set error4 1}
            if { $side4 < 0.0 } { set side4 .000001 ; set error1 1 ; set error5 1} 
            if { $side5 < 0.0 } { set side5 .000001 ; set error1 1 ; set error6 1}
            if { $side6 < 0.0 } { set side6 .000001 ; set error1 1 ; set error7 1}
            if { $side7 < 0.0 } { set side7 .000001 ; set error1 1 ; set error8 1}
            if { $side8 < 0.0 } { set side8 .000001 ; set error1 1 ; set error9 1}
            if { $side8 > 400.0 } {set error9 1}
            if { $side8 > 1000.0 } {set error10 1}      
            if { $error1 == 1 } { puts " warning flag! negative numbers detected in entries ref. tc$t9" }
            if { $error2 == 1 } { puts " warning flag! setting program default entries to positive ref. tc$t9" }
            if { $error3 == 1 } { puts " lower limit side2! setting program default entry ref. tc$t9" }
            if { $error4 == 1 } { puts " lower limit side3! setting program default entry ref. tc$t9" }
            if { $error5 == 1 } { puts " lower limit side4! defaults set but degrading accuracy ref. tc$t9" }
            if { $error6 == 1 } { puts " lower limit side5! outside expected range ref. tc$t9" }
            if { $error7 == 1 } { puts " lower limit side6! outside expected range ref. tc$t9" }
            if { $error8 == 1 } { puts " lower limit side7! outside expected range ref. tc$t9" }
            if { $error9 == 1 } { puts " upper limit side8! days outside expected range ref. tc$t9" }
            if { $error10 == 1 } { puts " upper limit side8! days far expected range ref. tc$t9" }
            foreach item { 1 2 3 4 5 6 7 8 9 10 } {
            set error$item 0 }
            return 1 } 
        proc fuzzy_round_up {args } {
            set lister {}
            foreach item $args {
            if { $item > [int $item ] &&  $item > 0. } { lappend lister [+ [int $item ] 1.]}                     
            if { $item == [int $item ] } { lappend lister [* $item 1.] }
            if { $item < [int $item ] &&  $item < 0. } { lappend lister [+ [int $item ] -1.]}  
                 }
                return $lister }
        proc mean_temperature_DTS  { temperature0 }   {
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global testcase_number
            global cumulative_days_dts mean_temperature_days_dts
            global temperature2 site_mean_lag exponent1 temperature2 
            global combo_exponent3 exponent2
            #set exponent2 [- [/ 1. $temperature2 ] [/ 1. $temperature0 ] ]
            set exponent2 [/ [- $temperature0 $temperature2] [* $temperature0  $temperature2 1.] ]            
            #set combo_exponent3 [* $exponent1 $exponent2 1. 1E-3 ]
            #set combo_exponent3 [* $exponent1 $exponent2 1. 1E-2  ]
            set combo_exponent3 [* $exponent1 $exponent2 1.  ]
            puts " exp1  $exponent1 exp2 $exponent2   comb   $combo_exponent3   "
            set mean_temperature_days_dts [exp $combo_exponent3] 
            #set mean_temperature_days_dts [* $mean_temperature_days_dts $site_mean_lag ]
            set mean_temperature_days_dts [* $mean_temperature_days_dts  ]
            set rem $mean_temperature_days_dts
            return $rem}    
        proc calculate {     } {
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global cumulative_days_dts mean_temperature_days_dts
            global temperature2 site_mean_lag exponent1 
            global combo_exponent3 exponent2 sum_julian
            global testcase_number 
            incr testcase_number 
            set side1 [* $side1 1. ]
            set side2 [* $side2 1. ]
            set side3 [* $side3 1. ]
            set side4 [* $side4 1. ]
            set side5 [* $side5 1. ]
            set side6 [* $side6 1. ]
            set side7 [* $side7 1. ]
            set side8 [* $side8 1. ]
            break_flag_routine
            set site_number $side1
            set start_julian $side2
            set temperature1 $side3
            #set exponent1 [* 9.5E3 1.]
            set sakura_exponent  $side5
            set r_gas_constant 8.31432
            set exponent1 [/ $r_gas_constant  $sakura_exponent ]
            set standard_temperature2 $side4
            set temperature2 $standard_temperature2  
            set site_mean_lag .2
            set cumulative_days_dts 0.
            set counter 0
            foreach item { 300 300 280 300 300 300 300 298 300 300 300 301 300 300 327 300 300 300 298 300 302 308 288 303  295} {
            incr counter
            set cumulative_days_dts  [+ $cumulative_days_dts [ mean_temperature_DTS $item ]]
            puts " single term  [  mean_temperature_DTS $item ] from t1. $item count $counter  \n "
            puts " day mean t.  $item cumulative $cumulative_days_dts ref t. $temperature2 ex. $exponent2" }
            set check_DTS_algorithm [ mean_temperature_DTS $temperature1 ]
            puts " checking DTS_algorithm from loaded mean t1 $temperature1 gives indv. DTS $check_DTS_algorithm ]"
            set cumulative $cumulative_days_dts 
            set cumulative [/ $cumulative 4. ]  
            set cumulative [ fuzzy_round_up  $cumulative  ]
            #set average_entries [/ 5.  [+ $side1 $side2 $side3 $side4 $side5 ]  ] 
            set side6 [abs $exponent2 ]
            set side7 [abs $combo_exponent3]
            set side8 $cumulative 
            set sum_julian [+ $start_julian $cumulative ]                 
                  }
        proc fillup {aa bb cc dd ee ff gg hh} {
            .frame.entry1 insert 0 "$aa"
            .frame.entry2 insert 0 "$bb"
            .frame.entry3 insert 0 "$cc"
            .frame.entry4 insert 0 "$dd"
            .frame.entry5 insert 0 "$ee"
            .frame.entry6 insert 0 "$ff" 
            .frame.entry7 insert 0 "$gg"
            .frame.entry8 insert 0 "$hh" 
             }
        proc clearx {} {
            foreach i {1 2 3 4 5 6 7 8 } {
                .frame.entry$i delete 0 end } }
        proc reportx {} {
            global side1 side2 side3 side4 side5
            global side6 side7 side8 
            global sum_julian
            global testcase_number
            console show;
            puts "%|table $testcase_number|printed in| tcl wiki format|% "
            puts "&| quantity | value| comment, if any|& "
            puts "&| testcase number:|$testcase_number | |&"
            puts "&| weather site number :|$side1|   |&"
            puts "&| julian date start day  :|$side2| |& "
            puts "&| mean day temperature in Kelvin (optional):|$side3| |& "
            puts "&| standard temperature constant (optional) :|$side4|  |&"
            puts "&| blossom constant (optional) :|$side5|  |&"
            puts "&| answers: internal constant days    :|$side6|  |&"  
            puts "&| internal constant days  :| $side7 |  |&"
            puts "&| DTS mean temperature days :| $side8 |  |&"
            puts "&| DTS delta days plus julian of start day :| $sum_julian |  |&"
         }
        frame .buttons -bg aquamarine4
        ::ttk::button .calculator -text "Solve" -command { calculate   }
        ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 1. 42.0 300.0 288.2   17.E3 .1 .2 7. }
        ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 2. 44.0 300.0 288.2   56.E3 .1 .2 7. }
        ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 3. 46.0 300.0 288.2   9.5E3 .1 .2 7. }
        ::ttk::button .clearallx -text clear -command {clearx }
        ::ttk::button .about -text about -command about
        ::ttk::button .cons -text report -command { reportx }
        ::ttk::button .exit -text exit -command {exit}
        pack .calculator  -in .buttons -side top -padx 10 -pady 5
        pack  .clearallx .cons .about .exit .test4 .test3 .test2   -side bottom -in .buttons
        grid .frame .buttons -sticky ns -pady {0 10}
        . configure -background aquamarine4 -highlightcolor brown -relief raised -border 30
        wm title . "Cherry Blossom Equation Calculator "
 

gold This page is copyrighted under the TCL/TK license terms, this license .

Comments Section

Please place any comments here, Thanks.