Changeset 975 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 30, 2016, 7:18:03 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.bash
r974 r975 1057 1057 fname='compute_combos' 1058 1058 1059 set -x1060 1061 1059 Iwdir=$1 1062 1060 Owdir=$2 … … 1108 1106 1109 1107 return 1108 } 1109 1110 function createlist_plots(){ 1111 # Function to create the list of plots to draw 1112 # Drawplots= ':' separated list of plots to draw 1113 # KindPlots= ':' list of plots to draw this time 1114 1115 fname='createlist_plots' 1116 1117 Drawplots=$1 1118 KindPlots=$2 1119 1120 drwplts=`echo ${Drawplots} | tr ':' ' '` 1121 ikp=1 1122 plots='' 1123 for drw in ${drwplts}; do 1124 if $(isInlist ${KindPlots} ${drw}); then 1125 case ${drw} in 1126 'map2Dsfc') 1127 plts=${pltmap2Dsfc} 1128 ;; 1129 'map3D') 1130 plts=${pltmap3D} 1131 ;; 1132 'shadcont2Dsfc') 1133 plts=${pltshadcont2Dsfc} 1134 ;; 1135 'shadconthovmsfc') 1136 plts=${pltshadconthovmsfc} 1137 ;; 1138 'shadcont2Dzsec') 1139 plts=${pltshadcont2Dzsec} 1140 ;; 1141 *) 1142 echo ${errmsg} 1143 echo " "${main}": plot kind '"${drw}"' not ready !!" 1144 exit 1145 esac 1146 # Do we have plots for this kind? 1147 Lkplots=`expr length ${plts}'0'` 1148 if test ${Lkplots} -lt 2; then 1149 ferrmsg 1 ${main} "plot!kind!"${drw}"!without!variables" 1150 fi 1151 kplots=`list_add_label ${plts} ${drw} + beg` 1152 if test ${ikp} -eq 1; then 1153 plots=${kplots} 1154 else 1155 plots=${plots}':'${kplots} 1156 fi 1157 ikp=`expr ${ikp} + 1` 1158 fi 1159 # End of coincident direct plots 1160 done 1161 1162 echo ${fname}" listplots= "${plots}_${ikp} 1163 } 1164 1165 function createlist_diffplots(){ 1166 # Function to create the list of diff plots to draw 1167 # Drawplots= ':' separated list of plots to draw 1168 # KindPlots= ':' list of plots to draw this time 1169 1170 fname='createlist_diffplots' 1171 1172 Drawplots=$1 1173 KindPlots=$2 1174 1175 drwplts=`echo ${Drawplots} | tr ':' ' '` 1176 ikp=1 1177 plots='' 1178 for drw in ${drwplts}; do 1179 if $(isInlist ${KindPlots} ${drw}); then 1180 case ${drw} in 1181 'map2Dsfc') 1182 plts=${pltdiffmap2Dsfc} 1183 ;; 1184 'map3D') 1185 plts=${pltdiffmap3D} 1186 ;; 1187 'shadcont2Dsfc') 1188 plts=${pltdiffshadcont2Dsfc} 1189 ;; 1190 'shadconthovmsfc') 1191 plts=${pltdiffshadconthovmsfc} 1192 ;; 1193 'shadcont2Dzsec') 1194 plts=${pltdiffshadcont2Dzsec} 1195 ;; 1196 *) 1197 echo ${errmsg} 1198 echo " "${main}": plot kind '"${drw}"' not ready !!" 1199 exit 1200 esac 1201 # Do we have plots for this kind? 1202 Lkplots=`expr length ${plts}'0'` 1203 if test ${Lkplots} -lt 2; then 1204 ferrmsg 1 ${main} "plot!kind!"${drw}"!without!variables" 1205 fi 1206 kplots=`list_add_label ${plts} ${drw} + beg` 1207 if test ${ikp} -eq 1; then 1208 plots=${kplots} 1209 else 1210 plots=${plots}':'${kplots} 1211 fi 1212 ikp=`expr ${ikp} + 1` 1213 fi 1214 # End of coincident direct plots 1215 done 1216 1217 echo ${fname}" listplots= "${plots}_${ikp} 1110 1218 } 1111 1219 … … 1615 1723 files: ${files} 1616 1724 varcompute: ${varcompute} 1617 itotv: $ itotv}1725 itotv: ${itotv} 1618 1726 testfs: ${testfiles} 1619 1727 combo: ${combo} … … 1626 1734 itotv=`cat ${owdir}/varcompute.inf | grep itotv | awk '{print $2}'` 1627 1735 testfiles=`cat ${owdir}/varcompute.inf | grep testfs | awk '{print $2}'` 1628 combo=`cat ${owdir}/varcompute.inf | grep combo| awk '{print $2}'`1736 combo=`cat ${owdir}/varcompute.inf | grep 'combo:' | awk '{print $2}'` 1629 1737 # End of avoiding to repeat all the experiment search 1630 1738 fi … … 1639 1747 1640 1748 # Computing combos 1641 if ${combo}; then1749 if test ${combo}; then 1642 1750 echo " Computing combos: "${varcombo} 1643 1751 compute_combos ${iwdir} ${owdir} ${files} ${testfiles} ${moddims} ${modvdims} \ 1644 1752 ${varcombo} ${filescratch} 1645 1753 fi 1646 1647 exit1648 1754 1649 1755 echo " "${main}": "${ic}" variables has been computed" … … 1657 1763 1658 1764 if test ! -f directplotsdraw.inf; then 1659 drwplts=`echo ${drawplots} | tr ':' ' '` 1660 ikp=1 1661 plots='' 1662 for drw in ${drwplts}; do 1663 if $(isInlist ${directplots} ${drw}); then 1664 case ${drw} in 1665 'map2Dsfc') 1666 plts=${pltmap2Dsfc} 1667 ;; 1668 'map3D') 1669 plts=${pltmap3D} 1670 ;; 1671 'shadcont2Dsfc') 1672 plts=${pltshadcont2Dsfc} 1673 ;; 1674 'shadconthovmsfc') 1675 plts=${pltshadconthovmsfc} 1676 ;; 1677 'shadcont2Dzsec') 1678 plts=${pltshadcont2Dzsec} 1679 ;; 1680 *) 1681 echo ${errmsg} 1682 echo " "${main}": plot kind '"${drw}"' not ready !!" 1683 exit 1684 esac 1685 # Do we have plots for this kind? 1686 Lkplots=`expr length ${plts}'0'` 1687 if test ${Lkplots} -lt 2; then 1688 ferrmsg 1 ${main} "plot!kind!"${drw}"!without!variables" 1689 fi 1690 kplots=`list_add_label ${plts} ${drw} + beg` 1691 if test ${ikp} -eq 1; then 1692 plots=${kplots} 1693 else 1694 plots=${plots}':'${kplots} 1695 fi 1696 ikp=`expr ${ikp} + 1` 1697 fi 1698 # End of coincident direct plots 1699 done 1765 listplots=`createlist_plots ${drawplots} ${directplots} | grep listplots | awk '{print $3}'` 1766 1767 plots=`echo ${listplots} | tr '_' ' ' | awk '{print $1}'` 1768 ikp=`echo ${listplots} | tr '_' ' ' | awk '{print $2}'` 1769 1700 1770 cat << EOF > directplotsdraw.inf 1701 1771 Nkinds= ${ikp} … … 1722 1792 done 1723 1793 1724 echo " "${main}": "${idp}" direct plots hav been computed"1794 echo " "${main}": "${idp}" direct plots have been computed" 1725 1795 cd ${rootsh} 1726 1796 … … 1728 1798 done 1729 1799 1800 ### ## # 1730 1801 # Experiment differences 1731 ## 1802 ## # ## # 1803 1732 1804 diffexperiments=`list_pairs $(echo ${exps} | tr ' ' ':') | grep -v newlists | awk '{print $3}'` 1733 1805 diffexps=`echo ${diffexperiments} | tr ':' ' '` 1734 1806 1735 set -x 1736 1737 vdiffs=`echo ${vardiff} | tr ':' ' '` 1738 ivd=1 1739 for vdiff in ${vdiffs}; do 1740 echo ${vdiff}" ..." 1741 if test $(expr index ${vdiff} '|') -ne -1; then 1742 vn=`echo ${vdiff} | tr '|' ' ' | awk '{print $1}'` 1743 ops=`echo ${vdiff} | tr '|' ' ' | awk '{print $2}'` 1744 else 1745 vn=`echo ${vdiff} | tr '|' ' ' | awk '{print $1}'` 1746 ops='None' 1747 fi 1748 fileh=`echo ${varcompute} | tr ';' '\n' | grep ${vdiff} | tr '|' ' ' | awk '{print $3}'` 1749 1750 filen=`stats_filename ${vn} ${ops} ${fileh}` 1751 opss=`echo ${ops} | tr '@' ' '` 1752 for op in ${opss}; do 1753 # Adding 'surnames' to the variable's name 1754 if test ${op} = 'turb'; then 1755 vn=${vn}'turb' 1756 fi 1757 if $(isInlist ${varmeanname} ${op}); then 1758 vn=${vn}'mean' 1759 fi 1760 done 1761 1762 for diffexp in ${diffexps}; do 1763 echo " "${diffexp} 1764 difexp1=`echo ${diffexp} | tr '|' ' ' | awk '{print $1}'` 1765 difexp2=`echo ${diffexp} | tr '|' ' ' | awk '{print $2}'` 1807 for diffexp in ${diffexps}; do 1808 echo " "${diffexp} 1809 difexp1=`echo ${diffexp} | tr '|' ' ' | awk '{print $1}'` 1810 difexp2=`echo ${diffexp} | tr '|' ' ' | awk '{print $2}'` 1811 1812 vdiffs=`echo ${vardiff} | tr ':' ' '` 1813 ivd=1 1814 for vdiff in ${vdiffs}; do 1815 echo ${vdiff}" ..." 1816 if test $(expr index ${vdiff} '|') -ne -1; then 1817 vn=`echo ${vdiff} | tr '|' ' ' | awk '{print $1}'` 1818 ops=`echo ${vdiff} | tr '|' ' ' | awk '{print $2}'` 1819 else 1820 vn=`echo ${vdiff} | tr '|' ' ' | awk '{print $1}'` 1821 ops='None' 1822 fi 1823 fileh=`echo ${varcompute} | tr ';' '\n' | grep ${vdiff} | tr '|' ' ' | awk '{print $3}'` 1766 1824 1767 1825 owdir=${ofold}/${mod}/${difexp1}-${difexp2} … … 1769 1827 mkdir -p ${owdir} 1770 1828 fi 1829 1830 filen=${vn}_${fileh}.nc 1771 1831 1772 1832 if ${filescratch}; then rm ${owdir}/${filen} >& /dev/null; fi … … 1786 1846 fi 1787 1847 1788 # end experiment pairs 1848 echo " Computing diff statistics ..." 1849 1850 cfdims='lon:lat:pres:time' 1851 cfvdims='lon:lat:pres:time' 1852 cdiffvn=`echo ${filen} | tr '_' ' ' | awk '{print $1}'` 1853 cdiffh=`echo ${filen} | tr '_' ' ' | awk '{print $2}' | tr '.' ' ' | awk '{print $1}'` 1854 1855 cdiffvar=${cdiffvn}'|'${ops}'|'${cdiffh}'|None|None' 1856 1857 compute_statistics ${owdir} ${filen} ${owdir} ${cdiffvar} ${cfdims} ${cfvdims} \ 1858 ${filescratch} 1859 1860 # Computing combos 1861 if test $(expr index ${ops} '@') -ne -1; then 1862 echo " Computing combos: "${ops} 1863 combs=`echo ${ops} | tr ';' ' ' | awk '{print $2}' | tr '@' ' '` 1864 ifile=${cdiffvn}_${fhead} 1865 for comb in ${combs}; do 1866 combcvar=${cdiffvn}'|'${comb}'|'${cdiffh}'|None|None' 1867 compute_statistics ${owdir} ${ifile}.nc ${owdir} ${combcvar} ${cfdims} \ 1868 ${cfvdims} ${filescratch} ${ifile}.nc 1869 ifile=${ifile}_${comb} 1870 1871 # Adding 'surnames' to the variable's name 1872 if test ${comb} = 'turb'; then 1873 cdiffvn=${cdiffvn}'turb' 1874 fi 1875 if $(isInlist ${varmeanname} ${comb}); then 1876 cdiffvn=${cdiffvn}'mean' 1877 fi 1878 1879 # End of combo 1880 done 1881 fi 1882 ivd=`expr ${ivd} + 1` 1883 # end of variable diff 1789 1884 done 1885 1886 # Diff plotting 1887 ## 1888 set -x 1889 1890 echo " "${main}": Plotting diff figures ..." 1891 if ${figscratch}; then rm diffplotsdraw.inf; fi 1892 if ${addfigures}; then rm diffplotsdraw.inf; fi 1893 1894 if test ! -f diffplotsdraw.inf; then 1895 listplots=`createlist_diffplots ${drawdiffplots} ${directplots} | \ 1896 grep listplots | awk '{print $3}'` 1897 1898 plots=`echo ${listplots} | tr '_' ' ' | awk '{print $1}'` 1899 ikp=`echo ${listplots} | tr '_' ' ' | awk '{print $2}'` 1900 1901 cat << EOF > diffplotsdraw.inf 1902 Nkinds= ${ikp} 1903 plots= ${plots} 1904 EOF 1905 else 1906 echo ${warnmsg} 1907 echo " "${main}": retrieving direct plots from existing file 'diffplotsdraw.inf' !!" 1908 Nkinds=`cat diffplotsdraw.inf | grep Nkinds | awk '{print $2}'` 1909 plots=`cat diffplotsdraw.inf | grep plots | awk '{print $2}'` 1910 fi 1911 1912 pts=`echo ${plots} | tr ':' ' '` 1913 idp=1 1914 for pt in ${pts}; do 1915 echo " "${pt} 1916 draw_plot ${pt} ${owdir} ${fileh} ${figscratch} 1917 idp=`expr ${idp} + 1` 1918 done 1919 1920 echo " "${main}": "${idp}" diff plots have been computed" 1921 cd ${rootsh} 1922 1923 # end experiment pairs 1924 done 1790 1925 # LLUIS 1791 1792 ivd=`expr ${ivd} + 1`1793 # end of variable diff1794 done1795 1926 1796 1927 exit -
trunk/tools/model_graphics_template.dat
r971 r975 93 93 varxmean = tas:uas:vas:hfss:hfls:wss 94 94 varpinterp = ta:ua:va:hur:ws:hus 95 vardiff = tas|last:tas|xmean:tas|tmean96 95 varcombo = ta;pinterp@last@xmean:ua;pinterp@last@xmean:va;pinterp@last@xmean:hur;pinterp@last@xmean:ws;pinterp@turb@xmean:hus;pinterp@turb@xmean 96 97 vardiff = tas|last:tas|xmean:tas|tmean:wss|last:wss|xmean:wss|tmean 97 98 98 99 # Operations which attach 'mean' at the end of the variable name … … 118 119 #drawplots = shadcont2Dsfc:shadconthovmsfc:sahdcont2Dzsec 119 120 drawplots = shadcont2Dzsec 121 drawdiffplots = shadcont2Dsfc 120 122 121 123 # Figures which can be made directly without another model/experiment output … … 126 128 pltshadcont2Dzsec=ua|pinterp@last@xmean#va|pinterp@last@xmean:hur|pinterp@last@xmean#ta|pinterp@last@xmean:ws|pinterp@turb@xmean#hus|pinterp@turb@xmean 127 129 128 pltdiff map2Dz = uapxmean:vapxmean:tapxmean:huspxmean130 pltdiffshadcont2Dsfc = tas|xmean#wss|xmean:tas|tmean#wss|tmean:tas|last#wss|last 129 131 130 132 # Specific variable-statistisc graphic parameters (if no value is given, they will be retrieved from 'variables_values.dat')
Note: See TracChangeset
for help on using the changeset viewer.