diff --git a/.gitignore b/.gitignore index 1397e109..93a84411 100644 --- a/.gitignore +++ b/.gitignore @@ -30,12 +30,12 @@ __pycache__/ *.DS_Store -examples/mare-with-rays-model2/CTEM - *.json *.xml *.iml -examples/global-lunar-bombardment/ +examples/mare-with-rays-model2/CTEM + +examples/global-lunar-bombardment/CTEM diff --git a/examples/global-lunar-bombardment/.gitignore b/examples/global-lunar-bombardment/.gitignore new file mode 100644 index 00000000..4957ab06 --- /dev/null +++ b/examples/global-lunar-bombardment/.gitignore @@ -0,0 +1,4 @@ +*.jpg +*.png +*.out +surface_* diff --git a/examples/global-lunar-bombardment/FassettCounts.txt b/examples/global-lunar-bombardment/FassettCounts.txt new file mode 100755 index 00000000..44ce2d5c --- /dev/null +++ b/examples/global-lunar-bombardment/FassettCounts.txt @@ -0,0 +1,1859 @@ +0.262536589 +0.176770321 +0.175995859 +0.156565826 +0.130153339 +0.126776836 +0.126553629 +0.118358564 +0.116568588 +0.106986374 +0.105429213 +0.098078171 +0.092612749 +0.090501684 +0.09047876 +0.08781776 +0.085820858 +0.085754002 +0.083454996 +0.076337128 +0.075205063 +0.07340358 +0.073309078 +0.072861195 +0.068587427 +0.068080952 +0.066606033 +0.065360443 +0.065199574 +0.064515709 +0.064202063 +0.062984385 +0.061691271 +0.061284111 +0.060228058 +0.059947254 +0.055627617 +0.055591274 +0.053209719 +0.05240097 +0.051933239 +0.051539026 +0.050585707 +0.050556021 +0.048518661 +0.0469625 +0.04669845 +0.046388145 +0.04604167 +0.046022951 +0.045856228 +0.045741301 +0.045294882 +0.044407434 +0.044282604 +0.044105377 +0.043816229 +0.043681845 +0.043550516 +0.043486217 +0.042997763 +0.042848343 +0.042555172 +0.040751772 +0.039898363 +0.039055811 +0.038536098 +0.038294147 +0.037820879 +0.037679493 +0.036935659 +0.03689386 +0.035973907 +0.035657555 +0.035625893 +0.035545273 +0.035306149 +0.035302029 +0.035045565 +0.035043678 +0.034913473 +0.034847137 +0.034552809 +0.034384033 +0.033993189 +0.033745352 +0.033523645 +0.033318762 +0.033016794 +0.032899143 +0.032609478 +0.032314951 +0.032142475 +0.03200486 +0.031917757 +0.031890144 +0.031857988 +0.031460625 +0.030767677 +0.030767113 +0.030460476 +0.030331865 +0.030289734 +0.029726887 +0.029615973 +0.029550011 +0.02938451 +0.029173721 +0.029095247 +0.029082436 +0.029073275 +0.028761459 +0.028689842 +0.028631931 +0.028592638 +0.028579586 +0.028563473 +0.028557178 +0.028480917 +0.028459938 +0.028346771 +0.028335405 +0.028153231 +0.028084768 +0.028073935 +0.028040752 +0.02793849 +0.027823267 +0.027690029 +0.027462877 +0.02729034 +0.027278883 +0.026917295 +0.026840796 +0.026818367 +0.026721016 +0.026655212 +0.02663151 +0.026473448 +0.026417494 +0.026259781 +0.026256214 +0.026160954 +0.026140079 +0.026019669 +0.025973564 +0.025891783 +0.025720058 +0.025710346 +0.025668613 +0.025640926 +0.025276188 +0.025203102 +0.025177795 +0.025167692 +0.025158926 +0.025071365 +0.025056839 +0.025004429 +0.024973148 +0.024682114 +0.024676453 +0.024466703 +0.024330297 +0.024309729 +0.02425374 +0.024244202 +0.024087336 +0.023678082 +0.023496538 +0.02347315 +0.023157385 +0.022928219 +0.022852436 +0.02281638 +0.02279372 +0.022724525 +0.02266025 +0.022654459 +0.022652817 +0.022649279 +0.022620216 +0.022600542 +0.022588608 +0.022569284 +0.022550669 +0.022410641 +0.022315672 +0.022302658 +0.022299139 +0.022288818 +0.022202471 +0.022167955 +0.022162033 +0.02209297 +0.022073755 +0.021955069 +0.021751413 +0.021708652 +0.021423197 +0.021378506 +0.021259531 +0.021227345 +0.021089561 +0.020936649 +0.020861197 +0.020860371 +0.020838644 +0.020606852 +0.020473328 +0.020472935 +0.020471384 +0.020430973 +0.020380817 +0.020325941 +0.020262781 +0.020239618 +0.020236551 +0.02021805 +0.020058912 +0.020020618 +0.02001145 +0.019993168 +0.019958797 +0.019916817 +0.019894848 +0.019819748 +0.01980736 +0.019772074 +0.019747128 +0.019706919 +0.019619061 +0.019556425 +0.01953952 +0.019537689 +0.01937623 +0.019359455 +0.019353893 +0.019328989 +0.019320642 +0.019315897 +0.01931078 +0.019274996 +0.019219761 +0.019188459 +0.019170271 +0.019121384 +0.019117035 +0.019082581 +0.01900869 +0.018900898 +0.01887785 +0.018834726 +0.018802755 +0.018799969 +0.018734516 +0.018716284 +0.018657557 +0.018486683 +0.018470064 +0.01843469 +0.018428869 +0.018424885 +0.018359276 +0.018357563 +0.018275291 +0.018178654 +0.018173914 +0.018167345 +0.018141184 +0.018096386 +0.018080029 +0.018067968 +0.018058834 +0.018057837 +0.018043201 +0.018038431 +0.017957052 +0.017945669 +0.017872269 +0.017806503 +0.017760859 +0.017738289 +0.017689602 +0.017683031 +0.017664824 +0.017629597 +0.017627619 +0.017572273 +0.01746537 +0.017459494 +0.017347958 +0.017296581 +0.017276457 +0.017257166 +0.017207304 +0.017165371 +0.017153646 +0.017105444 +0.017037437 +0.017032539 +0.017010843 +0.016990288 +0.016960238 +0.016940037 +0.016935999 +0.016928764 +0.016826895 +0.016826365 +0.016784529 +0.016782661 +0.016767546 +0.016752989 +0.016724216 +0.016719021 +0.016698797 +0.016666059 +0.016629961 +0.016604898 +0.016601042 +0.016569962 +0.016551758 +0.016543955 +0.016517651 +0.016488834 +0.016479387 +0.01644212 +0.016438778 +0.016426662 +0.016424648 +0.016361364 +0.016360878 +0.016351889 +0.01633313 +0.016324522 +0.01630615 +0.016235176 +0.016225349 +0.016223791 +0.016197784 +0.016143642 +0.016067232 +0.016022793 +0.016020367 +0.016010267 +0.016004301 +0.015972395 +0.015945494 +0.015922928 +0.015917259 +0.015873688 +0.015823755 +0.015801109 +0.015800224 +0.01578319 +0.015766155 +0.015756973 +0.015749697 +0.01574148 +0.015733179 +0.015717846 +0.015688328 +0.015679689 +0.015651791 +0.015578312 +0.015568274 +0.015530949 +0.015530323 +0.015514252 +0.015489029 +0.015470831 +0.015454618 +0.015418854 +0.015399651 +0.015362696 +0.015293245 +0.015278149 +0.015268711 +0.015223194 +0.015179592 +0.015173313 +0.015159817 +0.015134972 +0.015124113 +0.015116041 +0.015099134 +0.015076462 +0.015045692 +0.015029678 +0.015027952 +0.015027258 +0.014935503 +0.01493124 +0.014926783 +0.01491824 +0.0149004 +0.014860443 +0.014859562 +0.014846706 +0.014798023 +0.014779491 +0.014776089 +0.014741917 +0.014723202 +0.014678886 +0.014669807 +0.014668699 +0.014668066 +0.014646431 +0.014642235 +0.014635643 +0.014628716 +0.014619865 +0.014581942 +0.014542461 +0.014536594 +0.014529648 +0.014468794 +0.014467144 +0.014455965 +0.014454327 +0.014449732 +0.014434872 +0.014409092 +0.014391941 +0.014377277 +0.014373404 +0.014367949 +0.014364553 +0.014335861 +0.014331312 +0.014315964 +0.01426531 +0.014250792 +0.014210838 +0.014205109 +0.014191071 +0.014177277 +0.014177231 +0.014173882 +0.014140757 +0.014134668 +0.014126049 +0.014125811 +0.014054796 +0.014049654 +0.014025244 +0.014011656 +0.014005735 +0.014000278 +0.013994108 +0.013980742 +0.013960318 +0.013959234 +0.013957403 +0.013863153 +0.013853767 +0.013846024 +0.013827398 +0.0138141 +0.013794388 +0.013780336 +0.013725868 +0.01370705 +0.013689266 +0.013676516 +0.013659449 +0.013632868 +0.013612614 +0.013608204 +0.013590315 +0.013580334 +0.013579395 +0.013574163 +0.013561247 +0.013552969 +0.013543577 +0.013521376 +0.013520414 +0.013518848 +0.013515829 +0.013506664 +0.013487404 +0.013485006 +0.013484594 +0.013480972 +0.013479225 +0.01347628 +0.013475264 +0.01346327 +0.013460785 +0.013449255 +0.013442308 +0.013407326 +0.013399773 +0.013395823 +0.013386217 +0.013368906 +0.013360865 +0.013346773 +0.013335306 +0.013333345 +0.013333048 +0.013321527 +0.013315958 +0.013315645 +0.01330739 +0.01330707 +0.013300503 +0.013275019 +0.013258389 +0.013248606 +0.013243155 +0.013229275 +0.013220968 +0.013217663 +0.013214537 +0.013209286 +0.013207514 +0.013207174 +0.013193296 +0.013181753 +0.013153952 +0.013148331 +0.013147619 +0.01313567 +0.013118118 +0.013115601 +0.01311112 +0.013109673 +0.013098419 +0.013078987 +0.013071623 +0.013053558 +0.013045286 +0.013034384 +0.013032793 +0.012990602 +0.012989401 +0.012988441 +0.012980288 +0.012979965 +0.012975786 +0.012964212 +0.012956188 +0.012955414 +0.012893169 +0.012893152 +0.0128902 +0.012886431 +0.012879498 +0.012878588 +0.012859074 +0.012858637 +0.012857098 +0.012831366 +0.012811628 +0.012811588 +0.01280357 +0.012792517 +0.012785456 +0.012731108 +0.012724525 +0.012707968 +0.012705519 +0.012686659 +0.012677549 +0.012675512 +0.012669334 +0.012662849 +0.012638254 +0.012635168 +0.012623556 +0.012621117 +0.012598213 +0.012597338 +0.012591715 +0.012580093 +0.012575912 +0.012569979 +0.01256566 +0.012554483 +0.012516331 +0.012513477 +0.012508524 +0.012498989 +0.012497349 +0.012469387 +0.012460047 +0.012458017 +0.012454325 +0.012438656 +0.012437292 +0.012430819 +0.012428659 +0.012428358 +0.012392172 +0.012384192 +0.012363575 +0.0123627 +0.012350508 +0.012346867 +0.01234458 +0.012331961 +0.012319809 +0.012309959 +0.012292959 +0.012284637 +0.012281668 +0.012281235 +0.012280586 +0.012274038 +0.012268166 +0.012258696 +0.012257057 +0.012251684 +0.012246971 +0.012233299 +0.012228237 +0.012225534 +0.01220252 +0.012199188 +0.012192537 +0.012169985 +0.012165277 +0.01216407 +0.012150248 +0.012142494 +0.012138397 +0.012134502 +0.01213015 +0.012127392 +0.012120623 +0.012117563 +0.012116022 +0.012113462 +0.012105881 +0.012105434 +0.012104166 +0.012102961 +0.01209749 +0.012092037 +0.012088411 +0.012075352 +0.012067623 +0.012067242 +0.012063 +0.012036968 +0.012029539 +0.012010164 +0.011975971 +0.01196966 +0.011960005 +0.011939915 +0.011938236 +0.011930258 +0.011906082 +0.011903753 +0.011892712 +0.011889427 +0.011856606 +0.011820641 +0.011805254 +0.011789558 +0.011789398 +0.01178734 +0.011783859 +0.011779053 +0.011778351 +0.011777405 +0.011772186 +0.011769785 +0.011769045 +0.011750731 +0.011747965 +0.011736797 +0.011734623 +0.011733103 +0.011727646 +0.01172629 +0.011725962 +0.011709002 +0.011707088 +0.011696634 +0.011681881 +0.011675974 +0.011667149 +0.011655512 +0.011647635 +0.011647419 +0.01163505 +0.011605785 +0.011605425 +0.011600323 +0.011598598 +0.011597515 +0.011596882 +0.011592381 +0.011589779 +0.011586567 +0.011561277 +0.011549034 +0.011542812 +0.011533627 +0.011532291 +0.011521511 +0.011510878 +0.011508146 +0.011506927 +0.011503363 +0.011489201 +0.011487507 +0.011483534 +0.011479553 +0.011467575 +0.011454956 +0.011446638 +0.011445547 +0.011441696 +0.011437248 +0.011431505 +0.011427803 +0.011426689 +0.011415283 +0.011396639 +0.01138549 +0.011352455 +0.011314417 +0.011306023 +0.011303225 +0.011302319 +0.011300928 +0.011289301 +0.011285217 +0.011281603 +0.011278131 +0.01127788 +0.011263325 +0.011262651 +0.011262035 +0.011246296 +0.011234552 +0.011231739 +0.011231646 +0.011219385 +0.01121571 +0.01120808 +0.011197796 +0.011194654 +0.011191275 +0.01118327 +0.011173223 +0.011152914 +0.011149899 +0.011143148 +0.011132282 +0.011125904 +0.011119093 +0.011117306 +0.011116018 +0.011109745 +0.011104404 +0.011101629 +0.011097563 +0.011075924 +0.011064947 +0.01105262 +0.01104351 +0.011031324 +0.011030983 +0.011029053 +0.011020464 +0.011018896 +0.011011696 +0.011001032 +0.010998014 +0.010984489 +0.010971436 +0.010968437 +0.010963564 +0.010949352 +0.010948906 +0.010934481 +0.010930653 +0.010904673 +0.010899469 +0.01089786 +0.010891098 +0.010890671 +0.010883684 +0.010878458 +0.010868954 +0.010840351 +0.010828503 +0.010828463 +0.010825006 +0.010823111 +0.010821735 +0.010817783 +0.010810497 +0.010802845 +0.01079652 +0.010791281 +0.010790363 +0.01078661 +0.010768972 +0.010767355 +0.010755199 +0.010752583 +0.01073773 +0.010730816 +0.010725431 +0.010719328 +0.010708258 +0.010699146 +0.010698341 +0.010698065 +0.010691956 +0.010674366 +0.010650129 +0.010644913 +0.010642487 +0.010639471 +0.010637476 +0.010636229 +0.010623184 +0.010613899 +0.010610718 +0.010591265 +0.010589745 +0.010572945 +0.010570053 +0.010569427 +0.010567434 +0.010564369 +0.010555328 +0.01055295 +0.010534523 +0.010531313 +0.010522446 +0.010521631 +0.010521332 +0.010512012 +0.010507 +0.010502451 +0.010496294 +0.010495981 +0.010483732 +0.010479671 +0.010476015 +0.010474428 +0.010467804 +0.010461031 +0.010460667 +0.010458643 +0.010456127 +0.010455097 +0.010447887 +0.010445536 +0.010445459 +0.010440294 +0.010437674 +0.010424053 +0.010416035 +0.010414288 +0.010411982 +0.010407345 +0.010399019 +0.010397694 +0.010388165 +0.010378002 +0.01037006 +0.010369282 +0.010366194 +0.010362364 +0.010360876 +0.010360525 +0.010359678 +0.010355755 +0.010355 +0.010347639 +0.010340961 +0.010337378 +0.010333439 +0.010332153 +0.010330547 +0.010319702 +0.010315458 +0.010309067 +0.010282721 +0.010280952 +0.010279924 +0.010276993 +0.01026244 +0.010249809 +0.010248869 +0.010244844 +0.010238785 +0.010236814 +0.010225241 +0.010225189 +0.010216644 +0.010205359 +0.01020236 +0.010201057 +0.010196196 +0.010189608 +0.010189569 +0.010172859 +0.010172478 +0.010165102 +0.01014731 +0.010141016 +0.010140961 +0.010140358 +0.010133509 +0.010133013 +0.010129753 +0.010118662 +0.010115639 +0.010097383 +0.010086994 +0.010082422 +0.010079693 +0.010077808 +0.010072815 +0.010069971 +0.010069366 +0.010055101 +0.01005344 +0.010052853 +0.010047998 +0.010046717 +0.010044819 +0.010043018 +0.010027805 +0.010021772 +0.010021236 +0.01001984 +0.010019176 +0.010010813 +0.00999271 +0.009992634 +0.009991449 +0.009988405 +0.009984127 +0.009974216 +0.009973822 +0.009963972 +0.009963217 +0.009959003 +0.009956129 +0.009952198 +0.009951605 +0.009948689 +0.009944738 +0.009934162 +0.009918089 +0.009917334 +0.009915791 +0.009914267 +0.009904041 +0.009895824 +0.009893026 +0.009889654 +0.009885946 +0.009877302 +0.009871275 +0.009862823 +0.009861906 +0.009858282 +0.009857748 +0.009855597 +0.009847418 +0.009838875 +0.009835417 +0.009831131 +0.009821716 +0.009816917 +0.009803411 +0.009801027 +0.009800934 +0.009796852 +0.009794268 +0.00978698 +0.00978071 +0.009769447 +0.009763535 +0.009754473 +0.009749176 +0.009735178 +0.009727205 +0.009726158 +0.009698318 +0.009689453 +0.009668062 +0.009665691 +0.009660448 +0.00965749 +0.009654848 +0.009649281 +0.009637127 +0.009626499 +0.009619808 +0.009618343 +0.009615482 +0.0096136 +0.009610949 +0.009606657 +0.009603209 +0.009598448 +0.009588451 +0.009587584 +0.009577406 +0.009574543 +0.009573772 +0.009573324 +0.009570744 +0.009566359 +0.009563923 +0.009561911 +0.009549023 +0.009546049 +0.009538694 +0.009536924 +0.009534451 +0.009518095 +0.00951535 +0.009508617 +0.009503626 +0.009499363 +0.009495277 +0.009491816 +0.009480606 +0.009474659 +0.009469687 +0.009466248 +0.009465406 +0.009452772 +0.009446671 +0.009442673 +0.009437975 +0.00943074 +0.009428259 +0.009424911 +0.00942466 +0.009418406 +0.00941394 +0.009413757 +0.009407326 +0.009403046 +0.009401253 +0.009391813 +0.009382788 +0.009379992 +0.009376503 +0.009361496 +0.009357916 +0.009354851 +0.00935318 +0.009352173 +0.00934803 +0.009345863 +0.009329193 +0.009310602 +0.009304094 +0.009301453 +0.009299442 +0.009292503 +0.009284487 +0.009283396 +0.00928088 +0.009279207 +0.009275887 +0.009271751 +0.009265942 +0.009260149 +0.009254648 +0.009254284 +0.009252703 +0.009251087 +0.009249889 +0.009248173 +0.009242489 +0.00923875 +0.009236567 +0.009235508 +0.009233568 +0.009231432 +0.009230724 +0.009227587 +0.009224741 +0.009222822 +0.009221806 +0.009216061 +0.009210773 +0.009206926 +0.009206793 +0.00919978 +0.00919894 +0.009184977 +0.009181301 +0.009174124 +0.009171574 +0.009167807 +0.009165182 +0.009157467 +0.009156483 +0.009154934 +0.009154753 +0.009153097 +0.009150114 +0.009149862 +0.009133947 +0.009125546 +0.009125187 +0.009121799 +0.009118078 +0.009116598 +0.009116219 +0.009113089 +0.009109341 +0.009106779 +0.009098486 +0.009091818 +0.009087416 +0.009081589 +0.009071327 +0.009068558 +0.009067184 +0.009057989 +0.009054289 +0.00905188 +0.009050917 +0.009045128 +0.009042654 +0.009039398 +0.00903755 +0.009036253 +0.009035683 +0.009025154 +0.009024414 +0.009016073 +0.009010956 +0.009010275 +0.009009649 +0.009008425 +0.009008026 +0.009003935 +0.009003487 +0.009001575 +0.009000021 +0.008998213 +0.008997826 +0.00899695 +0.00899629 +0.008994701 +0.008980593 +0.008979242 +0.008973251 +0.008967598 +0.008967264 +0.008962202 +0.008958742 +0.008956482 +0.008949486 +0.008948862 +0.008936363 +0.008931353 +0.008928507 +0.00892395 +0.008912882 +0.008911312 +0.008905334 +0.008904833 +0.008898914 +0.008898584 +0.008896852 +0.008896091 +0.008895342 +0.008879528 +0.008878824 +0.008875925 +0.008873835 +0.008866924 +0.008866913 +0.008853792 +0.008847788 +0.008842609 +0.00884203 +0.008841763 +0.008823824 +0.008823648 +0.008821688 +0.008815807 +0.008815762 +0.008815523 +0.008813768 +0.008812487 +0.008809599 +0.00880356 +0.008800686 +0.008790859 +0.008787264 +0.008787136 +0.00878548 +0.008778179 +0.008773167 +0.008769232 +0.008766172 +0.008758953 +0.008753864 +0.008745367 +0.008728994 +0.008727705 +0.008722036 +0.008714931 +0.008713942 +0.008706615 +0.008706228 +0.008702322 +0.00869656 +0.008695816 +0.008694998 +0.008687172 +0.008683538 +0.008681408 +0.008680571 +0.008677876 +0.008668587 +0.008665112 +0.008660421 +0.00865873 +0.008652853 +0.008649252 +0.008645973 +0.008637754 +0.008627981 +0.008618307 +0.008618225 +0.008611267 +0.008608376 +0.008605997 +0.008605856 +0.008604956 +0.008601501 +0.008593412 +0.008593252 +0.008590149 +0.008581535 +0.008579865 +0.008579063 +0.008576729 +0.00857555 +0.008567648 +0.008565775 +0.00856448 +0.008560547 +0.008560545 +0.008559984 +0.008559341 +0.008557108 +0.00855102 +0.008548868 +0.00854011 +0.008531914 +0.008531733 +0.008530304 +0.008523857 +0.008521852 +0.0085205 +0.008506149 +0.008496536 +0.008492718 +0.008491959 +0.008491611 +0.008483423 +0.008482132 +0.008480064 +0.0084772 +0.00847496 +0.008471758 +0.00846702 +0.008464207 +0.00845647 +0.008449924 +0.008448872 +0.008446491 +0.008446367 +0.008444078 +0.00843767 +0.008437092 +0.008437023 +0.008436787 +0.008430056 +0.008423786 +0.008409794 +0.008409582 +0.00840749 +0.008404102 +0.008402639 +0.008402025 +0.008398212 +0.008398067 +0.008397497 +0.008390812 +0.008388365 +0.008387287 +0.008386095 +0.008385265 +0.008384295 +0.008382305 +0.008377583 +0.008375067 +0.008370543 +0.008363409 +0.008362431 +0.008350986 +0.008350721 +0.008347136 +0.008346004 +0.008345411 +0.008340242 +0.008339193 +0.008337996 +0.008335783 +0.008332388 +0.008331875 +0.008329184 +0.008329 +0.008325085 +0.008317554 +0.008315899 +0.00831558 +0.008312111 +0.008311546 +0.008308163 +0.008303694 +0.008302061 +0.008295502 +0.008276363 +0.0082719 +0.008268257 +0.008266729 +0.008265278 +0.008252605 +0.008252218 +0.008250618 +0.00824852 +0.008243444 +0.008241011 +0.008235146 +0.008234823 +0.008232748 +0.008228065 +0.00822789 +0.008227877 +0.008222773 +0.008221802 +0.008220362 +0.008214621 +0.0082124 +0.00821044 +0.008207237 +0.008198914 +0.008193914 +0.008192726 +0.008192453 +0.008189316 +0.008188591 +0.008180777 +0.008174021 +0.008166906 +0.008166307 +0.008163851 +0.008158514 +0.008132813 +0.008130104 +0.008126024 +0.008125488 +0.008124292 +0.008123589 +0.008123493 +0.008123234 +0.008116533 +0.008115725 +0.00811104 +0.008109131 +0.008099726 +0.008099237 +0.008098579 +0.00808876 +0.00808765 +0.008086834 +0.008085915 +0.00808304 +0.008081331 +0.008078959 +0.008076214 +0.008073627 +0.008070107 +0.008067293 +0.008065502 +0.008063486 +0.008058489 +0.008050545 +0.008043613 +0.008037531 +0.008033579 +0.00802656 +0.008025509 +0.008023716 +0.008019367 +0.008016018 +0.007995533 +0.007995502 +0.007994684 +0.007993433 +0.007991413 +0.007990221 +0.007981342 +0.007980297 +0.007976282 +0.00797542 +0.007963688 +0.007961447 +0.007960775 +0.007959494 +0.007949574 +0.007947363 +0.007943882 +0.00794335 +0.007938526 +0.007938213 +0.007937023 +0.007933744 +0.007928679 +0.0079184 +0.007917301 +0.007916977 +0.007916502 +0.007914402 +0.007911205 +0.007907639 +0.007898962 +0.007897505 +0.007890778 +0.007888922 +0.00788455 +0.007882633 +0.007878956 +0.007873016 +0.007866476 +0.007862608 +0.007861006 +0.007856619 +0.007848036 +0.007846813 +0.007837957 +0.007830175 +0.007830101 +0.007813538 +0.007806742 +0.007800179 +0.00779528 +0.007793753 +0.007782089 +0.007777205 +0.007774603 +0.007773149 +0.00777243 +0.007764381 +0.007753885 +0.007737322 +0.007736816 +0.007732416 +0.007730043 +0.007727249 +0.007725708 +0.007722313 +0.007709854 +0.007709442 +0.007707956 +0.007707741 +0.007705021 +0.007697092 +0.007690178 +0.007686562 +0.007686396 +0.007686283 +0.007685259 +0.007682032 +0.007679382 +0.007677752 +0.00767338 +0.007671814 +0.007669827 +0.007667139 +0.00766713 +0.00766556 +0.007663883 +0.007647295 +0.007645601 +0.007644512 +0.007641895 +0.007634661 +0.007633572 +0.007626781 +0.007620035 +0.007608179 +0.007603334 +0.007596003 +0.007594143 +0.00759277 +0.007587484 +0.00753887 +0.007538639 +0.007538141 +0.007532749 +0.007531567 +0.007530338 +0.007527729 +0.007527119 +0.007521132 +0.007515654 +0.007515554 +0.007508749 +0.007503225 +0.00749881 +0.007496796 +0.007492863 +0.007489515 +0.007487968 +0.007486027 +0.007480305 +0.007476843 +0.007475327 +0.007472973 +0.007472609 +0.007466551 +0.007458138 +0.007457579 +0.007454803 +0.007443495 +0.007440092 +0.007436852 +0.007423079 +0.007420023 +0.007415533 +0.007405418 +0.007404099 +0.007399483 +0.0073958 +0.007394213 +0.0073892 +0.007384178 +0.007381269 +0.007375069 +0.007370123 +0.007362854 +0.007362654 +0.007362572 +0.007360636 +0.007350525 +0.007348639 +0.007348511 +0.007345818 +0.007340227 +0.007333773 +0.007331263 +0.007330294 +0.0073283 +0.007322588 +0.007308031 +0.007306694 +0.007304211 +0.007295887 +0.007293764 +0.007292185 +0.007277504 +0.007276218 +0.007269623 +0.007268534 +0.007266216 +0.007261278 +0.007260929 +0.007249109 +0.00724872 +0.00723798 +0.007232494 +0.007231319 +0.007229631 +0.00722677 +0.007221827 +0.007221193 +0.00721487 +0.007211618 +0.007207369 +0.007204393 +0.007201649 +0.00720067 +0.00719776 +0.007197191 +0.007195637 +0.007190441 +0.007190075 +0.007189671 +0.007182873 +0.007180506 +0.007178869 +0.007171055 +0.007170536 +0.007169872 +0.007160252 +0.007159506 +0.007139025 +0.007138716 +0.007133526 +0.007132404 +0.007130962 +0.00712409 +0.007110884 +0.007107983 +0.007106459 +0.007106091 +0.007097916 +0.007090223 +0.007084623 +0.007083195 +0.007068876 +0.007065039 +0.007057159 +0.007055059 +0.00705242 +0.007050728 +0.007050497 +0.00704656 +0.007045835 +0.007043203 +0.007041342 +0.007037169 +0.007037048 +0.007037033 +0.007035322 +0.007035032 +0.007034454 +0.007027992 +0.007010723 +0.007010368 +0.007010002 +0.007004395 +0.007001211 +0.006998716 +0.00699678 +0.00698596 +0.0069813 +0.006970192 +0.006968014 +0.006967873 +0.006956198 +0.006955866 +0.006955643 +0.0069527 +0.006944527 +0.006943811 +0.006936493 +0.006932322 +0.006919962 +0.006917557 +0.006915163 +0.006913467 +0.006912697 +0.006910807 +0.006900354 +0.00689155 +0.006886789 +0.006880814 +0.006871332 +0.006867739 +0.00686223 +0.00686108 +0.00685799 +0.006856377 +0.006854639 +0.006851885 +0.006850521 +0.006846849 +0.00684086 +0.006840626 +0.006832794 +0.006831898 +0.006831432 +0.006830631 +0.006830364 +0.006822613 +0.006813906 +0.006807535 +0.006806032 +0.006804279 +0.006804209 +0.006803143 +0.006797207 +0.006792576 +0.00678742 +0.006786198 +0.006776249 +0.006767094 +0.006765043 +0.006759504 +0.006758421 +0.006748098 +0.006743984 +0.006743649 +0.006740118 +0.006735943 +0.006732008 +0.006731319 +0.006726734 +0.006720741 +0.00671867 +0.006716177 +0.006706623 +0.006698238 +0.006694654 +0.006692337 +0.006690315 +0.006687939 +0.006686069 +0.00668399 +0.006671804 +0.006667908 +0.006664333 +0.006659399 +0.006647436 +0.006647329 +0.006639271 +0.006638327 +0.006633261 +0.006633078 +0.006611351 +0.006607069 +0.006606344 +0.006600904 +0.006597185 +0.006595774 +0.006593163 +0.006589317 +0.006586607 +0.006580635 +0.006576479 +0.006574949 +0.006566893 +0.006566399 +0.006554573 +0.006530695 +0.006525759 +0.006521776 +0.006517738 +0.006501879 +0.006500742 +0.006499847 +0.006492546 +0.006478745 +0.006469521 +0.006459919 +0.006446957 +0.006436213 +0.006430162 +0.006429461 +0.006420221 +0.006410669 +0.006406378 +0.006403811 +0.006396671 +0.006391806 +0.006382936 +0.006363773 +0.006350231 +0.006341734 +0.006335096 +0.006329418 +0.006325489 +0.00632304 +0.006291357 +0.006279036 +0.00625112 +0.006240334 +0.006233267 +0.006232565 +0.006211235 +0.006205635 +0.006204079 +0.006202707 +0.00619545 +0.006194229 +0.006185663 +0.006182297 +0.006178352 +0.006153929 +0.006151711 +0.006140169 +0.006138277 +0.006132753 +0.006055676 +0.006026957 +0.006006159 +0.005980967 +0.005950672 +0.005929432 +0.005926622 +0.005907154 +0.005893517 +0.005889854 +0.005885946 +0.005880421 +0.005874573 +0.005866598 +0.005859877 +0.005851454 +0.005845602 +0.005840521 +0.005823341 +0.005810097 +0.005768602 +0.005765007 +0.005762871 +0.005753492 +0.005752243 +0.005749565 +0.005721613 +0.005683754 +0.005637468 +0.005622242 +0.005615107 +0.005605305 +0.005576214 +0.005545177 +0.005544794 +0.005515455 +0.005495152 +0.005432837 +0.005423744 +0.00542115 +0.005391729 +0.005372042 +0.005344336 +0.00532242 +0.005316675 +0.005290703 +0.005276886 +0.005098354 +0.005076155 +0.004904335 +0.0048818 +0.004871721 +0.004807217 +0.004717197 +0.004528528 +0.004348799 diff --git a/examples/global-lunar-bombardment/cleanup b/examples/global-lunar-bombardment/cleanup new file mode 100755 index 00000000..43b86768 --- /dev/null +++ b/examples/global-lunar-bombardment/cleanup @@ -0,0 +1,33 @@ +#!/bin/bash +rm console/console*.* +rm surf/surf*.* +rm rego/rego*.* +rm shaded/shaded*.* +rm dist/odist*.dat +rm dist/tdist*.dat +rm dist/pdist*.dat +rm dist/ocum*.dat +rm dist/tcum*.dat +rm misc/mass*.dat +rm misc/ctem*.dat +rm presentation/presentation*.jpg +rm surface_*.dat +rm odistribution.dat +rm pdistribution.dat +rm tdistribution.dat +rm tcumulative.dat +rm ocumulative.dat +rm craterscale.dat +rm ctem.dat +rm fracdone.dat +rm production.dat +rm ejecta_table_max.dat +rm ejecta_table_min.dat +rm impactmass.dat +rm frames/* +rm regolithdepth.dat +rm avgkdiff.dat +rm *.o* +rm term.out +rm time.out +rm testprofile.dat diff --git a/examples/global-lunar-bombardment/console/.gitignore b/examples/global-lunar-bombardment/console/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/examples/global-lunar-bombardment/ctem_driver.pro b/examples/global-lunar-bombardment/ctem_driver.pro new file mode 100755 index 00000000..071af0f7 --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_driver.pro @@ -0,0 +1,233 @@ +pro ctem_driver + +;------------------------------------------------------------------------- +; Jim Richardson, Arecibo Observatory +; David Minton, Purdue University Dept. of Earth, Atmospheric, & Planetary Sciences +; July 2014 +; Cratered Terrain Evolution Model display module +; +; Inputs are read in from the ctem.in file +; +;------------------------------------------------------------------------- +;------------- Initial Setup ---------------- +;------------------------------------------------------------------------- +Compile_Opt DEFINT32 +!EXCEPT=2 + +; ----------- input file ----------------------- +infilename = 'ctem.in' +DATFILE='ctem.dat' + +; ---------- reading input files ---------- +seedarr = lon64arr(100) +seedn = 1 +totalimpacts = long64(0) +ncount = long64(0) +curyear = 0.d0 +restart = "F" +fracdone = 1.0d0 +masstot = 0.d0 + +ctem_io_read_input,infilename,interval,numintervals,gridsize,pix,seed,numlayers,sfdfile,impfile,maxcrat,ph1,shadedmaxhdefault,shadedminhdefault,shadedminh,shadedmaxh,restart,runtype,popupconsole,saveshaded,saverego,savepres,savetruelist + +seedarr(0) = seed +area = (gridsize * pix)^2 + +;read input data +pnum = file_lines(impfile) +production = dblarr(2,pnum) +productionfunction = dblarr(2,pnum) +openr,LUN,impfile,/GET_LUN +readf,LUN,productionfunction +free_lun,LUN + +;create impactor production population +production(0,*) = productionfunction(0,*) +production(1,*) = productionfunction(1,*)*area*interval + +;write out corrected production population +openw,1,sfdfile +printf,1,production +close,1 +free_lun,1 + +;set up cratering surface grid and display-only grid +surface_dem = dblarr(gridsize,gridsize) +regolith = dblarr(gridsize,gridsize) + +;set up temporary distribution bins +distl = 1 +pdistl = 1 +odist = dblarr(6,distl) +tdist = dblarr(6,distl) +pdist = dblarr(6,pdistl) +pdisttotal = dblarr(6,pdistl) + +datformat = "(I17,1X,I12,1X,E19.12,1X,A1,1X,F9.6,1X,E19.12)" + + +if strmatch(restart,'F',/fold_case) then begin ; Start with a clean slate + print, 'Starting a new run' + curyear = 0.0d0 + totalimpacts = 0 + masstot = 0.d0 + fracdone = 1.0d0 + + if strmatch(runtype,'statistical',/fold_case) then begin + ncount = 1 + openw,LUN,DATFILE,/GET_LUN + printf,LUN,totalimpacts,ncount,curyear,restart,fracdone,masstot,format=datformat + for n=0,seedn-1 do begin + printf,LUN,seedarr(n),format='(I12)' + endfor + free_lun,LUN + endif else begin + ncount = 0 + endelse + + surface_dem(*,*) = 0.0d0 + regolith(*,*) = 0.0d0 + + file_delete, 'tdistribution.dat',/allow_nonexistent + +endif else begin ; continue an old run + print, 'Continuing a previous run' + + ctem_io_read_old,gridsize,surface_dem,regolith,odist,tdist,pdist,mass + + ;read in constants file + openr,LUN,DATFILE,/GET_LUN + readf,LUN,totalimpacts,ncount,curyear,restart,fracdone,masstot,format=datformat + seedn = 0 + while ~ eof(LUN) do begin + readf,LUN,iseed + seedarr(seedn) = long64(iseed) + seedn=seedn+1 + endwhile + +endelse + +openw,FRACDONEFILE,'fracdone.dat',/GET_LUN +openw,REGODEPTHFILE,'regolithdepth.dat',/GET_LUN + +;------------------------------------------------------------------------- +; ---------- begin loops ---------- +;------------------------------------------------------------------------- +print, 'Beginning loops' + +;define number of loop iterations and begin +;numintervals=ceil(endyear/interval)-ncount +while (ncount le numintervals) do begin + + + ; ---------- creating crater population ---------- + if (ncount gt 0) then begin + + fnum = string(ncount,format='(I6.6)') + if (file_test('misc',/DIRECTORY) eq 0) then begin + file_mkdir,'misc' + endif + ; save a copy of the ctem.dat file + fname = 'misc/ctem_' + fnum + '.dat' + file_copy, 'ctem.dat', fname, /OVERWRITE + + print, ncount, ' Calling FORTRAN routine' + ;call fortran program to create & count craters + spawn, './CTEM',/noshell + + ; ---------- reading FORTRAN output ---------- + print, ncount, ' Reading FORTRAN output' + ctem_io_read_old,gridsize,surface_dem,regolith,odist,tdist,pdist,mass + + ;read in constants file + openr,LUN,DATFILE,/GET_LUN + readf,LUN,totalimpacts,ncount,curyear,restart,fracdone,masstot,format=datformat + seedn = 0 + while ~ eof(LUN) do begin + readf,LUN,iseed + seedarr(seedn) = long64(iseed) + seedn = seedn + 1 + endwhile + free_lun,LUN + + curyear = curyear + fracdone * interval + masstot = masstot + mass + printf,FRACDONEFILE,fracdone,curyear + flush,FRACDONEFILE + + printf,REGODEPTHFILE,curyear,mean(regolith),max(regolith),min(regolith) + flush,REGODEPTHFILE + + ;save a copy of the binned observed crater distribution + if (file_test('dist',/DIRECTORY) eq 0) then begin + file_mkdir,'dist' + endif + fname = 'dist/odist_' + fnum + '.dat' + file_copy, 'odistribution.dat', fname, /OVERWRITE + + ; save a copy of the cumulative observed crater distribution + fname = 'dist/ocum_' + fnum + '.dat' + file_copy, 'ocumulative.dat', fname, /OVERWRITE + + ;save a copy of the binned true distribution + fname = 'dist/tdist_' + fnum + '.dat' + file_copy, 'tdistribution.dat', fname, /OVERWRITE + + ;save a copy of the binned idealized production function + fname = 'dist/pdist_' + fnum + '.dat' + file_copy, 'pdistribution.dat', fname, /OVERWRITE + + ; save a copy of the cumulative true crater distribution if the user requests it + if strmatch(savetruelist,'T',/fold_case) then begin + fname = 'dist/tcum_' + fnum + '.dat' + file_copy, 'tcumulative.dat', fname, /OVERWRITE + endif + + ; save a copy of the impacted mass + fname = 'misc/mass_' + fnum + '.dat' + file_copy, 'impactmass.dat', fname, /OVERWRITE + + + endif + + ; Get the accumulated production function + pdisttotal = pdist + pdisttotal(3:5,*) = pdist(3:5,*) * curyear / interval + + ; ---------- displaying results ---------- + print, ncount, ' Displaying results' + + ctem_image_dem,ncount,gridsize,pix,surface_dem,surface_dem_image + if strmatch(saverego,'T',/fold_case) then ctem_image_regolith,ncount,gridsize,pix,regolith,regolith_image + if strmatch(saveshaded,'T',/fold_case) then begin + if (shadedminhdefault eq 1) then shadedminh = min(surface_dem) + if (shadedmaxhdefault eq 1) then shadedmaxh = max(surface_dem) + ctem_image_shaded_relief,ncount,gridsize,pix,surface_dem,surface_dem,shadedminh,shadedmaxh,'shaded',shaded_image + endif + if strmatch(savepres,'T',/fold_case) then ctem_image_presentation,ncount,gridsize,pix,curyear,odist,pdisttotal,tdist,ph1,surface_dem_image + ctem_window_display,ncount,totalimpacts,gridsize,pix,curyear,masstot,odist,pdisttotal,tdist,ph1,surface_dem,regolith,surface_dem_image,popupconsole + + ncount = ncount + 1 + + ;write out the current data file + if (strmatch(runtype,'statistical',/fold_case)) || (ncount eq 1) then begin + restart = 'F' + curyear = 0.0d0 + totalimpacts = 0 + masstot = 0.d0 + file_delete, 'tdistribution.dat',/allow_nonexistent + endif else begin + restart = 'T' + endelse + + openw,LUN,DATFILE,/GET_LUN + printf,LUN,totalimpacts,ncount,curyear,restart,fracdone,masstot,format=datformat + for n=0,seedn-1 do begin + printf,LUN,seedarr(n),format='(I12)' + endfor + free_lun,LUN +endwhile +free_lun,FRACDONEFILE +free_lun,REGODEPTHFILE + +end diff --git a/examples/global-lunar-bombardment/ctem_driver.py b/examples/global-lunar-bombardment/ctem_driver.py new file mode 100644 index 00000000..4a275160 --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_driver.py @@ -0,0 +1,228 @@ +#!/usr/local/bin/python +# +#Cratered Terrain Evolution Model driver +# +#Original IDL design: Jim Richardson, Arecibo Observatory +#Revised IDL design: David Minton, Purdue University +#Re-engineered design and Python implementation: Matthew Route, Purdue University +#August 2016 + +#Import general purpose modules + +import numpy +import os +import subprocess +import shutil + +#Import CTEM modules +import ctem_io_readers +import ctem_io_writers + +#Create and initialize data dictionaries for parameters and options from CTEM.in +notset = '-NOTSET-' +currentdir = os.getcwd() + os.sep + +parameters={'restart': notset, + 'runtype': notset, + 'popupconsole': notset, + 'saveshaded': notset, + 'saverego': notset, + 'savepres': notset, + 'savetruelist': notset, + 'seedn': 1, + 'totalimpacts': 0, + 'ncount': 0, + 'curyear': 0.0, + 'fracdone': 1.0, + 'masstot': 0.0, + 'interval': 0.0, + 'numintervals': 0, + 'pix': -1.0, + 'gridsize': -1, + 'seed': 0, + 'maxcrat': 1.0, + 'shadedminhdefault': 1, + 'shadedmaxhdefault': 1, + 'shadedminh': 0.0, + 'shadedmaxh': 0.0, + 'workingdir': currentdir, + 'ctemfile': 'ctem.in', + 'datfile': 'ctem.dat', + 'impfile': notset, + 'sfdcompare': notset, + 'sfdfile': notset} + +#Read ctem.in to initialize parameter values based on user input +ctem_io_readers.read_ctemin(parameters,notset) + +#Read sfdcompare file +sfdfile = parameters['workingdir'] + parameters['sfdcompare'] +ph1 = ctem_io_readers.read_formatted_ascii(sfdfile, skip_lines = 0) + +#Set up data arrays +seedarr = numpy.zeros(100, dtype = numpy.int) +seedarr[0] = parameters['seed'] +odist = numpy.zeros([1, 6]) +pdist = numpy.zeros([1, 6]) +tdist = numpy.zeros([1, 6]) +surface_dem = numpy.zeros([parameters['gridsize'], parameters['gridsize']], dtype = numpy.float) +regolith = numpy.zeros([parameters['gridsize'], parameters['gridsize']], dtype =numpy.float) + +#Read production function file +impfile = parameters['workingdir'] + parameters['impfile'] +prodfunction = ctem_io_readers.read_formatted_ascii(impfile, skip_lines = 0) + +#Create impactor production population +area = (parameters['gridsize'] * parameters['pix'])**2 +production = numpy.copy(prodfunction) +production[:,1] = production[:,1] * area * parameters['interval'] + +#Write corrected production function to file +ctem_io_writers.write_production(parameters, production) + +#Starting new or old run? +if (parameters['restart'].upper() == 'F'): + print('Starting a new run') + + if (parameters['runtype'].upper() == 'STATISTICAL'): + parameters['ncount'] = 1 + + #Write ctem.dat file + ctem_io_writers.write_ctemdat(parameters, seedarr) + + else: + parameters['ncount'] = 0 + + #Delete tdistribution file, if it exists + tdist_file = parameters['workingdir'] + 'tdistribution.dat' + if os.path.isfile(tdist_file): + os.remove(tdist_file) + +else: + print('Continuing a previous run') + + #Read surface dem(shaded relief) and ejecta data files + dem_file = parameters['workingdir'] + 'surface_dem.dat' + surface_dem = ctem_io_readers.read_unformatted_binary(dem_file, parameters['gridsize']) + ejecta_file = parameters['workingdir'] + 'surface_ejc.dat' + regolith = ctem_io_readers.read_unformatted_binary(ejecta_file, parameters['gridsize']) + + #Read odistribution, tdistribution, and pdistribution files + ofile = parameters['workingdir'] + 'odistribution.dat' + odist = ctem_io_readers.read_formatted_ascii(ofile, skip_lines = 1) + tfile = parameters['workingdir'] + 'tdistribution.dat' + tdist = ctem_io_readers.read_formatted_ascii(tfile, skip_lines = 1) + pfile = parameters['workingdir'] + 'pdistribution.dat' + pdist = ctem_io_readers.read_formatted_ascii(pfile, skip_lines = 1) + + #Read impact mass from file + massfile = parameters['workingdir'] + 'impactmass.dat' + impact_mass = ctem_io_readers.read_impact_mass(massfile) + + #Read ctem.dat file + ctem_io_readers.read_ctemdat(parameters, seedarr) + +#Open fracdonefile and regodepthfile for writing +filename = parameters['workingdir'] + 'fracdone.dat' +fp_frac = open(filename,'w') +filename = parameters['workingdir'] + 'regolithdepth.dat' +fp_reg = open(filename,'w') + +#Begin CTEM processing loops +print('Beginning loops') + +ctem_io_writers.create_dir_structure(parameters) + +while (parameters['ncount'] <= parameters['numintervals']): + + #Create crater population + if (parameters['ncount'] > 0): + + #Move ctem.dat + forig = parameters['workingdir'] + 'ctem.dat' + fdest = parameters['workingdir'] + 'misc' + os.sep + "ctem%06d.dat" % parameters['ncount'] + shutil.copy2(forig, fdest) + + #Create crater population and display CTEM progress on screen + print(parameters['ncount'], ' Calling FORTRAN routine') + with subprocess.Popen([parameters['workingdir']+'CTEM'], stdout=subprocess.PIPE, bufsize=1,universal_newlines=True) as p: + for line in p.stdout: + print(line, end='') + + + #Optional: do not pipe CTEM progress to the screen + #subprocess.check_output([parameters['workingdir']+'CTEM']) + + #Read Fortran output + print(parameters['ncount'], ' Reading Fortran output') + + #Read surface dem(shaded relief) and ejecta data files + dem_file = parameters['workingdir'] + 'surface_dem.dat' + surface_dem = ctem_io_readers.read_unformatted_binary(dem_file, parameters['gridsize']) + ejecta_file = parameters['workingdir'] + 'surface_ejc.dat' + regolith = ctem_io_readers.read_unformatted_binary(ejecta_file, parameters['gridsize']) + + #Read odistribution, tdistribution, and pdistribution files + ofile = parameters['workingdir'] + 'odistribution.dat' + odist = ctem_io_readers.read_formatted_ascii(ofile, skip_lines = 1) + tfile = parameters['workingdir'] + 'tdistribution.dat' + tdist = ctem_io_readers.read_formatted_ascii(tfile, skip_lines = 1) + pfile = parameters['workingdir'] + 'pdistribution.dat' + pdist = ctem_io_readers.read_formatted_ascii(pfile, skip_lines = 1) + + #Read impact mass from file + massfile = parameters['workingdir'] + 'impactmass.dat' + impact_mass = ctem_io_readers.read_impact_mass(massfile) + + #Read ctem.dat file + ctem_io_readers.read_ctemdat(parameters, seedarr) + + #Update parameters: mass, curyear, regolith properties + parameters['masstot'] = parameters['masstot'] + impact_mass + + parameters['curyear'] = parameters['curyear'] + parameters['fracdone'] * parameters['interval'] + template = "%(fracdone)9.6f %(curyear)19.12E\n" + fp_frac.write(template % parameters) + + reg_text = "%19.12E %19.12E %19.12E %19.12E\n" % (parameters['curyear'], + numpy.mean(regolith), numpy.amax(regolith), numpy.amin(regolith)) + fp_reg.write(reg_text) + + #Save copy of crater distribution files + ctem_io_writers.copy_dists(parameters) + + #Display results + print(parameters['ncount'], ' Displaying results') + + #Write surface dem, surface ejecta, shaded relief, and rplot data + ctem_io_writers.image_dem(parameters, surface_dem) + if (parameters['saverego'].upper() == 'T'): + ctem_io_writers.image_regolith(parameters, regolith) + if (parameters['saveshaded'].upper() == 'T'): + ctem_io_writers.image_shaded_relief(parameters, surface_dem) + if (parameters['savepres'].upper() == 'T'): + ctem_io_writers.create_rplot(parameters,odist,pdist,tdist,ph1) + + #Update ncount + parameters['ncount'] = parameters['ncount'] + 1 + + if ((parameters['runtype'].upper() == 'STATISTICAL') or (parameters['ncount'] == 1)): + parameters['restart'] = 'F' + parameters['curyear'] = 0.0 + parameters['totalimpacts'] = 0 + parameters['masstot'] = 0.0 + + #Delete tdistribution file, if it exists + tdist_file = parameters['workingdir'] + 'tdistribution.dat' + if os.path.isfile(tdist_file): + os.remove(tdist_file) + + else: + parameters['restart'] = 'T' + + #Write ctem.dat file + ctem_io_writers.write_ctemdat(parameters, seedarr) + +#Close updateable fracdonefile and regodepthfile files +fp_frac.close() +fp_reg.close() diff --git a/examples/global-lunar-bombardment/ctem_image_dem.pro b/examples/global-lunar-bombardment/ctem_image_dem.pro new file mode 100755 index 00000000..ad6fbd7e --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_image_dem.pro @@ -0,0 +1,41 @@ +pro ctem_image_dem,ncount,gridsize,pix,surface_dem,surface_dem_image +; Generates the shaded surface DEM image and saves it as a jpeg output image in the 'surf' directory +; outputs surface_dem_arr, which may be scaled to use as a console image + +; This code is for reading in the x-y positions from the cumulative distribution and separating out into layers +; so that the tallied craters can be drawn as circles +;!PATH = Expand_Path('+/home/campus/daminton/coyote/') + ':' + !PATH + +Compile_Opt DEFINT32 +thisDevice = !D.Name +Set_Plot, 'Z' +Erase +Device, Set_Resolution=[gridsize,gridsize],Set_Pixel_Depth=24, Decomposed=0 +TVLCT, red, green, blue, /GET + +sun = 20.d0 +radsun = sun * !dtor + +surface_dem_arr = dblarr(gridsize,gridsize) + +surface_dem_arr=surface_dem-shift(surface_dem,0,1) +surface_dem_arr = (0.5d0*!dpi) + atan(surface_dem_arr,pix) ; Get average slope +surface_dem_arr = abs(surface_dem_arr - radsun < 0.5d0*!dpi) ; incident angle +surface_dem_arr = 254.0d0 * cos(surface_dem_arr) ; shaded relief surface + +tv, surface_dem_arr, 0, 0, xsize=gridsize, ysize=gridsize, /device +print,'plotting' + +surface_dem_image = TVRD(True=1) +Set_Plot, thisDevice + +; save surface display +if (file_test('surf',/DIRECTORY) eq 0) then begin + file_mkdir,'surf' +endif +fnum = string(ncount,format='(I6.6)') +fname = 'surf/surf' + fnum + '.jpg' + +write_jpeg, fname, surface_dem_image, true=1, quality=100 + +end diff --git a/examples/global-lunar-bombardment/ctem_image_presentation.pro b/examples/global-lunar-bombardment/ctem_image_presentation.pro new file mode 100755 index 00000000..05a7d65a --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_image_presentation.pro @@ -0,0 +1,143 @@ +pro ctem_image_presentation,ncount,gridsize,pix,curyear,odist,pdist,tdist,ph1,map +; Generates the simplified version of the console display for use in presentations +; Plots the R-plot on the left and the image map on the right + +; presentation graphics +presresx = 1024 +presresy = 0.6*presresx +area = (gridsize * pix)^2 + +minx = (pix / 3.0d0) * 1d-3 +maxx = 3 * pix * gridsize * 1d-3 + +;strings for display +dum = string(format='(E10.4)', curyear) +parts = strsplit(dum, 'E', /extract) +fcuryear = strcompress(string(format='(F6.4,"x10!U",i,"!N")', parts[0], parts[1])) +time = 'Time = ' +timeunit = ' yr' + +if (file_test('presentation',/DIRECTORY) eq 0) then begin + file_mkdir,'presentation' +endif + +thisDevice = !D.Name +Set_Plot, 'Z' +Erase +Device, Set_Resolution=[presresx,presresy],Set_Pixel_Depth=24, Decomposed=0 +loadct, 0 +TVLCT, red, green, blue, /GET + +;geometric saturation +geom = dblarr(2,2) +geomem = dblarr(2,2) +geomep = dblarr(2,2) +geomel = dblarr(2,2) +geom(0,0) = minx +geom(0,1) = maxx +geom(1,*) = 3.12636d0 +geomem(0,0) = minx +geomem(0,1) = maxx +geomem(1,*) = 0.156318d0 +geomep(0,0) = minx +geomep(0,1) = maxx +geomep(1,*) = 0.312636d0 +geomel(0,0) = minx +geomel(0,1) = maxx +geomel(1,*) = 0.0312636d0 + +; Remove zeros +nz = where(odist(5,*) ne 0.0,count) +if (count gt 0) then begin + odistnz = dblarr(6,count) + odistnz(*,*)= odist(*,nz) +endif else begin + odistnz = odist +endelse + +nz = where(tdist(5,*) ne 0.0,count) +if (count gt 0) then begin + tdistnz = dblarr(6,count) + tdistnz(*,*)= tdist(*,nz) +endif else begin + tdistnz = tdist +endelse + +nz = where(pdist(5,*) ne 0.0,count) +if (count gt 0) then begin + pdistnz = dblarr(6,count) + pdistnz(*,*)= pdist(*,nz) +endif else begin + pdistnz = pdist +endelse + +; create r-plot array containing exactly 1 crater per bin +area = (gridsize * pix * 1d-3)^2 +plo = 1 +while (sqrt(2.0d0)^plo gt minx) do begin + plo = plo - 1 +endwhile +phi = plo + 1 +while (sqrt(2.0d0)^phi lt maxx) do begin + phi = phi + 1 +endwhile +n = phi - plo +sdist = dblarr(6,n + 1) +p = plo +for i=0,n do begin + sdist(0,i) = sqrt(2.d0)^p + sdist(1,i) = sqrt(2.d0)^(p+1) + sdist(2,i) = sqrt(sdist(0,i) * sdist(1,i)) + sdist(3,i) = 1.0d0 + sdist(5,i) = (sdist(2,i))^3 / (area * (sdist(1,i) - sdist(0,i))) + p = p + 1 +endfor +sdist(4,*) = reverse(total(sdist(3,*),/cumulative),2) + + +plot, odistnz(2,*)*1.0d-3, odistnz(5,*), line=0, color=255, thick=2.0, $ + TITLE='Crater Distribution R-Plot', charsize=1.2, $ + XTITLE='Crater Diameter (km)', $ + XRANGE=[minx,maxx], /XLOG, XSTYLE=1, $ + YTITLE='R Value', $ + YRANGE=[5.0e-4,5.0e0], /YLOG, YSTYLE=1, $ + /device, pos = [0.12,0.12,0.495,0.495]*presresx + +Dfac = sqrt(sqrt(2.0d0)) + +;display observed crater distribution +oplot, tdistnz(2,*)*1.0d-3, tdistnz(5,*), line=0, color=255, thick=1.0 +;oplot, geom(0,*), geom(1,*), line=2, color=255, thick=1.0 +oplot, geomem(0,*), geomem(1,*), line=1, color=255, thick=1.0 +oplot, geomep(0,*), geomep(1,*), line=1, color=255, thick=1.0 +;oplot, geomel(0,*), geomel(1,*), line=1, color=255, thick=1.0 +oplot, pdistnz(2,*)*1.0d-3, pdistnz(5,*), line=3, color=255, thick=1.0 +oplot, odistnz(2,*)*1.0d-3, odistnz(5,*), line=1, color=255, thick=1.0 +oplot, sdist(0,*), sdist(5,*), line=1, color=255, thick=1.0 +oplot, ph1(0,*)*Dfac*1.0d-3, ph1(1,*), psym=1, color=255, thick=1.0 +;oplot, ph2(0,*), ph2(1,*), psym=4, color=255, thick=1.0 +;oplot, ph3(0,*), ph3(1,*), psym=5, color=255, thick=1.0 + +;draw box around the main surface display & fill +displaysize = floor(0.45*presresx) ; size of displayed surface +surfxpos = floor(0.520*presresx) +surfypos = floor(0.12*presresy) +xbox = [surfxpos - 1,surfxpos - 1,surfxpos + displaysize,surfxpos + displaysize,surfxpos - 1] +ybox = [surfypos - 1,surfypos + displaysize,surfypos + displaysize,surfypos - 1,surfypos - 1] +plotS, xbox, ybox, /device, color=255 + +mapscaled = congrid(map,3,displaysize,displaysize,/interp) + +;mapscaled=congrid(map,displaysize,displaysize) ; scale image +tv, mapscaled, surfxpos, surfypos, xsize=displaysize, ysize=displaysize, true=1, /device + +xyouts, 0.310*presresx, 0.04*presresy, time + fcuryear + timeunit, color=255, charsize=2*presresy/720., /device + +snapshot = TVRD(True=1) +Set_Plot, thisDevice +fnum = string(ncount,format='(I6.6)') +fname = 'presentation/presentation' + fnum + '.jpg' +Write_JPEG, fname, snapshot, True=1, Quality=90 + + +end diff --git a/examples/global-lunar-bombardment/ctem_image_regolith.pro b/examples/global-lunar-bombardment/ctem_image_regolith.pro new file mode 100755 index 00000000..8d7f07a7 --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_image_regolith.pro @@ -0,0 +1,33 @@ +pro ctem_image_regolith,ncount,gridsize,pix,regolith,regolith_image +; Generates the regolith depth map image and saves it as a jpeg output image in the 'rego' directory +; outputs dregolith, which may be scaled to use as a console image +Compile_Opt DEFINT32 +thisDevice = !D.Name +Set_Plot, 'Z' +Erase +Device, Set_Resolution=[gridsize,gridsize],Set_Pixel_Depth=24, Decomposed=0 +loadct, 39 +TVLCT, red, green, blue, /GET + +minref = pix * 1.0d-4 +regolith_scaled = dblarr(gridsize,gridsize) +maxreg = max(regolith) +minreg = min(regolith) +if minreg lt minref then minreg = minref +if maxreg lt minref then maxreg = minref + 1.0d30 +regolith_scaled = regolith > minreg +regolith_scaled = 254.0d0 * ((alog(regolith_scaled) - alog(minreg)) / (alog(maxreg) - alog(minreg))) + +; save regolith display +tv, regolith_scaled, 0, 0, xsize=gridsize, ysize=gridsize, /device +regolith_image = TVRD(True=1) +Set_Plot, thisDevice + +if (file_test('rego',/DIRECTORY) eq 0) then begin + file_mkdir,'rego' +endif +fnum = string(ncount,format='(I6.6)') +fname = 'rego/rego' + fnum + '.jpg' +write_jpeg, fname, regolith_image, true=1, quality=100 + +end diff --git a/examples/global-lunar-bombardment/ctem_image_shaded_relief.pro b/examples/global-lunar-bombardment/ctem_image_shaded_relief.pro new file mode 100755 index 00000000..73986f84 --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_image_shaded_relief.pro @@ -0,0 +1,52 @@ +pro ctem_image_shaded_relief,ncount,gridsize,pix,surface_dem,height_vals,minh,maxh,dirname,shaded_image +; Generates the shaded depth map image and saves it as a jpeg output image in the 'rego' directory +; outputs dshaded, which may be scaled to use as a console image +; Uses the array height_vals for the color +Compile_Opt DEFINT32 +thisDevice = !D.Name +Set_Plot, 'Z' +Erase +Device, Set_Resolution=[gridsize,gridsize],Set_Pixel_Depth=24, Decomposed=0 +loadct, 33 +TVLCT, red, green, blue, /GET + +light=[[1,1,1],[0,0,0],[-1,-1,-1]] + +; convolution of the dem with the 3x3 matrix + +shaded=bytscl(convol(float(surface_dem),float(light))) +if max(shaded) eq 0 then shaded=255 + +; scale the dem to the height +if (minh gt maxh) then begin + tmp = minh + minh = maxh + maxh = tmp +endif + +demscaled = ((height_vals - minh) > 0.0) < (maxh-minh) +if ((maxh - minh) eq 0.0) then begin + demscaled = demscaled * 0.0 +endif else begin + demscaled = demscaled/(maxh-minh)*255.0 +endelse + +tv, demscaled, 0, 0, xsize=gridsize, ysize=gridsize, /device +shaded_image = TVRD(True=1) +shadedscl =float(shaded)/255.0 +shaded_imagearr = dblarr(3,gridsize,gridsize) +shaded_imagearr(0,*,*) = float(shaded_image(0,*,*)) * shadedscl(*,*) +shaded_imagearr(1,*,*) = float(shaded_image(1,*,*)) * shadedscl(*,*) +shaded_imagearr(2,*,*) = float(shaded_image(2,*,*)) * shadedscl(*,*) +shaded_image=round(shaded_imagearr) +Set_Plot, thisDevice + +if (file_test(dirname,/DIRECTORY) eq 0) then begin + file_mkdir,dirname +endif + +fnum = string(ncount,format='(I6.6)') +fname = dirname + '/' + dirname + fnum + '.jpg' +write_jpeg,fname,shaded_image,true=1,quality=90 + +end diff --git a/examples/global-lunar-bombardment/ctem_io_read_input.pro b/examples/global-lunar-bombardment/ctem_io_read_input.pro new file mode 100755 index 00000000..ea135668 --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_io_read_input.pro @@ -0,0 +1,131 @@ +pro ctem_io_read_input,infilename,interval,numintervals,gridsize,pix,seed,numlayers,sfdfile,impfile,maxcrat,ph1,shadedmaxhdefault,shadedminhdefault,shadedminh,shadedmaxh,restart,runtype,popupconsole,saveshaded,saverego,savepres,savetruelist +Compile_Opt DEFINT32 +print, 'Reading input file' +openr,infile,infilename, /GET_LUN +line="" +comment="!" +interval = 0.d0 +numintervals = 0 +pix=-1.0d0 +gridsize=-1 +seed = 0 +maxcrat = 1.0d0 +shadedmaxhdefault = 1 +shadedminhdefault = 1 +shadedminh = 0.d0 +shademaxnh = 0.d0 + + +; Set required strings to unset value +notset="-----NOTSET----" +sfdfile = notset +impfile = notset +sfdcompare = notset +restart = notset +runtype = notset +popupconsole = notset +saveshaded = notset +saverego = notset +savepres = notset +savetruelist = notset +while (not EOF(infile)) do begin + readf,infile,line + if (~strcmp(line,comment,1)) then begin + substrings = strsplit(line,' ',/extract) + if strmatch(substrings(0),'pix',/fold_case) then reads,substrings(1),pix + if strmatch(substrings(0),'gridsize',/fold_case) then reads,substrings(1),gridsize + if strmatch(substrings(0),'seed',/fold_case) then reads,substrings(1),seed + if strmatch(substrings(0),'sfdfile',/fold_case) then reads,substrings(1),sfdfile + if strmatch(substrings(0),'impfile',/fold_case) then reads,substrings(1),impfile + if strmatch(substrings(0),'maxcrat',/fold_case) then reads,substrings(1),maxcrat + if strmatch(substrings(0),'sfdcompare',/fold_case) then reads,substrings(1),sfdcompare + if strmatch(substrings(0),'interval',/fold_case) then reads,substrings(1),interval + if strmatch(substrings(0),'numintervals',/fold_case) then reads,substrings(1),numintervals + if strmatch(substrings(0),'popupconsole',/fold_case) then reads,substrings(1),popupconsole + if strmatch(substrings(0),'saveshaded',/fold_case) then reads,substrings(1),saveshaded + if strmatch(substrings(0),'saverego',/fold_case) then reads,substrings(1),saverego + if strmatch(substrings(0),'savepres',/fold_case) then reads,substrings(1),savepres + if strmatch(substrings(0),'savetruelist',/fold_case) then reads,substrings(1),savetruelist + if strmatch(substrings(0),'runtype',/fold_case) then reads,substrings(1),runtype + if strmatch(substrings(0),'restart',/fold_case) then reads,substrings(1),restart + if strmatch(substrings(0),'shadedminh',/fold_case) then begin + reads,substrings(1),shadedminh + shadedminhdefault = 0 + endif + if strmatch(substrings(0),'shadedmaxh',/fold_case) then begin + reads,substrings(1),shadedmaxh + shadedmaxhdefault = 0 + endif + end +end +if interval le 0.0d0 then begin + print,'Invalid value for or missing variable INTERVAL in ' + infilename + stop +end +if numintervals le 0 then begin + print,'Invalid value for or missing variable NUMINTERVALS in ' + infilename + stop +end +if pix le 0.0d0 then begin + print,'Invalid value for or missing variable PIX in ' + infilename + stop +end +if gridsize le 0 then begin + print,'Invalid value for or missing variable GRIDSIZE in ' + infilename + stop +end +if seed eq 0 then begin + print,'Invalid value for or missing variable SEED in ' + infilename + stop +end +if strmatch(sfdfile,notset) then begin + print,'Invalid value for or missing variable SFDFILE in ' + infilename + stop +end +if strmatch(impfile,notset) then begin + print,'Invalid value for or missing variable IMPFILE in ' + infilename + stop +end +if strmatch(popupconsole,notset) then begin + print,'Invalid value for or missing variable POPUPCONSOLE in ' + infilename + stop +end +if strmatch(saveshaded,notset) then begin + print,'Invalid value for or missing variable SAVESHADED in ' + infilename + stop +end +if strmatch(saverego,notset) then begin + print,'Invalid value for or missing variable SAVEREGO in ' + infilename + stop +end +if strmatch(savepres,notset) then begin + print,'Invalid value for or missing variable SAVEPRES in ' + infilename + stop +end +if strmatch(savetruelist,notset) then begin + print,'Invalid value for or missing variable SAVETRUELIST in ' + infilename + stop +end +if strmatch(runtype,notset) then begin + print,'Invalid value for or missing variable RUNTYPE in ' + infilename + stop +end +if strmatch(restart,notset) then begin + print,'Invalid value for or missing variable RESTART in ' + infilename + stop +end + +free_lun,infile + +ph1 = dblarr(3,1) +if ~strmatch(sfdcompare,notset) then begin + cnum = file_lines(sfdcompare) + ph1 = dblarr(3,cnum) + openr,COMP,sfdcompare,/GET_LUN + readf,COMP,ph1 + close,COMP + free_lun,COMP +end +free_lun,infile + +end diff --git a/examples/global-lunar-bombardment/ctem_io_read_old.pro b/examples/global-lunar-bombardment/ctem_io_read_old.pro new file mode 100755 index 00000000..a9013687 --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_io_read_old.pro @@ -0,0 +1,45 @@ +pro ctem_io_read_old,gridsize,surface_dem,regolith,odist,tdist,pdist,mass +Compile_Opt DEFINT32 +openr,LUN,'surface_ejc.dat',/GET_LUN +readu,LUN,regolith +free_lun,LUN + +openr,LUN,'surface_dem.dat',/GET_LUN +readu,LUN,surface_dem +free_lun,LUN + +distl = file_lines('odistribution.dat') - 1 +pdistl = file_lines('pdistribution.dat') - 1 + +;read in observed cumulative distribution +odist = dblarr(6,distl) +line = "temp" +openr,LUN,'odistribution.dat',/GET_LUN +readf,LUN,line +readf,LUN,odist +close,LUN +free_lun,LUN + +;read in true cumulative distribution +tdist = dblarr(6,distl) +openr,LUN,'tdistribution.dat',/GET_LUN +readf,LUN,line +readf,LUN,tdist +close,LUN +free_lun,LUN + +;read in production function +pdist = dblarr(6,pdistl) +openr,LUN,'pdistribution.dat',/GET_LUN +readf,LUN,line +readf,LUN,pdist +close,LUN +free_lun,LUN + +;read in accumulated mass from file +openr,LUN,'impactmass.dat',/GET_LUN +readf,LUN,mass +close,LUN +free_lun,LUN + +end diff --git a/examples/global-lunar-bombardment/ctem_io_readers.py b/examples/global-lunar-bombardment/ctem_io_readers.py new file mode 100644 index 00000000..a58ba9ab --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_io_readers.py @@ -0,0 +1,144 @@ +#!/usr/local/bin/python +# +#Cratered Terrain Evolution Model file reading utilities +# +#Original IDL design: Jim Richardson, Arecibo Observatory +#Revised IDL design: David Minton, Purdue University +#Re-engineered design and Python implementation: Matthew Route, Purdue University +#August 2016 +# +#Known issues for operation with CTEM +#1) ctem.in has 1.0d0 value for maxcrat which is not readable by Python + +import numpy + +def read_ctemin(parameters,notset): + #Read and parse ctem.in file + inputfile = parameters['workingdir'] + parameters['ctemfile'] + + #Read ctem.in file + print('Reading input file '+ parameters['ctemfile']) + fp = open(inputfile,'r') + lines = fp.readlines() + fp.close() + + #Process file text + for line in lines: + fields = line.split() + if len(fields) > 0: + if ('pix' == fields[0].lower()): parameters['pix']=float(fields[1]) + if ('gridsize' == fields[0].lower()): parameters['gridsize']=int(fields[1]) + if ('seed' == fields[0].lower()): parameters['seed']=int(fields[1]) + if ('sfdfile' == fields[0].lower()): parameters['sfdfile']=fields[1] + if ('impfile' == fields[0].lower()): parameters['impfile']=fields[1] + if ('maxcrat' == fields[0].lower()): parameters['maxcrat']=float(fields[1]) + if ('sfdcompare' == fields[0].lower()): parameters['sfdcompare']=fields[1] + if ('interval' == fields[0].lower()): parameters['interval']=float(fields[1]) + if ('numintervals' == fields[0].lower()): parameters['numintervals']=int(fields[1]) + if ('popupconsole' == fields[0].lower()): parameters['popupconsole']=fields[1] + if ('saveshaded' == fields[0].lower()): parameters['saveshaded']=fields[1] + if ('saverego' == fields[0].lower()): parameters['saverego']=fields[1] + if ('savepres' == fields[0].lower()): parameters['savepres']=fields[1] + if ('savetruelist' == fields[0].lower()): parameters['savetruelist']=fields[1] + if ('runtype' == fields[0].lower()): parameters['runtype']=fields[1] + if ('restart' == fields[0].lower()): parameters['restart']=fields[1] + if ('shadedminh' == fields[0].lower()): + parameters['shadedminh'] = float(fields[1]) + parameters['shadedminhdefault'] = 0 + if ('shadedmaxh' == fields[0].lower()): + parameters['shadedmaxh'] = float(fields[1]) + parameters['shadedmaxhdefault'] = 0 + + #Test values for further processing + if (parameters['interval'] <= 0.0): + print('Invalid value for or missing variable INTERVAL in '+ inputfile) + if (parameters['numintervals'] <= 0): + print('Invalid value for or missing variable NUMINTERVALS in '+ inputfile) + if (parameters['pix'] <= 0.0): + print('Invalid value for or missing variable PIX in '+ inputfile) + if (parameters['gridsize'] <= 0): + print('Invalid value for or missing variable GRIDSIZE in '+ inputfile) + if (parameters['seed'] == 0): + print('Invalid value for or missing variable SEED in '+ inputfile) + if (parameters['sfdfile'] == notset): + print('Invalid value for or missing variable SFDFILE in '+ inputfile) + if (parameters['impfile'] == notset): + print('Invalid value for or missing variable IMPFILE in '+ inputfile) + if (parameters['popupconsole'] == notset): + print('Invalid value for or missing variable POPUPCONSOLE in '+ inputfile) + if (parameters['saveshaded'] == notset): + print('Invalid value for or missing variable SAVESHADED in '+ inputfile) + if (parameters['saverego'] == notset): + print('Invalid value for or missing variable SAVEREGO in '+ inputfile) + if (parameters['savepres'] == notset): + print('Invalid value for or missing variable SAVEPRES in '+ inputfile) + if (parameters['savetruelist'] == notset): + print('Invalid value for or missing variable SAVETRUELIST in '+ inputfile) + if (parameters['runtype'] == notset): + print('Invalid value for or missing variable RUNTYPE in '+ inputfile) + if (parameters['restart'] == notset): + print('Invalid value for or missing variable RESTART in '+ inputfile) + + return + +def read_formatted_ascii(filename, skip_lines): + #Generalized ascii text reader + #For use with sfdcompare, production, odist, tdist, pdist data files + data = numpy.genfromtxt(filename, skip_header = skip_lines) + return data + +def read_unformatted_binary(filename, gridsize): + #Read unformatted binary files created by Fortran + #For use with surface ejecta and surface dem data files + dt = numpy.float + data = numpy.fromfile(filename, dtype = dt) + data.shape = (gridsize,gridsize) + + return data + +def read_ctemdat(parameters, seedarr): + #Read and parse ctem.dat file + datfile = parameters['workingdir'] + 'ctem.dat' + + #Read ctem.dat file + print('Reading input file '+ parameters['datfile']) + fp = open(datfile,'r') + lines = fp.readlines() + fp.close() + + #Parse file lines and update parameter fields + fields = lines[0].split() + if len(fields) > 0: + parameters['totalimpacts'] = float(fields[0]) + parameters['ncount'] = int(fields[1]) + parameters['curyear'] = float(fields[2]) + parameters['restart'] = fields[3] + parameters['fracdone'] = float(fields[4]) + parameters['masstot'] = float(fields[5]) + + #Parse remainder of file to build seed array + nlines = len(lines) + index = 1 + while (index < nlines): + fields = lines[index].split() + seedarr[index - 1] = float(fields[0]) + index += 1 + + parameters['seedn'] = index - 1 + + return + +def read_impact_mass(filename): + #Read impact mass file + + fp=open(filename,'r') + line=fp.readlines() + fp.close() + + fields = line[0].split() + if (len(fields) > 0): + mass = float(fields[0]) + else: + mass = 0 + + return mass \ No newline at end of file diff --git a/examples/global-lunar-bombardment/ctem_io_writers.py b/examples/global-lunar-bombardment/ctem_io_writers.py new file mode 100644 index 00000000..5d591d9a --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_io_writers.py @@ -0,0 +1,274 @@ +#!/usr/local/bin/python +# +#Cratered Terrain Evolution Model file and graphical writing utilities +# +#Original IDL design: Jim Richardson, Arecibo Observatory +#Revised IDL design: David Minton, Purdue University +#Re-engineered design and Python implementation: Matthew Route, Purdue University +#August 2016 +# + +import matplotlib +from matplotlib import pyplot +import numpy +import os +import shutil +import scipy +from scipy import signal + +#Set pixel scaling common for image writing, at 1 pixel/ array element +dpi = 72.0 + +#Write production function to file production.dat +#This file format does not exactly match that generated from IDL. Does it work? +def write_production(parameters, production): + filename = parameters['workingdir'] + parameters['sfdfile'] + numpy.savetxt(filename, production, fmt='%1.8e', delimiter=' ') + + return + +def create_dir_structure(parameters): + #Create directories for various output files if they do not already exist + directories=['dist','misc','rego','rplot','surf','shaded'] + + for directory in directories: + dir_test = parameters['workingdir'] + directory + if not os.path.isdir(dir_test): + os.makedirs(dir_test) + + return + +def write_ctemdat(parameters, seedarr): + #Write various parameters and random number seeds into ctem.dat file + filename = parameters['workingdir'] + parameters['datfile'] + fp = open(filename,'w') + + template = "%(totalimpacts)17d %(ncount)12d %(curyear)19.12E %(restart)s %(fracdone)9.6f %(masstot)19.12E\n" + fp.write(template % parameters) + + #Write random number seeds to the file + for index in range(parameters['seedn']): + fp.write("%12d\n" % seedarr[index]) + + fp.close() + + return + +def copy_dists(parameters): + #Save copies of distribution files + + orig_list = ['odistribution', 'ocumulative', 'pdistribution', 'tdistribution'] + dest_list = ['odist', 'ocum', 'pdist', 'tdist'] + + for index in range(len(orig_list)): + forig = parameters['workingdir'] + orig_list[index] + '.dat' + fdest = parameters['workingdir'] + 'dist' + os.sep + dest_list[index] + "_%06d.dat" % parameters['ncount'] + shutil.copy2(forig, fdest) + + forig = parameters['workingdir'] + 'impactmass.dat' + fdest = parameters['workingdir'] + 'misc' + os.sep + "mass_%06d.dat" % parameters['ncount'] + shutil.copy2(forig, fdest) + + if (parameters['savetruelist'].upper() == 'T'): + forig = parameters['workingdir'] + 'tcumulative.dat' + fdest = parameters['workingdir'] + 'dist' + os.sep + "tcum_%06d.dat" % parameters['ncount'] + shutil.copy2(forig, fdest) + + return + +#Possible references +#http://nbviewer.jupyter.org/github/ThomasLecocq/geophysique.be/blob/master/2014-02-25%20Shaded%20Relief%20Map%20in%20Python.ipynb + +def image_dem(parameters, surface_dem): + + #Create surface dem map + solar_angle = 20.0 + dem_map = numpy.copy(surface_dem) - numpy.roll(surface_dem, 1, 0) + dem_map = (0.5 * numpy.pi) + numpy.arctan2(dem_map, parameters['pix']) + dem_map = dem_map - numpy.radians(solar_angle) * (0.5 * numpy.pi) + numpy.place(dem_map, dem_map > (0.5 * numpy.pi), 0.5 *numpy.pi) + dem_map = numpy.absolute(dem_map) + dem_map = 254.0 * numpy.cos(dem_map) + + #Save image to file + filename = parameters['workingdir'] + 'surf' + os.sep + "surf%06d.png" % parameters['ncount'] + height = parameters['gridsize'] / dpi + width = height + fig = matplotlib.pyplot.figure(figsize = (width, height), dpi = dpi) + fig.figimage(dem_map, cmap = matplotlib.cm.gray, origin = 'lower') + matplotlib.pyplot.savefig(filename) + + return + +def image_regolith(parameters, regolith): + + #Create scaled regolith image + minref = parameters['pix'] * 1.0e-4 + maxreg = numpy.amax(regolith) + minreg = numpy.amin(regolith) + if (minreg < minref): minreg = minref + if (maxreg < minref): maxreg = (minref + 1.0e3) + regolith_scaled = numpy.copy(regolith) + numpy.place(regolith_scaled, regolith_scaled < minref, minref) + regolith_scaled = 254.0 * ((numpy.log(regolith_scaled) - numpy.log(minreg)) / (numpy.log(maxreg) - numpy.log(minreg))) + + #Save image to file + filename = parameters['workingdir'] + 'rego' + os.sep + "rego%06d.png" % parameters['ncount'] + height = parameters['gridsize'] / dpi + width = height + fig = matplotlib.pyplot.figure(figsize = (width, height), dpi = dpi) + fig.figimage(regolith_scaled, cmap = matplotlib.cm.nipy_spectral, origin = 'lower') + matplotlib.pyplot.savefig(filename) + + return + +def image_shaded_relief(parameters, surface_dem): + #The color scale and appearance of this do not quite match the IDL version + + #Create image by convolving DEM with 3x3 illumination matrix + light = numpy.array([[1.0, 1.0, 1.0], [0.0, 0.0, 0.0], [-1.0, -1.0, -1.0]]) + convolved_map = scipy.signal.convolve2d(surface_dem, light, mode = 'same') + + #Adjust output to resemble IDL (north slopes illuminated, south in shadow) + convolved_map = convolved_map * -1.0 + convolved_map[0,:]=0.0 + convolved_map[-1,:] =0.0 + convolved_map[:,0]=0.0 + convolved_map[:,-1]=0.0 + + #If no shadedmin/max parameters are read in from ctem.dat, determine the values from the data + if (parameters['shadedminhdefault'] == 1): shadedminh = numpy.amin(surface_dem) + if (parameters['shadedmaxhdefault'] == 1): shadedmaxh = numpy.amax(surface_dem) + + #If min and max appear to be reversed, then fix them + if (parameters['shadedminh'] > parameters['shadedmaxh']): + temp = parameters['shadedminh'] + shadedminh = parameters['shadedmaxh'] + shadedmaxh = temp + else: + shadedminh = parameters['shadedminh'] + shadedmaxh = parameters['shadedmaxh'] + + #If dynamic range is valid, construct a shaded DEM + dynamic_range = shadedmaxh - shadedminh + if (dynamic_range != 0): + dem_scaled = numpy.copy(surface_dem) - shadedminh + numpy.place(dem_scaled, dem_scaled < 0.0, 0.0) + numpy.place(dem_scaled, dem_scaled > dynamic_range, dynamic_range) + dem_scaled = dem_scaled / dynamic_range + else: + dem_scaled = numpy.copy(surface_dem) * 0.0 + + #Generate shaded depth map with surface_dem color scaling (RGBA) + shaded = scipy.misc.bytescale(convolved_map) + if numpy.amax(shaded) == 0: shaded=255 + shadedscl = shaded / 255.0 + + #shaded_imagearr = matplotlib.cm.jet(dem_scaled) + #print dem_scaled[0:4,0:4] + #shaded_imagearr[:,:,0] = shaded_imagearr[:,:,0] * shadedscl + #shaded_imagearr[:,:,1] = shaded_imagearr[:,:,1] * shadedscl + #shaded_imagearr[:,:,2] = shaded_imagearr[:,:,2] * shadedscl + #shaded_imagearr[:,:,3] = shaded_imagearr[:,:,3] * shadedscl + + #Delivers nearly proper coloring, but no shaded relief + shaded_imagearr = dem_scaled * shadedscl + shaded_imagearr = matplotlib.cm.jet(shaded_imagearr) + shaded_imagearr = numpy.around(shaded_imagearr, decimals = 1) + + #Save image to file + filename = parameters['workingdir'] + 'shaded' + os.sep + "shaded%06d.png" % parameters['ncount'] + height = parameters['gridsize'] / dpi + width = height + fig = matplotlib.pyplot.figure(figsize = (width, height), dpi = dpi) + fig.figimage(shaded_imagearr, cmap = matplotlib.cm.jet, origin = 'lower') + matplotlib.pyplot.savefig(filename) + return + +def create_rplot(parameters,odist,pdist,tdist,ph1): + #Parameters: empirical saturation limit and dfrac + satlimit = 3.12636 + dfrac = 2**(1./4) * 1.0e-3 + + #Calculate geometric saturation + minx = (parameters['pix'] / 3.0) * 1.0e-3 + maxx = 3 * parameters['pix'] * parameters['gridsize'] * 1.0e-3 + geomem = numpy.array([[minx, satlimit / 20.0], [maxx, satlimit / 20.0]]) + geomep = numpy.array([[minx, satlimit / 10.0], [maxx, satlimit / 10.0]]) + + #Create distribution arrays without zeros for plotting on log scale + idx = numpy.nonzero(odist[:,5]) + odistnz = odist[idx] + odistnz = odistnz[:,[2,5]] + + idx = numpy.nonzero(pdist[:,5]) + pdistnz = pdist[idx] + pdistnz = pdistnz[:,[2,5]] + + idx = numpy.nonzero(tdist[:,5]) + tdistnz = tdist[idx] + tdistnz = tdistnz[:,[2,5]] + + #Correct pdist + pdistnz[:,1] = pdistnz[:,1] * parameters['curyear'] / parameters['interval'] + + #Create sdist bin factors, which contain one crater per bin + area = (parameters['gridsize'] * parameters['pix'] * 1.0e-3)**2. + plo = 1 + sq2 = 2**(1./2) + while (sq2**plo > minx): + plo = plo - 1 + phi = plo + 1 + while (sq2**phi < maxx): + phi = phi + 1 + n = phi - plo + 1 + sdist = numpy.zeros([n , 2]) + p = plo + for index in range(n): + sdist[index, 0] = sq2**p + sdist[index, 1] = sq2**(2.0*p + 1.5) / (area * (sq2 - 1)) + p = p + 1 + + #Create time label + tlabel = "%5.4e" % parameters['curyear'] + tlabel = tlabel.split('e') + texp = str(int(tlabel[1])) + timelabel = 'Time = '+ r'${}$ x 10$^{}$'.format(tlabel[0], texp) + ' yrs' + + #Save image to file + filename = parameters['workingdir'] + 'rplot' + os.sep + "rplot%06d.png" % parameters['ncount'] + height = parameters['gridsize'] / dpi + width = height + fig = matplotlib.pyplot.figure(figsize = (width, height), dpi = dpi) + + #Alter background color to be black, and change axis colors accordingly + matplotlib.pyplot.style.use('dark_background') + matplotlib.pyplot.rcParams['axes.prop_cycle'] + + #Plot data + matplotlib.pyplot.plot(odistnz[:,0]*1.0e-3, odistnz[:,1], linewidth=3.0, color = 'blue') + matplotlib.pyplot.plot(pdistnz[:,0]*1.0e-3, pdistnz[:,1], linewidth=2.0, linestyle='dashdot', color = 'white') + matplotlib.pyplot.plot(tdistnz[:,0]*1.0e-3, tdistnz[:,1], linewidth=2.0, color = 'red') + + matplotlib.pyplot.plot(geomem[:,0], geomem[:,1], linewidth=2.0, linestyle =':', color = 'yellow') + matplotlib.pyplot.plot(geomep[:,0], geomep[:,1], linewidth=2.0, linestyle =':', color = 'yellow') + matplotlib.pyplot.plot(sdist[:,0], sdist[:,1], linewidth=2.0, linestyle =':', color = 'yellow') + + matplotlib.pyplot.plot(ph1[:,0] * dfrac, ph1[:,1], 'wo') + + #Create plot labels + matplotlib.pyplot.title('Crater Distribution R-Plot',fontsize=22) + matplotlib.pyplot.xlim([minx, maxx]) + matplotlib.pyplot.xscale('log') + matplotlib.pyplot.xlabel('Crater Diameter (km)',fontsize=18) + matplotlib.pyplot.ylim([5.0e-4, 5.0]) + matplotlib.pyplot.yscale('log') + matplotlib.pyplot.ylabel('R Value', fontsize=18) + matplotlib.pyplot.text(1.0e-2, 1.0, timelabel, fontsize=18) + + matplotlib.pyplot.tick_params(axis='both', which='major', labelsize=14) + matplotlib.pyplot.tick_params(axis='both', which='minor', labelsize=12) + + matplotlib.pyplot.savefig(filename) + + return \ No newline at end of file diff --git a/examples/global-lunar-bombardment/ctem_window_display.pro b/examples/global-lunar-bombardment/ctem_window_display.pro new file mode 100755 index 00000000..d6edf5b9 --- /dev/null +++ b/examples/global-lunar-bombardment/ctem_window_display.pro @@ -0,0 +1,249 @@ +pro ctem_window_display,ncount,totalimpacts,gridsize,pix,curyear,masstot,odist,pdist,tdist,ph1,surface_dem,regolith,map,popupconsole +; Produces the console window display. The array 'map' is used to generate the image on the right-hand side +Compile_Opt DEFINT32 + +; console output graphics resolution +minref = pix * 1.0d-4 +conresx = 1280 +;conresy = 0.758*conresx +profsize = 0.00 +conresy = (0.60 + profsize) * conresx +sun = 20.d0 ; sun angle for display + +minx = (pix / 3.0d0) * 1d-3 +maxx = 3 * pix * gridsize * 1d-3 +charfac = 1.6 ; character size multiplier + +if strmatch(popupconsole,'T',/fold_case) then begin + device, decomposed=0, retain=2 + thisDevice = !D.NAME + SET_PLOT, 'Z' + TVLCT, red, green, blue, /GET + SET_PLOT, thisDevice + !P.MULTI = [0, 1, 2] + Window, 0, xsize=conresx, ysize=conresy +endif else begin + SET_PLOT, 'Z', /COPY + device, set_resolution=[conresx,conresy],decomposed=0, Z_Buffer=0 + TVLCT, red, green, blue, /GET + !P.MULTI = [0, 1, 2] + erase +endelse + +;set up first color scale +loadct, 0 + +;strings for display +time = 'Time = ' +timeunit = ' yr' +timp = 'Total impacts (dotdash) = ' +tcrt = 'Total craters (line) = ' +ocrt = 'Countable craters (bold) = ' +epwr = 'Mean regolith depth = ' +mtot = 'Impacted mass = ' +c1lab = 'Min. Elevation' +c2lab = 'Mean Elevation' +c3lab = 'Max. Elevation' + +maxelev = max(surface_dem) +minelev = min(surface_dem) +medelev = mean(surface_dem) +c1 = string(minelev, format = '(F9.1)') + ' m' +c2 = string(medelev, format = '(F9.1)') + ' m' +c3 = string(maxelev, format = '(F9.1)') + ' m' +tslp = mean(regolith) + +;geometric saturation +geom = dblarr(2,2) +geomem = dblarr(2,2) +geomep = dblarr(2,2) +geomel = dblarr(2,2) +geom(0,0) = minx +geom(0,1) = maxx +geom(1,*) = 3.12636d0 +geomem(0,0) = minx +geomem(0,1) = maxx +geomem(1,*) = 0.156318d0 +geomep(0,0) = minx +geomep(0,1) = maxx +geomep(1,*) = 0.312636d0 +geomel(0,0) = minx +geomel(0,1) = maxx +geomel(1,*) = 0.0312636d0 + +; Remove zeros +nz = where(odist(5,*) ne 0.0,count) +if (count gt 0) then begin + odistnz = dblarr(6,count) + odistnz(*,*)= odist(*,nz) +endif else begin + odistnz = odist +endelse + +nz = where(tdist(5,*) ne 0.0,count) +if (count gt 0) then begin + tdistnz = dblarr(6,count) + tdistnz(*,*)= tdist(*,nz) +endif else begin + tdistnz = tdist +endelse + +nz = where(pdist(5,*) ne 0.0,count) +if (count gt 0) then begin + pdistnz = dblarr(6,count) + pdistnz(*,*)= pdist(*,nz) + +endif else begin + pdistnz = pdist +endelse + +; create r-plot array containing exactly 1 crater per bin +area = (gridsize * pix * 1d-3)^2 +plo = 1 +while (sqrt(2.0d0)^plo gt minx) do begin + plo = plo - 1 +endwhile +phi = plo + 1 +while (sqrt(2.0d0)^phi lt maxx) do begin + phi = phi + 1 +endwhile +n = phi - plo +sdist = dblarr(6,n + 1) +p = plo +for i=0,n do begin + sdist(0,i) = sqrt(2.d0)^p + sdist(1,i) = sqrt(2.d0)^(p+1) + sdist(2,i) = sqrt(sdist(0,i) * sdist(1,i)) + sdist(3,i) = 1.0d0 + sdist(5,i) = (sdist(2,i))^3 / (area * (sdist(1,i) - sdist(0,i))) + p = p + 1 +endfor +sdist(4,*) = reverse(total(sdist(3,*),/cumulative),2) + +plot, odistnz(2,*)*1.0d-3, odistnz(5,*), line=0, color=255, thick=2.0, $ + TITLE='Crater Distribution R-Plot', charsize=charfac*conresy/720, $ + XTITLE='Crater Diameter (km)', $ + XRANGE=[minx,maxx], /XLOG, XSTYLE=1, $ + YTITLE='R Value', $ + YRANGE=[5.0e-4,5.0e0], /YLOG, YSTYLE=1, $ + /device, pos = [0.085*conresx,(0.25 + profsize)*conresy,0.44*conresx,0.85*conresy] + +Dfac = sqrt(sqrt(2.0d0)) + +;display observed crater distribution +oplot, tdistnz(2,*)*1.0d-3, tdistnz(5,*), line=0, color=255, thick=1.0 +oplot, geom(0,*), geom(1,*), line=2, color=255, thick=1.0 +oplot, geomem(0,*), geomem(1,*), line=1, color=255, thick=1.0 +oplot, geomep(0,*), geomep(1,*), line=1, color=255, thick=1.0 +oplot, geomel(0,*), geomel(1,*), line=1, color=255, thick=1.0 +oplot, pdistnz(2,*)*1.0d-3, pdistnz(5,*), line=3, color=255, thick=1.0 +oplot, odistnz(2,*)*1.0d-3, odistnz(5,*), line=1, color=255, thick=1.0 +oplot, sdist(0,*), sdist(5,*), line=1, color=255, thick=1.0 +oplot, ph1(0,*)*Dfac*1.0d-3, ph1(1,*), psym=1, color=255, thick=1.0 +;oplot, ph2(0,*), ph2(1,*), psym=4, color=255, thick=1.0 +;oplot, ph3(0,*), ph3(1,*), psym=5, color=255, thick=1.0 + +; set up profile display +surfpos = dblarr(gridsize) +surfpro = dblarr(gridsize) +surfhpro = dblarr(gridsize) +surfrpro = dblarr(gridsize) +for k = 0,gridsize-1 do begin + surfpos(k) = (-0.5d0*(gridsize-1) + double(k)) * pix +endfor +surfpro(*) = surface_dem(*,gridsize/2-1) +surfhpro(*) = regolith(*,gridsize/2-1) +surfrpro(*) = surfpro(*) - surfhpro(*) + +; set up profile +;maxelevp = max(surfpro) +;minelevp = min(surfpro) +;medelevp = mean(surfpro) +;vertrange = 1.5 * abs(maxelevp-minelevp) +;vertadd = 0.5d0 * (vertrange - abs(maxelevp-minelevp)) +;horzrange = vertrange * 5.86666666667d0 +;if (horzrange gt (pix*gridsize)) then horzrange = pix*gridsize +;plot, surfpos(*)/1.0d3, surfpro(*)/1.0d3, line=0, color=255, thick=1.0, $ +; TITLE='Matrix Cross-Section', charsize=1.0, $ +; XTITLE='Horizontal Position (km)', $ +; XRANGE=[(-1.0d0*horzrange/2.0d3),(horzrange/2.0d3)], XSTYLE=1, $ +; YTITLE='Elevation (km)', $ +; YRANGE=[((minelevp - vertadd)/1.0d3),((maxelevp + vertadd)/1.0d3)], YSTYLE=1, $ +; /device, pos = [0.063*conresx,0.049*conresy,0.99*conresx,0.26*conresy] +;oplot, surfpos(*)*1.0d-3, surfrpro(*)*1.0d-3, line=0, color=255, thick=1.0 + +;display text +dum = string(format='(E10.4)', curyear) +parts = strsplit(dum, 'E', /extract) +fcuryear = strcompress(string(format='(F6.4,"x10!U",i,"!N")', parts[0], parts[1])) + ' yr' +ftimp = string(totalimpacts, format = '(I13)') +ftcnt = string(tdist(4,0), format = '(I13)') +focnt = string(odist(4,0), format = '(I13)') +ftslp = string(tslp, format = '(F13.3)') + ' m' + + +dum = string(format='(E10.4)',masstot) +parts = strsplit(dum, 'E', /extract) +fmtot = strcompress(string(format='(F6.4,"x10!U",i,"!N")', parts[0], parts[1])) + ' kg' + +; Display information text below the R-plot +texttop = 0.15 + profsize +textspc = 0.035 +textleft = 0.05*conresx +textbreak = 0.25*conresx +xyouts, textleft, (texttop - 0*textspc)*conresy, time, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft, (texttop - 1*textspc)*conresy, timp, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft, (texttop - 2*textspc)*conresy, tcrt, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft, (texttop - 3*textspc)*conresy, ocrt, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft, (texttop - 4*textspc)*conresy, mtot, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft + textbreak, (texttop - 0*textspc)*conresy, fcuryear, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft + textbreak, (texttop - 1*textspc)*conresy, ftimp, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft + textbreak, (texttop - 2*textspc)*conresy, ftcnt, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft + textbreak, (texttop - 3*textspc)*conresy, focnt, color=255, charsize=charfac*conresy/720., /device +xyouts, textleft + textbreak, (texttop - 4*textspc)*conresy, fmtot, color=255, charsize=charfac*conresy/720., /device + +; Display information text above the R-plot +xyouts, 0.0368*conresx, 0.972*conresy, c1lab, color=255, charsize=charfac*conresy/720., /device +xyouts, 0.195*conresx, 0.972*conresy, c2lab, color=255, charsize=charfac*conresy/720., /device +xyouts, 0.353*conresx, 0.972*conresy, c3lab, color=255, charsize=charfac*conresy/720., /device +xyouts, 0.0368*conresx, 0.944*conresy, c1, color=255, charsize=charfac*conresy/720., /device +xyouts, 0.195*conresx, 0.944*conresy, c2, color=255, charsize=charfac*conresy/720., /device +xyouts, 0.353*conresx, 0.944*conresy, c3, color=255, charsize=charfac*conresy/720., /device +xyouts, 0.100*conresx, 0.917*conresy, epwr, color=255, charsize=charfac*conresy/720., /device +xyouts, 0.278*conresx, 0.917*conresy, ftslp, color=255, charsize=charfac*conresy/720., /device + +;print to screen +print, ncount, ' time = ', curyear +;print, ncount, ' tot impacts = ', tdist +;print, ncount, ' tot craters = ', totalimpacts +;print, ncount, ' obs craters = ', ocrcnt +;print, ncount, ' regolith = ', tslp +;print, ncount, ' prod R = ', mean(prval(1,*)) + +;draw box around the main surface display & fill +displaysize = floor(0.53*conresx) ; size of displayed surface +surfxpos = floor(0.462*conresx) +surfypos = floor((0.05 + profsize)*conresy) +xbox = [surfxpos - 1,surfxpos - 1,surfxpos + displaysize,surfxpos + displaysize,surfxpos - 1] +ybox = [surfypos - 1,surfypos + displaysize,surfypos + displaysize,surfypos - 1,surfypos - 1] +plotS, xbox, ybox, /device, color=255 + +; for display +mapscaled = congrid(map,3,displaysize,displaysize,/interp) + +tv, mapscaled, surfxpos, surfypos, xsize=displaysize, ysize=displaysize, true=1, /device + +; ---------- saving window ---------- + +; save console window +fnum = string(ncount,format='(I6.6)') +; print screen to JPEG file +if (file_test('console',/DIRECTORY) eq 0) then begin + file_mkdir,'console' +endif +print, ncount, ' saving window' +fname = 'console/console' + fnum + '.jpg' +dwin = tvrd(true=1) +write_jpeg, fname, dwin, true=1, quality=90 + +end diff --git a/examples/global-lunar-bombardment/frames/.gitignore b/examples/global-lunar-bombardment/frames/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/examples/global-lunar-bombardment/misc/.gitignore b/examples/global-lunar-bombardment/misc/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/examples/global-lunar-bombardment/presentation/.gitignore b/examples/global-lunar-bombardment/presentation/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/examples/global-lunar-bombardment/shaded/.gitignore b/examples/global-lunar-bombardment/shaded/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/examples/global-lunar-bombardment/surf/.gitignore b/examples/global-lunar-bombardment/surf/.gitignore new file mode 100644 index 00000000..e69de29b