├── README.md ├── example_scripts ├── .svn │ ├── entries │ ├── prop-base │ │ ├── example_netcdf_write.py.svn-base │ │ ├── example_pyWRF_script.py.svn-base │ │ ├── example_pyWRF_script_dbz.py.svn-base │ │ ├── example_pyWRF_script_dbz_write.py.svn-base │ │ └── example_pyWRF_script_precip.py.svn-base │ └── text-base │ │ ├── example_netcdf_write.py.svn-base │ │ ├── example_pyWRF_script.py.svn-base │ │ ├── example_pyWRF_script_dbz.py.svn-base │ │ ├── example_pyWRF_script_dbz_write.py.svn-base │ │ └── example_pyWRF_script_precip.py.svn-base ├── example_netcdf_write.py ├── example_pyWRF_script.py ├── example_pyWRF_script_dbz.py ├── example_pyWRF_script_dbz_write.py └── example_pyWRF_script_precip.py ├── library ├── .svn │ ├── entries │ ├── prop-base │ │ ├── coltbls.py.svn-base │ │ └── dbzcalc_ferrier_py.f90.svn-base │ └── text-base │ │ ├── coltbls.py.svn-base │ │ ├── dbzcalc_ferrier_py.f90.svn-base │ │ ├── dbzcalc_lin_py.f.svn-base │ │ ├── eta_tables_massi.txt.svn-base │ │ ├── eta_tables_massr.txt.svn-base │ │ ├── perturbation_variables.py.svn-base │ │ ├── skewt.py.svn-base │ │ └── wrf_user_unstagger.py.svn-base ├── NCEP_Parameter_Table_2.txt ├── coltbls.py ├── cython_commands.txt ├── dbzcalc_ferrier_py.f90 ├── dbzcalc_lin_py.f ├── dbzcalc_thompson_py.f ├── eta_tables_massi.txt ├── eta_tables_massr.txt ├── module_mp_radar.F ├── perturbation_variables.py ├── skewt.py ├── wrf_user_unstagger.pyx └── wrf_user_unstagger_pure.py ├── pyWRF.py └── sample ├── .svn ├── entries └── text-base │ ├── WRFUserARW.ncl.svn-base │ └── wrf_user_fortran_util_0.f.svn-base ├── Ferrier ├── .svn │ ├── entries │ ├── prop-base │ │ ├── CALMICT.f.svn-base │ │ ├── CALMICT.f90.svn-base │ │ ├── CALMICT.so.svn-base │ │ ├── CMASSI.f.svn-base │ │ ├── CMASSI.f90.svn-base │ │ ├── MICROINIT.f.svn-base │ │ ├── eta_micro_lookup.dat.svn-base │ │ └── params.f.svn-base │ └── text-base │ │ ├── CALMICT.f.svn-base │ │ ├── CALMICT.f90.svn-base │ │ ├── CALMICT.so.svn-base │ │ ├── CMASSI.f.svn-base │ │ ├── CMASSI.f90.svn-base │ │ ├── MICROINIT.f.svn-base │ │ ├── eta_micro_lookup.dat.svn-base │ │ └── params.f.svn-base ├── CALMICT.f ├── CALMICT.f90 ├── CALMICT.so ├── CMASSI.f ├── CMASSI.f90 ├── MICROINIT.f ├── eta_micro_lookup.dat └── params.f ├── WRFUserARW.ncl └── wrf_user_fortran_util_0.f /README.md: -------------------------------------------------------------------------------- 1 | pyWRF 2 | ===== 3 | 4 | pyWRF is designed to read, process, and plot data from the Weather Research and Forecasting model. -------------------------------------------------------------------------------- /example_scripts/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 24 5 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn/wrf_project/example_scripts 6 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn 7 | 8 | 9 | 10 | 2012-03-14T08:15:26.391602Z 11 | 21 12 | scaine 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 717768ba-3af3-49a0-9c46-b1c1e31f1073 28 | 29 | example_netcdf_write.py 30 | file 31 | 32 | 33 | 34 | 35 | 2012-03-15T01:06:19.000000Z 36 | 5298ba65dbdf24a4821d51fe9e9a010c 37 | 2012-03-14T01:46:27.679629Z 38 | 19 39 | scaine 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 764 62 | 63 | example_pyWRF_script_precip.py 64 | file 65 | 66 | 67 | 68 | 69 | 2012-03-15T01:06:19.000000Z 70 | 6f4f43ba583dfe115090afd6f4e39c2d 71 | 2012-03-14T01:38:45.822261Z 72 | 18 73 | scaine 74 | has-props 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 801 96 | 97 | example_pyWRF_script_dbz_write.py 98 | file 99 | 100 | 101 | 102 | 103 | 2012-03-15T01:06:19.000000Z 104 | 2667a3f7d62af2bdc3280df35d9ce281 105 | 2012-03-14T08:15:26.391602Z 106 | 21 107 | scaine 108 | has-props 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 2195 130 | 131 | example_pyWRF_script_dbz.py 132 | file 133 | 134 | 135 | 136 | 137 | 2012-03-15T01:06:19.000000Z 138 | 992d0d80ca03ba1e1beee5148359d457 139 | 2012-03-14T01:38:45.822261Z 140 | 18 141 | scaine 142 | has-props 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 1384 164 | 165 | example_pyWRF_script.py 166 | file 167 | 168 | 169 | 170 | 171 | 2012-03-15T01:06:19.000000Z 172 | c98e13a3ea988ec0b18cbdd52d81d11c 173 | 2012-03-14T01:38:45.822261Z 174 | 18 175 | scaine 176 | has-props 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 1354 198 | 199 | -------------------------------------------------------------------------------- /example_scripts/.svn/prop-base/example_netcdf_write.py.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /example_scripts/.svn/prop-base/example_pyWRF_script.py.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /example_scripts/.svn/prop-base/example_pyWRF_script_dbz.py.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /example_scripts/.svn/prop-base/example_pyWRF_script_dbz_write.py.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /example_scripts/.svn/prop-base/example_pyWRF_script_precip.py.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /example_scripts/.svn/text-base/example_netcdf_write.py.svn-base: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as n 3 | import pylab as pl 4 | import pyWRF 5 | import skewt 6 | import dircache 7 | import os 8 | 9 | #input_directory = path to your wrf files (needs / at the end) 10 | input_directory = '/data/cdgs1/scaine/bc_surface_test3/tracers_added/d01/' 11 | 12 | wrf_files=dircache.listdir(input_directory) 13 | 14 | first_time=True 15 | for wfile in wrf_files: 16 | if wfile[0:6] != 'wrfout': 17 | continue 18 | if (first_time== False): 19 | continue 20 | 21 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 22 | times=wrf_file.get_var('Times') 23 | u_wind=wrf_file.get_var('U') 24 | v_wind=wrf_file.get_var('V') 25 | 26 | wrf_file.write_netcdf_file(u_wind,'u_wind',filename='blah',directory='netcdf_out') 27 | 28 | wrf_file.write_netcdf_file(v_wind,'v_wind',filename='blah',directory='netcdf_out') 29 | 30 | first_time=False 31 | -------------------------------------------------------------------------------- /example_scripts/.svn/text-base/example_pyWRF_script.py.svn-base: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as n 3 | import pylab as pl 4 | import pyWRF 5 | import skewt 6 | import dircache 7 | import os 8 | 9 | #input_directory = path to your wrf files (needs / at the end) 10 | input_directory = '/data/cdgs1/scaine/bc_surface_test/spinup/d01/' 11 | 12 | wrf_files=dircache.listdir(input_directory) 13 | 14 | 15 | for wfile in wrf_files: 16 | if wfile[0:6] != 'wrfout': 17 | continue 18 | 19 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 20 | times=wrf_file.get_var('Times') 21 | u_wind=wrf_file.get_var('U') 22 | xlat =wrf_file.get_var('XLAT') 23 | xlon =wrf_file.get_var('XLONG') 24 | melb_airport_lat=-37.67 25 | melb_airport_lon=144.83 26 | 27 | 28 | #note this will fail if your domain does not include melbourne 29 | #i,j = wrf_file.get_ij_lat_long(xlat,xlon,melb_airport_lat,melb_airport_lon) 30 | 31 | darwin_airport_lat=-12.4078 32 | darwin_airport_lon=130.0876 33 | #i,j = wrf_file.get_ij_lat_long(xlat,xlon,darwin_airport_lat,darwin_airport_lon) 34 | i,j= 0,0 35 | 36 | print i,j 37 | wrf_file.plot_directory='plots' 38 | direxist=os.path.isdir(wrf_file.plot_directory) 39 | if (direxist == False): 40 | os.system('mkdir -p '+wrf_file.plot_directory) 41 | 42 | for time_count in range(len(times)): 43 | time=times[time_count] 44 | wrf_file.plot_skewt(i,j,time+'_skewt.png','Darwin Airport') 45 | wrf_file.plot_vapor(imagename=time+'_vapor.png',title=time,timestep=time_count) 46 | print 'finished plotting time period ' + time 47 | -------------------------------------------------------------------------------- /example_scripts/.svn/text-base/example_pyWRF_script_dbz.py.svn-base: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import matplotlib 3 | matplotlib.use('Agg') 4 | import numpy as n 5 | import pylab as pl 6 | import pyWRF 7 | import skewt 8 | import dircache 9 | import os 10 | 11 | MP='ferrier' 12 | LEVEL=5 13 | 14 | #input_directory = path to your wrf files (needs / at the end) 15 | input_directory = '/nfs/monash/home/louwil/WRFV3/031303/wrfout_d03/' 16 | 17 | wrf_files=dircache.listdir(input_directory) 18 | 19 | 20 | for wfile in wrf_files: 21 | if wfile[0:6] != 'wrfout': 22 | continue 23 | 24 | print wfile 25 | wfilename=wfile[11:len(wfile)] 26 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 27 | 28 | 29 | 30 | #plot a cappi at model level 10, technically this is not a cappi 31 | #wrf_file.plot_cappi(level=10,title='model level 10')i 32 | 33 | 34 | #return the data into an array so we can work with it 35 | dbz=wrf_file.calculate_dbz_ferrier() 36 | 37 | height_levels=n.arange(500.,20000.,500) #height of the levels you want in meters 38 | # print height_levels 39 | Z=wrf_file.get_var('Z') 40 | 41 | 42 | dbz_interp=wrf_file.interp_to_height(height_levels,Z,dbz) 43 | 44 | wrf_file.plot_directory=input_directory+'dbz' 45 | 46 | direxist=os.path.isdir(wrf_file.plot_directory) 47 | if (direxist == False): 48 | os.system('mkdir -p '+wrf_file.plot_directory) 49 | 50 | 51 | wrf_file.plot_cappi(level=LEVEL,MPscheme=MP,dbz_array=dbz_interp,title=wfilename+' '+str(height_levels[LEVEL]/1000)+'km',imagename=str(height_levels[LEVEL]/1000)+',interp') 52 | 53 | 54 | 55 | print 'finished plotting time period ' 56 | 57 | -------------------------------------------------------------------------------- /example_scripts/.svn/text-base/example_pyWRF_script_dbz_write.py.svn-base: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import matplotlib 3 | matplotlib.use('Agg') 4 | import numpy as n 5 | import pylab as pl 6 | import pyWRF 7 | import skewt 8 | import dircache 9 | import os 10 | import cPickle as pickle 11 | 12 | #input_directory = path to your wrf files (needs / at the end) 13 | input_directory = '/nfs/monash/home/louwil/WRFV3/022403_Lin/wrfout_d03/' 14 | 15 | wrf_files=dircache.listdir(input_directory) 16 | 17 | 18 | for wfile in wrf_files: 19 | if wfile[0:6] != 'wrfout': 20 | continue 21 | 22 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 23 | times=wrf_file.get_var('Times') 24 | 25 | 26 | #plot a cappi at model level 10, technically this is not a cappi 27 | #wrf_file.plot_cappi(level=10,title='model level 10') 28 | 29 | 30 | #return the data into an array so we can work with it 31 | dbz=wrf_file.calculate_dbz_lin() 32 | height_levels=n.arange(500.,20000.,500) #height of the levels you want in meters 33 | # print height_levels 34 | Z=wrf_file.get_var('Z') 35 | 36 | 37 | dbz_interp=wrf_file.interp_to_height(height_levels,Z,dbz) 38 | 39 | wrf_file.plot_directory= input_directory+'dbz_data' 40 | direxist=os.path.isdir(wrf_file.plot_directory) 41 | if (direxist == False): 42 | os.system('mkdir -p '+wrf_file.plot_directory) 43 | 44 | # Example: 4 dimensions ['T','BT','SN','WE'] 45 | wrf_file.write_netcdf_file(input_variable=dbz_interp[:,:,:,:],var_name='dBZ_interp',directory=wrf_file.plot_directory,filename=times[0]+'_ex1_dbz',var_dim=('T','BT','SN','WE')) 46 | wrf_file.write_netcdf_file(input_variable=times,var_name='Times',directory=wrf_file.plot_directory,filename=times[0]+'_ex1_dbz',var_dim=('T')) 47 | 48 | 49 | # for the_time in range(len(times)): 50 | 51 | # Example: 3 dimensions ['BT','SN','WE'] 52 | # wrf_file.write_netcdf_file(input_variable=dbz_interp[the_time,:,:,:],var_name='dBZ_interp',directory=wrf_file.plot_directory,filename=times[the_time]+'_ex2_dbz',var_dim=('BT','SN','WE')) 53 | 54 | # Example: 3 dimensions ['T','SN','WE'] 55 | # wrf_file.write_netcdf_file(input_variable=dbz_interp[:,0,:,:],var_name='dBZ_interp',directory=wrf_file.plot_directory,filename=times[the_time]+'_ex3_dbz',var_dim=('T','SN','WE')) 56 | break 57 | # wrf_file.plot_cappi(level=10,dbz_array=dbz_interp,title=height_levels[level]/10)+'km',imagename='interp') 58 | 59 | 60 | 61 | # print 'finished plotting time period ' 62 | 63 | -------------------------------------------------------------------------------- /example_scripts/.svn/text-base/example_pyWRF_script_precip.py.svn-base: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as n 3 | import pylab as pl 4 | import pyWRF 5 | import skewt 6 | import dircache 7 | import os 8 | 9 | #input_directory = path to your wrf files (needs / at the end) 10 | input_directory = '/data/cdgs2/datasets/dry_line_case_1/send01/d01/' 11 | 12 | wrf_files=dircache.listdir(input_directory) 13 | 14 | 15 | for wfile in wrf_files: 16 | if wfile[0:6] != 'wrfout': 17 | continue 18 | 19 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 20 | times=wrf_file.get_var('Times') 21 | 22 | wrf_file.plot_directory='plots' 23 | direxist=os.path.isdir(wrf_file.plot_directory) 24 | if (direxist == False): 25 | os.system('mkdir -p '+wrf_file.plot_directory) 26 | 27 | for time_count in range(len(times)): 28 | time=times[time_count] 29 | wrf_file.plot_precip(imagename=time+'_precip.png',title=time,timestep=time_count) 30 | print 'finished plotting time period ' + time 31 | -------------------------------------------------------------------------------- /example_scripts/example_netcdf_write.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as n 3 | import pylab as pl 4 | import pyWRF 5 | import skewt 6 | import dircache 7 | import os 8 | 9 | #input_directory = path to your wrf files (needs / at the end) 10 | input_directory = '/data/cdgs1/scaine/bc_surface_test3/tracers_added/d01/' 11 | 12 | wrf_files=dircache.listdir(input_directory) 13 | 14 | first_time=True 15 | for wfile in wrf_files: 16 | if wfile[0:6] != 'wrfout': 17 | continue 18 | if (first_time== False): 19 | continue 20 | 21 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 22 | times=wrf_file.get_var('Times') 23 | u_wind=wrf_file.get_var('U') 24 | v_wind=wrf_file.get_var('V') 25 | 26 | wrf_file.write_netcdf_file(u_wind,'u_wind',filename='blah',directory='netcdf_out') 27 | 28 | wrf_file.write_netcdf_file(v_wind,'v_wind',filename='blah',directory='netcdf_out') 29 | 30 | first_time=False 31 | -------------------------------------------------------------------------------- /example_scripts/example_pyWRF_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as n 3 | import pylab as pl 4 | import pyWRF 5 | import skewt 6 | import dircache 7 | import os 8 | 9 | #input_directory = path to your wrf files (needs / at the end) 10 | input_directory = '/data/cdgs1/scaine/bc_surface_test/spinup/d01/' 11 | 12 | wrf_files=dircache.listdir(input_directory) 13 | 14 | 15 | for wfile in wrf_files: 16 | if wfile[0:6] != 'wrfout': 17 | continue 18 | 19 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 20 | times=wrf_file.get_var('Times') 21 | u_wind=wrf_file.get_var('U') 22 | xlat =wrf_file.get_var('XLAT') 23 | xlon =wrf_file.get_var('XLONG') 24 | melb_airport_lat=-37.67 25 | melb_airport_lon=144.83 26 | 27 | 28 | #note this will fail if your domain does not include melbourne 29 | #i,j = wrf_file.get_ij_lat_long(xlat,xlon,melb_airport_lat,melb_airport_lon) 30 | 31 | darwin_airport_lat=-12.4078 32 | darwin_airport_lon=130.0876 33 | #i,j = wrf_file.get_ij_lat_long(xlat,xlon,darwin_airport_lat,darwin_airport_lon) 34 | i,j= 0,0 35 | 36 | print i,j 37 | wrf_file.plot_directory='plots' 38 | direxist=os.path.isdir(wrf_file.plot_directory) 39 | if (direxist == False): 40 | os.system('mkdir -p '+wrf_file.plot_directory) 41 | 42 | for time_count in range(len(times)): 43 | time=times[time_count] 44 | wrf_file.plot_skewt(i,j,time+'_skewt.png','Darwin Airport') 45 | wrf_file.plot_vapor(imagename=time+'_vapor.png',title=time,timestep=time_count) 46 | print 'finished plotting time period ' + time 47 | -------------------------------------------------------------------------------- /example_scripts/example_pyWRF_script_dbz.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import matplotlib 3 | matplotlib.use('Agg') 4 | import numpy as n 5 | import pylab as pl 6 | import pyWRF 7 | import skewt 8 | import dircache 9 | import os 10 | 11 | MP='ferrier' 12 | LEVEL=5 13 | 14 | #input_directory = path to your wrf files (needs / at the end) 15 | input_directory = '/nfs/monash/home/louwil/WRFV3/031303/wrfout_d03/' 16 | 17 | wrf_files=dircache.listdir(input_directory) 18 | 19 | 20 | for wfile in wrf_files: 21 | if wfile[0:6] != 'wrfout': 22 | continue 23 | 24 | print wfile 25 | wfilename=wfile[11:len(wfile)] 26 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 27 | 28 | 29 | 30 | #plot a cappi at model level 10, technically this is not a cappi 31 | #wrf_file.plot_cappi(level=10,title='model level 10')i 32 | 33 | 34 | #return the data into an array so we can work with it 35 | dbz=wrf_file.calculate_dbz_ferrier() 36 | 37 | height_levels=n.arange(500.,20000.,500) #height of the levels you want in meters 38 | # print height_levels 39 | Z=wrf_file.get_var('Z') 40 | 41 | 42 | dbz_interp=wrf_file.interp_to_height(height_levels,Z,dbz) 43 | 44 | wrf_file.plot_directory=input_directory+'dbz' 45 | 46 | direxist=os.path.isdir(wrf_file.plot_directory) 47 | if (direxist == False): 48 | os.system('mkdir -p '+wrf_file.plot_directory) 49 | 50 | 51 | wrf_file.plot_cappi(level=LEVEL,MPscheme=MP,dbz_array=dbz_interp,title=wfilename+' '+str(height_levels[LEVEL]/1000)+'km',imagename=str(height_levels[LEVEL]/1000)+',interp') 52 | 53 | 54 | 55 | print 'finished plotting time period ' 56 | 57 | -------------------------------------------------------------------------------- /example_scripts/example_pyWRF_script_dbz_write.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import matplotlib 3 | matplotlib.use('Agg') 4 | import numpy as n 5 | import pylab as pl 6 | import pyWRF 7 | import skewt 8 | import dircache 9 | import os 10 | import cPickle as pickle 11 | 12 | #input_directory = path to your wrf files (needs / at the end) 13 | input_directory = '/nfs/monash/home/louwil/WRFV3/022403_Lin/wrfout_d03/' 14 | 15 | wrf_files=dircache.listdir(input_directory) 16 | 17 | 18 | for wfile in wrf_files: 19 | if wfile[0:6] != 'wrfout': 20 | continue 21 | 22 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 23 | times=wrf_file.get_var('Times') 24 | 25 | 26 | #plot a cappi at model level 10, technically this is not a cappi 27 | #wrf_file.plot_cappi(level=10,title='model level 10') 28 | 29 | 30 | #return the data into an array so we can work with it 31 | dbz=wrf_file.calculate_dbz_lin() 32 | height_levels=n.arange(500.,20000.,500) #height of the levels you want in meters 33 | # print height_levels 34 | Z=wrf_file.get_var('Z') 35 | 36 | 37 | dbz_interp=wrf_file.interp_to_height(height_levels,Z,dbz) 38 | 39 | wrf_file.plot_directory= input_directory+'dbz_data' 40 | direxist=os.path.isdir(wrf_file.plot_directory) 41 | if (direxist == False): 42 | os.system('mkdir -p '+wrf_file.plot_directory) 43 | 44 | # Example: 4 dimensions ['T','BT','SN','WE'] 45 | wrf_file.write_netcdf_file(input_variable=dbz_interp[:,:,:,:],var_name='dBZ_interp',directory=wrf_file.plot_directory,filename=times[0]+'_ex1_dbz',var_dim=('T','BT','SN','WE')) 46 | wrf_file.write_netcdf_file(input_variable=times,var_name='Times',directory=wrf_file.plot_directory,filename=times[0]+'_ex1_dbz',var_dim=('T')) 47 | 48 | 49 | # for the_time in range(len(times)): 50 | 51 | # Example: 3 dimensions ['BT','SN','WE'] 52 | # wrf_file.write_netcdf_file(input_variable=dbz_interp[the_time,:,:,:],var_name='dBZ_interp',directory=wrf_file.plot_directory,filename=times[the_time]+'_ex2_dbz',var_dim=('BT','SN','WE')) 53 | 54 | # Example: 3 dimensions ['T','SN','WE'] 55 | # wrf_file.write_netcdf_file(input_variable=dbz_interp[:,0,:,:],var_name='dBZ_interp',directory=wrf_file.plot_directory,filename=times[the_time]+'_ex3_dbz',var_dim=('T','SN','WE')) 56 | break 57 | # wrf_file.plot_cappi(level=10,dbz_array=dbz_interp,title=height_levels[level]/10)+'km',imagename='interp') 58 | 59 | 60 | 61 | # print 'finished plotting time period ' 62 | 63 | -------------------------------------------------------------------------------- /example_scripts/example_pyWRF_script_precip.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as n 3 | import pylab as pl 4 | import pyWRF 5 | import skewt 6 | import dircache 7 | import os 8 | 9 | #input_directory = path to your wrf files (needs / at the end) 10 | input_directory = '/data/cdgs2/datasets/dry_line_case_1/send01/d01/' 11 | 12 | wrf_files=dircache.listdir(input_directory) 13 | 14 | 15 | for wfile in wrf_files: 16 | if wfile[0:6] != 'wrfout': 17 | continue 18 | 19 | wrf_file=pyWRF.wrf_file(input_directory+wfile) 20 | times=wrf_file.get_var('Times') 21 | 22 | wrf_file.plot_directory='plots' 23 | direxist=os.path.isdir(wrf_file.plot_directory) 24 | if (direxist == False): 25 | os.system('mkdir -p '+wrf_file.plot_directory) 26 | 27 | for time_count in range(len(times)): 28 | time=times[time_count] 29 | wrf_file.plot_precip(imagename=time+'_precip.png',title=time,timestep=time_count) 30 | print 'finished plotting time period ' + time 31 | -------------------------------------------------------------------------------- /library/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 24 5 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn/wrf_project/library 6 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn 7 | 8 | 9 | 10 | 2012-03-14T01:57:41.849803Z 11 | 20 12 | scaine 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 717768ba-3af3-49a0-9c46-b1c1e31f1073 28 | 29 | dbzcalc_lin_py.f 30 | file 31 | 32 | 33 | 34 | 35 | 2012-03-15T01:06:19.000000Z 36 | 825a045d8c3397c805e03d5e27f2430e 37 | 2012-03-14T01:38:45.822261Z 38 | 18 39 | scaine 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 7019 62 | 63 | wrf_user_unstagger.py 64 | file 65 | 66 | 67 | 68 | 69 | 2012-03-15T01:06:19.000000Z 70 | 85844ccc0bb62a1bdc0953e435e6cb57 71 | 2012-03-14T01:38:45.822261Z 72 | 18 73 | scaine 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 2924 96 | 97 | skewt.py 98 | file 99 | 100 | 101 | 102 | 103 | 2012-03-15T01:06:19.000000Z 104 | a6ed502ee0d65412f640577d830e10e9 105 | 2012-03-14T01:38:45.822261Z 106 | 18 107 | scaine 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 11620 130 | 131 | dbzcalc_ferrier_py.f90 132 | file 133 | 134 | 135 | 136 | 137 | 2012-03-15T01:06:19.000000Z 138 | fe5971237971a972bef946bcc4d984b7 139 | 2012-03-14T01:38:45.822261Z 140 | 18 141 | scaine 142 | has-props 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 14783 164 | 165 | eta_tables_massr.txt 166 | file 167 | 168 | 169 | 170 | 171 | 2012-03-15T01:06:19.000000Z 172 | 9ac0422f395cf43985fda78dc3266bcb 173 | 2012-03-14T01:38:45.822261Z 174 | 18 175 | scaine 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 6015 198 | 199 | coltbls.py 200 | file 201 | 202 | 203 | 204 | 205 | 2012-03-15T01:06:19.000000Z 206 | 6f5a7e1ec0828a46bd9eaa4148e8174b 207 | 2012-03-14T01:46:27.679629Z 208 | 19 209 | scaine 210 | has-props 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 14907 232 | 233 | eta_tables_massi.txt 234 | file 235 | 236 | 237 | 238 | 239 | 2012-03-15T01:06:19.000000Z 240 | 2d44cc7cd62eb8cc1ad11ea243b8b0cc 241 | 2012-03-14T01:38:45.822261Z 242 | 18 243 | scaine 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 14265 266 | 267 | perturbation_variables.py 268 | file 269 | 270 | 271 | 272 | 273 | 2012-03-15T01:06:19.000000Z 274 | 5d75d5b53f7703c10057455c220ae1f6 275 | 2012-03-14T01:38:45.822261Z 276 | 18 277 | scaine 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 743 300 | 301 | -------------------------------------------------------------------------------- /library/.svn/prop-base/coltbls.py.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /library/.svn/prop-base/dbzcalc_ferrier_py.f90.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /library/.svn/text-base/dbzcalc_lin_py.f.svn-base: -------------------------------------------------------------------------------- 1 | subroutine dbzcalc(qvp,qra,qsn,qgr,tmk,prs,dbz,miy,mjx,mkzh, 2 | & in0r,in0s,in0g,iliqskin) 3 | 4 | c this routine expects to be passed the following. 5 | c qvp = water vapor mixing ratio 6 | c qra = rain mixing ratio 7 | c qsn = snow mixing ratio 8 | c qgr = graupel mixing ratio 9 | c tmk = temperature in kelvin (I think) 10 | c prs = pressure 11 | c dbz = input dbz array to store your dbz data (zeros) 12 | c miy = horizontal dimenions (not sure which one) 13 | c mjx = horizontal dimenion (not sure which one) 14 | c mkzh= vertical dimension 15 | c in0r = can be 0 or 1, 1 means use variable intercepts, 0 means use the constants defined below as rn0_x 16 | c in0s = 0 or 1, dont use 1 for the Lin scheme 17 | c in0g = 0 or 1, even though it mentions thompson below, this scheme is not consistant with his assumptions! DO NOT USE WITH THOMPSON 18 | c iliqskin = 1, simulate bright-band effect for frozen particles above 0 degrees (assume they have liquid water on the outside) 19 | 20 | 21 | 22 | c !set up dimensions for our arrays 23 | dimension qra(miy,mjx,mkzh),qvp(miy,mjx,mkzh), 24 | & qsn(miy,mjx,mkzh),qgr(miy,mjx,mkzh),tmk(miy,mjx,mkzh), 25 | & prs(miy,mjx,mkzh),dbz(miy,mjx,mkzh) 26 | 27 | 28 | 29 | c The line below is required to get python to use the fortran code 30 | 31 | Cf2py intent(in,out) dbz(miy,mjx,mkzh) 32 | 33 | character meth*1 34 | 35 | 36 | 37 | c include 'comconst' 38 | c 39 | c Constant intercepts 40 | c 41 | 42 | c in the lin scheme the particle-size drop distrbutions are modelled by a marshall-palmer distribution of the 43 | c form N(x) = rn0_x exp (-lambda_x D) where D is the drop diameter, lambda is the slope of the distrbujtion and 44 | c lambda is defined as ((pi rn0_x rho_x) / (rho_air* q_x))**(1/4) where q_x is the mixing ratio 45 | 46 | c rn0_r= intercept parameter for rain 47 | c rn0_s= intercept parameter for snow 48 | c rn0_g= intercept parameter for graupel 49 | 50 | rn0_r = 8.e6 ! m^-4 51 | c rn0_s = 2.e7 ! m^-4 simon changed for old lin 52 | rn0_s = 3.e6 53 | rn0_g = 4.e6 ! m^-4 54 | c 55 | c Constants used to calculate variable intercepts 56 | c 57 | rhowat=1000. !density of water 58 | pi=4.*atan(1.) !pi 59 | rgas=287.04 !gas constant 60 | r1=1.e-15 !minimum rain threshold value (guessing) 61 | ron=8.e6 62 | ron2=1.e10 63 | son=2.e7 64 | gon=5.e7 65 | ron_min = 8.e6 66 | ron_qr0 = 0.00010 67 | ron_delqr0 = 0.25*ron_qr0 68 | ron_const1r = (ron2-ron_min)*0.5 69 | ron_const2r = (ron2+ron_min)*0.5 70 | c 71 | c Other constants: 72 | c 73 | 74 | c For a particle-drop size distrbution represented by a marshall-palmer distribution 75 | c simulated radar reflectivty can be represented as the 6th moment of the drop size 76 | c distribution which works out to be (Z_ex = equivelent reflectivity factor for x) 77 | c Z_ex = gamma(7) rn0_x lambda_x**-7 78 | c where lambda_x = ((pi rn0_x rho_x) / (rho_air* q_x))**(1/4) 79 | 80 | c substituing lambda_x into Z_e gives 81 | c Z_ex = (720(rho_air q_x)**(7/4))/ ( nr0_x**(3/4) ( pi rho_x) **(7/4)) 82 | 83 | 84 | 85 | gamma_seven = 720. !gamma(7) ! 86 | rho_r = rhowat ! density of water 1000. kg m^-3 87 | rho_s = 100. ! density of snow in kg m^-3 88 | rho_g = 400. ! density of graupel in kg m^-3 89 | alpha = 0.224 ! this factor is used to take into account that ice scatters the radar beam differently to water 90 | 91 | factor_r = gamma_seven * 1.e18 * (1./(pi*rho_r))**1.75 ! 1e18 is to get it to convert to standard reflectivity units. 92 | factor_s = gamma_seven * 1.e18 * (1./(pi*rho_s))**1.75 ! these factors will bs used later, they are just calculated now 93 | & * (rho_s/rhowat)**2 * alpha ! this is only half the relfectivty equation 94 | factor_g = gamma_seven * 1.e18 * (1./(pi*rho_g))**1.75 95 | & * (rho_g/rhowat)**2 * alpha 96 | c 97 | 98 | 99 | 100 | do k=1,mkzh 101 | c do j=1,mjx-1 102 | c do i=1,miy-1 103 | do j=1,mjx 104 | do i=1,miy 105 | 106 | c 107 | c rhoair=prs(i,j,k)*100./ 108 | c & (rgas*virtual(tmk(i,j,k),qvp(i,j,k))) ! air density 109 | 110 | c########################SIMON CHANCE RHOAIR############################# 111 | 112 | rhoair=prs(i,j,k)*100.0/(rgas*(tmk(i,j,k)* !calculate rho air, this should actually be dry air (fix) 113 | & (0.622+qvp(i,j,k))/(0.622*(1.+qvp(i,j,k))))) 114 | 115 | c 116 | c Adjust factor for brightband, where snow or graupel particle 117 | c scatters like liquid water (alpha=1.0) because it is assumed to 118 | c have a liquid skin. 119 | c 120 | if (iliqskin.eq.1.and.tmk(i,j,k).gt.celkel) then 121 | factorb_s=factor_s/alpha 122 | factorb_g=factor_g/alpha 123 | else 124 | factorb_s=factor_s 125 | factorb_g=factor_g 126 | endif 127 | 128 | 129 | c 130 | c Calculate variable intercept parameters if want ed c 131 | c this is stupid, you can calculate the variable as in Thompson et al, but he uses totally different assumptions so you cannot actually apply this algorithm to his data! 132 | 133 | c SKIP TO LINE 172 and below 134 | 135 | if (in0s.eq.1) then ! N_0s as in Thompson et al. 136 | temp_c = amin1(-0.001, tmk(i,j,k)-celkel) 137 | sonv = amin1(2.0e8, 2.0e6*exp(-0.12*temp_c)) 138 | else 139 | sonv = rn0_s 140 | endif 141 | 142 | 143 | 144 | c 145 | if (in0g.eq.1) then ! N_0g as in Thompson et al. 146 | gonv = gon 147 | if (qgr(i,j,k).gt.r1) then 148 | gonv = 2.38*(pi*rho_g/ 149 | + (rhoair*qgr(i,j,k)))**0.92 150 | gonv = max(1.e4, min(gonv,gon)) 151 | endif 152 | else 153 | gonv = rn0_g 154 | endif 155 | 156 | 157 | c 158 | if (in0r.eq.1) then ! N_0r as in Thompson et al. 159 | ronv = ron2 160 | if (qra(i,j,k).gt. r1) then 161 | ronv = ron_const1r*tanh((ron_qr0-qra(i,j,k)) 162 | + /ron_delqr0) + ron_const2r 163 | endif 164 | c if (i.eq.97.and.j.eq.100) then 165 | c print*,'k,ron2,qra(i,j,k),r1,ronv,rn0_r=' 166 | c print*,' ',k,ron2,qra(i,j,k),r1,ronv,rn0_r 167 | c endif 168 | else 169 | ronv = rn0_r 170 | endif 171 | 172 | 173 | c 174 | c Total equivalent reflectivity factor (z_e, in mm^6 m^-3) is 175 | c the sum of z_e for each hydrometeor species: 176 | c 177 | z_e = factor_r * (rhoair*qra(i,j,k))**1.75 / ! rain !this is the second half of the relfectivity equation, using factor_x defined above 178 | & ronv**.75 ! ronv = rn0_r = intercept parameter 179 | & + factorb_s * (rhoair*qsn(i,j,k))**1.75 / ! snow 180 | & sonv**.75 181 | & + factorb_g * (rhoair*qgr(i,j,k))**1.75 / ! graupel 182 | & gonv**.75 183 | 184 | c print * , factor_r 185 | c print * , (rhoair*qra(i,j,k))**1.75 ! rain 186 | c print * , ronv**0.75 187 | 188 | 189 | 190 | 191 | c 192 | c Adjust small values of Z_e so that dBZ is no lower than -20 193 | c 194 | z_e = max(z_e,.01) 195 | 196 | 197 | c 198 | c Convert to dBZ 199 | c 200 | dbz(i,j,k) = 10. * log10(z_e) !convert from dB to dBZ 201 | 202 | 203 | c 204 | enddo 205 | enddo 206 | enddo 207 | c 208 | return 209 | end 210 | -------------------------------------------------------------------------------- /library/.svn/text-base/eta_tables_massi.txt.svn-base: -------------------------------------------------------------------------------- 1 | 7.50197196E-11,7.83764928E-11,8.18111204E-11,8.53237966E-11,8.89151253E-11,9.25857724E-11,9.63360572E-11,1.00166576E-10,1.04078128E-10,1.08070872E-10,1.12145737E-10,1.16303238E-10,1.20543742E-10,1.24868144E-10,1.29276923E-10,1.33770342E-10,1.38349665E-10,1.43015155E-10,1.47767215E-10,1.52606788E-10,1.57534236E-10,1.62550445E-10,1.67655514E-10,1.72850526E-10,1.78136172E-10,1.83512691E-10,1.88980567E-10,1.94541425E-10,2.00195069E-10,2.05942124E-10,2.11783355E-10,2.17719634E-10,2.23750990E-10,2.29878810E-10,2.36102804E-10,2.42424636E-10,2.48844778E-10,2.55362786E-10,2.61980021E-10,2.68697592E-10,2.75515388E-10,2.82434409E-10,2.89455154E-10,2.96578373E-10,3.03804315E-10,3.11134368E-10,3.18567867E-10,3.26107197E-10,3.33752886E-10,3.41504020E-10,3.49361484E-10,3.57326529E-10,3.65400654E-10,3.73582387E-10,3.81874338E-10,3.90276783E-10,3.98788752E-10,4.07413159E-10,4.16148171E-10,4.24996621E-10,4.33958952E-10,4.43033721E-10,4.52223786E-10,4.61529259E-10,4.70950001E-10,4.80487761E-10,4.90139873E-10,4.99912223E-10,5.09802311E-10,5.19810694E-10,5.29940147E-10,5.40188005E-10,5.50557988E-10,5.61049762E-10,5.71662884E-10,5.82397741E-10,5.93257110E-10,6.04239825E-10,6.15347939E-10,6.26579122E-10,6.37938591E-10,6.49422460E-10,6.61034671E-10,6.72774170E-10,6.84640511E-10,6.96636027E-10,7.08762105E-10,7.21017468E-10,7.33403338E-10,7.45920326E-10,7.58569263E-10,7.71350761E-10,7.84264875E-10,7.97308719E-10,8.10490952E-10,8.23807744E-10,8.37259428E-10,8.50847948E-10,8.64571248E-10,8.78431439E-10,8.92429797E-10,9.06566322E-10,9.20841403E-10,9.35255540E-10,9.49810341E-10,9.64503255E-10,9.79337389E-10,9.94315297E-10,1.00943409E-09,1.02469355E-09,1.04009912E-09,1.05564513E-09,1.07133702E-09,1.08717235E-09,1.10315246E-09,1.11927956E-09,1.13555043E-09,1.15196974E-09,1.16853305E-09,1.18524701E-09,1.20210630E-09,1.21911659E-09,1.23627508E-09,1.25358279E-09,1.27104016E-09,1.28864652E-09,1.30639921E-09,1.32430811E-09,1.34236999E-09,1.36058220E-09,1.37894518E-09,1.39746448E-09,1.41613499E-09,1.43495882E-09,1.45393808E-09,1.47307067E-09,1.49235679E-09,1.51180357E-09,1.53140278E-09,1.55115798E-09,1.57106883E-09,1.59113556E-09,1.61136138E-09,1.63174552E-09,1.65228420E-09,1.67298297E-09,1.69384162E-09,1.71485204E-09,1.73602865E-09,1.75736148E-09,1.77885340E-09,1.80050941E-09,1.82232673E-09,1.84429783E-09,1.86643367E-09,1.88872917E-09,1.91118721E-09,1.93381156E-09,1.95659133E-09,1.97953676E-09,2.00264272E-09,2.02590900E-09,2.04934558E-09,2.07294004E-09,2.09669948E-09,2.12061146E-09,2.14469686E-09,2.16895080E-09,2.19336305E-09,2.21794139E-09,2.24268448E-09,2.26760055E-09,2.29267583E-09,2.31791342E-09,2.34331710E-09,2.36889242E-09,2.39462339E-09,2.42052822E-09,2.44659693E-09,2.47283372E-09,2.49923282E-09,2.52580223E-09,2.55253108E-09,2.57943733E-09,2.60650013E-09,2.63373878E-09,2.66113798E-09,2.68870592E-09,2.71644329E-09,2.74435008E-09,2.77242207E-09,2.80065349E-09,2.82906232E-09,2.85763879E-09,2.88637581E-09,2.91528934E-09,2.94436697E-09,2.97361336E-09,3.00302316E-09,3.03259950E-09,3.06235437E-09,3.09227333E-09,3.12235615E-09,3.15260773E-09,3.18303073E-09,3.21361937E-09,3.24437988E-09,3.27530114E-09,3.30639693E-09,3.33765793E-09,3.36908546E-09,3.40068440E-09,3.43245365E-09,3.46437234E-09,3.49647111E-09,3.52874441E-09,3.56118290E-09,3.59378749E-09,3.62656105E-09,3.65949893E-09,3.69261488E-09,3.72588893E-09,3.75934084E-09,3.79294240E-09,3.82673093E-09,3.86067933E-09,3.89479871E-09,3.92907307E-09,3.96352773E-09,3.99814271E-09,4.03292733E-09,4.06787715E-09,4.10299705E-09,4.13828483E-09,4.17373824E-09,4.20935464E-09,4.24514024E-09,4.28109947E-09,4.31721192E-09,4.35349312E-09,4.38994796E-09,4.42656400E-09,4.46334392E-09,4.50029392E-09,4.53740823E-09,4.57469085E-09,4.61213334E-09,4.64973438E-09,4.68750949E-09,4.72546180E-09,4.76356288E-09,4.80182738E-09,4.84026019E-09,4.87886842E-09,4.91762941E-09,4.95654762E-09,4.99563368E-09,5.03489206E-09,5.07430631E-09,5.11388043E-09,5.15363974E-09,5.19353627E-09,5.23360066E-09,5.27383870E-09,5.31423394E-09,5.35480016E-09,5.39550493E-09,5.43639400E-09,5.47742696E-09,5.51863932E-09,5.56000490E-09,5.60152591E-09,5.64322722E-09,5.68502267E-09,5.72703307E-09,5.76921977E-09,5.81153570E-09,5.85402349E-09,5.89667826E-09,5.93948934E-09,5.98245320E-09,6.02557471E-09,6.06886985E-09,6.11231821E-09,6.15591800E-09,6.19968121E-09,6.24360874E-09,6.28769170E-09,6.33192965E-09,6.37631281E-09,6.42085363E-09,6.46559517E-09,6.51045040E-09,6.55545440E-09,6.60063648E-09,6.64597044E-09,6.69146294E-09,6.73712242E-09,6.78290579E-09,6.82887435E-09,6.87497437E-09,6.92125512E-09,6.96767088E-09,7.01423808E-09,7.06097714E-09,7.10786896E-09,7.15489978E-09,7.20209847E-09,7.24944149E-09,7.29693594E-09,7.34460226E-09,7.39239114E-09,7.44033635E-09,7.48844187E-09,7.53670637E-09,7.58512186E-09,7.63367591E-09,7.68239694E-09,7.73126541E-09,7.78026976E-09,7.82943577E-09,7.87874477E-09,7.92821275E-09,7.97783795E-09,8.02760436E-09,8.07751999E-09,8.12757328E-09,8.17778023E-09,8.22814350E-09,8.27864977E-09,8.32929903E-09,8.38010195E-09,8.43104964E-09,8.48215009E-09,8.53338467E-09,8.58477289E-09,8.63632366E-09,8.68800409E-09,8.73982842E-09,8.79180906E-09,8.84392293E-09,8.89618779E-09,8.94858765E-09,9.00114738E-09,9.05384301E-09,9.10669229E-09,9.15967568E-09,9.21272836E-09,9.26602350E-09,9.31942701E-09,9.37298239E-09,9.42667455E-09,9.48055323E-09,9.53452428E-09,9.58864366E-09,9.64292113E-09,9.69733893E-09,9.75188019E-09,9.80658932E-09,9.86142901E-09,9.91637705E-09,9.97150007E-09,1.00267696E-08,1.00821564E-08,1.01377315E-08,1.01933892E-08,1.02492166E-08,1.03051381E-08,1.03612336E-08,1.04174696E-08,1.04738360E-08,1.05303322E-08,1.05869740E-08,1.06437312E-08,1.07006777E-08,1.07577405E-08,1.08149143E-08,1.08722498E-08,1.09297051E-08,1.09873204E-08,1.10450324E-08,1.11028973E-08,1.11609246E-08,1.12190346E-08,1.12773186E-08,1.13357430E-08,1.13943015E-08,1.14529719E-08,1.15117746E-08,1.15707337E-08,1.16297763E-08,1.16889920E-08,1.17483312E-08,1.18077885E-08,1.18674039E-08,1.19271659E-08,1.19870256E-08,1.20470354E-08,1.21071571E-08,1.21674351E-08,1.22277974E-08,1.22883304E-08,1.23489663E-08,1.24098110E-08,1.24707036E-08,1.25317339E-08,1.25928858E-08,1.26541906E-08,1.27156179E-08,1.27771997E-08,1.28389033E-08,1.29007223E-08,1.29626256E-08,1.30246880E-08,1.30869289E-08,1.31492497E-08,1.32117295E-08,1.32742679E-08,1.33370133E-08,1.33998244E-08,1.34627740E-08,1.35258489E-08,1.35890783E-08,1.36524250E-08,1.37158871E-08,1.37794629E-08,1.38431595E-08,1.39070284E-08,1.39709888E-08,1.40350664E-08,1.40992791E-08,1.41636090E-08,1.42280436E-08,1.42926710E-08,1.43573287E-08,1.44221772E-08,1.44871013E-08,1.45522092E-08,1.46173775E-08,1.46827004E-08,1.47481334E-08,1.48136694E-08,1.48792250E-08,1.49449768E-08,1.50108885E-08,1.50769566E-08,1.51431383E-08,1.52094053E-08,1.52757842E-08,1.53423176E-08,1.54089985E-08,1.54756918E-08,1.55425752E-08,1.56095670E-08,1.56767062E-08,1.57439750E-08,1.58113025E-08,1.58787543E-08,1.59463838E-08,1.60140772E-08,1.60818932E-08,1.61498477E-08,1.62179070E-08,1.62860516E-08,1.63543916E-08,1.64227423E-08,1.64912901E-08,1.65599765E-08,1.66287233E-08,1.66975767E-08,1.67665952E-08,1.68356706E-08,1.69049059E-08,1.69742052E-08,1.70436518E-08,1.71132850E-08,1.71828898E-08,1.72526686E-08,1.73225985E-08,1.73926171E-08,1.74627584E-08,1.75330239E-08,1.76033534E-08,1.76738748E-08,1.77444175E-08,1.78151556E-08,1.78859043E-08,1.79568218E-08,1.80278548E-08,1.80989872E-08,1.81703026E-08,1.82416517E-08,1.83130933E-08,1.83847266E-08,1.84563564E-08,1.85282580E-08,1.86001774E-08,1.86721643E-08,1.87443305E-08,1.88165767E-08,1.88889366E-08,1.89614013E-08,1.90340206E-08,1.91066967E-08,1.91794509E-08,1.92523757E-08,1.93254177E-08,1.93985681E-08,1.94717593E-08,1.95451300E-08,1.96185841E-08,1.96921146E-08,1.97657712E-08,1.98395362E-08,1.99134735E-08,1.99874783E-08,2.00615418E-08,2.01357579E-08,2.02100754E-08,2.02844639E-08,2.03589909E-08,2.04336388E-08,2.05083523E-08,2.05832311E-08,2.06581685E-08,2.07331929E-08,2.08083097E-08,2.08836060E-08,2.09589501E-08,2.10344666E-08,2.11100364E-08,2.11856577E-08,2.12614673E-08,2.13373266E-08,2.14133653E-08,2.14894005E-08,2.15656648E-08,2.16419220E-08,2.17183782E-08,2.17948646E-08,2.18714735E-08,2.19481802E-08,2.20250058E-08,2.21019310E-08,2.21790017E-08,2.22560903E-08,2.23332997E-08,2.24106298E-08,2.24880417E-08,2.25655779E-08,2.26432348E-08,2.27209327E-08,2.27988135E-08,2.28767512E-08,2.29547581E-08,2.30329107E-08,2.31111628E-08,2.31895196E-08,2.32679405E-08,2.33465069E-08,2.34251125E-08,2.35038318E-08,2.35826771E-08,2.36616149E-08,2.37403395E-08,2.38194868E-08,2.38987141E-08,2.39780409E-08,2.40574547E-08,2.41369893E-08,2.42166589E-08,2.42963605E-08,2.43762059E-08,2.44561136E-08,2.45360994E-08,2.46162699E-08,2.46964689E-08,2.47768153E-08,2.48572469E-08,2.49377390E-08,2.50183358E-08,2.50990340E-08,2.51798831E-08,2.52607695E-08,2.53417110E-08,2.54228691E-08,2.55040167E-08,2.55852886E-08,2.56667168E-08,2.57481112E-08,2.58297792E-08,2.59114081E-08,2.59931525E-08,2.60750088E-08,2.61569877E-08,2.62390234E-08,2.63211568E-08,2.64033613E-08,2.64856865E-08,2.65682125E-08,2.66506657E-08,2.67332556E-08,2.68160125E-08,2.68988174E-08,2.69817306E-08,2.70647398E-08,2.71477489E-08,2.72309713E-08,2.73142309E-08,2.73975846E-08,2.74811160E-08,2.75646297E-08,2.76482339E-08,2.77319945E-08,2.78158812E-08,2.78997199E-08,2.79837931E-08,2.80678822E-08,2.81520727E-08,2.82363501E-08,2.83207306E-08,2.84051929E-08,2.84898061E-08,2.85745276E-08,2.86591426E-08,2.87440791E-08,2.88290352E-08,2.89140054E-08,2.89991018E-08,2.90843793E-08,2.91696054E-08,2.92549771E-08,2.93404963E-08,2.94260651E-08,2.95116980E-08,2.95974854E-08,2.96833047E-08,2.97692004E-08,2.98552543E-08,2.99414040E-08,3.00275289E-08,3.01138385E-08,3.02002370E-08,3.02866958E-08,3.03732186E-08,3.04599261E-08,3.05466301E-08,3.06334371E-08,3.07203329E-08,3.08073957E-08,3.08943910E-08,3.09817132E-08,3.10688542E-08,3.11562971E-08,3.12436335E-08,3.13312576E-08,3.14188320E-08,3.15065449E-08,3.15942614E-08,3.16822586E-08,3.17701883E-08,3.18582210E-08,3.19464384E-08,3.20345848E-08,3.21229336E-08,3.22112967E-08,3.22998268E-08,3.23884386E-08,3.24770539E-08,3.25657830E-08,3.26546115E-08,3.27435785E-08,3.28326095E-08,3.29216441E-08,3.30108882E-08,3.31001715E-08,3.31895045E-08,3.32789192E-08,3.33684902E-08,3.34581145E-08,3.35477104E-08,3.36375123E-08,3.37274102E-08,3.38173933E-08,3.39073942E-08,3.39975443E-08,3.40877051E-08,3.41780897E-08,3.42684139E-08,3.43588518E-08,3.44494069E-08,3.45400935E-08,3.46308120E-08,3.47215092E-08,3.48124445E-08,3.49034046E-08,3.49944642E-08,3.50855842E-08,3.51768499E-08,3.52680871E-08,3.53595837E-08,3.54510448E-08,3.55425094E-08,3.56341445E-08,3.57259005E-08,3.58176884E-08,3.59095260E-08,3.60015626E-08,3.60935886E-08,3.61857495E-08,3.62780277E-08,3.63702739E-08,3.64626480E-08,3.65551607E-08,3.66477160E-08,3.67403032E-08,3.68329651E-08,3.69258402E-08,3.70186761E-08,3.71116293E-08,3.72046607E-08,3.72977205E-08,3.73910041E-08,3.74842450E-08,3.75776814E-08,3.76703682E-08,3.77639573E-08,3.78575606E-08,3.79512564E-08,3.80450409E-08,3.81388752E-08,3.82328729E-08,3.83267533E-08,3.84208505E-08,3.85151182E-08,3.86094356E-08,3.87036572E-08,3.87980919E-08,3.88926011E-08,3.89872383E-08,3.90818791E-08,3.91766193E-08,3.92714234E-08,3.93664195E-08,3.94613195E-08,3.95563724E-08,3.96515141E-08,3.97467659E-08,3.98420639E-08,3.99374223E-08,4.00328624E-08,4.01284268E-08,4.02240978E-08,4.03197618E-08,4.04156353E-08,4.05114733E-08,4.06073752E-08,4.07033234E-08,4.07993817E-08,4.08955465E-08,4.09917646E-08,4.10881924E-08,4.11846628E-08,4.12810550E-08,4.13776782E-08,4.14742765E-08,4.15709742E-08,4.16678851E-08,4.17647001E-08,4.18617496E-08,4.19587209E-08,4.20557207E-08,4.21529052E-08,4.22501287E-08,4.23475441E-08,4.24449986E-08,4.25424744E-08,4.26400888E-08,4.27377316E-08,4.28354632E-08,4.29332268E-08,4.30311751E-08,4.31292797E-08,4.32273843E-08,4.33253824E-08,4.34234089E-08,4.35216911E-08,4.36200622E-08,4.37185079E-08,4.38170531E-08,4.39156338E-08,4.40143140E-08,4.41130794E-08,4.42118484E-08,4.43107524E-08,4.44097026E-08,4.45087487E-08,4.46078161E-08,4.47070754E-08,4.48064199E-08,4.49057396E-08,4.50051374E-08,4.51045530E-08,4.52040467E-08,4.53037146E-08,4.54034854E-08,4.55032811E-08,4.56031515E-08,4.57031035E-08,4.58031231E-08,4.59032670E-08,4.60034002E-08,4.61036862E-08,4.62040042E-08,4.63043754E-08,4.64048462E-08,4.65054448E-08,4.66060790E-08,4.67067913E-08,4.68075605E-08,4.69084469E-08,4.70093404E-08,4.71103938E-08,4.72114401E-08,4.73126924E-08,4.74137387E-08,4.75150586E-08,4.76164246E-08,4.77178190E-08,4.78193947E-08,4.79209312E-08,4.80226809E-08,4.81243667E-08,4.82261662E-08,4.83281113E-08,4.84300671E-08,4.85320300E-08,4.86341669E-08,4.87363003E-08,4.88385652E-08,4.89409544E-08,4.90433720E-08,4.91458678E-08,4.92483352E-08,4.93510228E-08,4.94537318E-08,4.95564336E-08,4.96594197E-08,4.97622779E-08,4.98652071E-08,4.99683601E-08,5.00714066E-08,5.01746342E-08,5.02779756E-08,5.03812707E-08,5.04847648E-08,5.05881914E-08,5.06917814E-08,5.07954745E-08,5.08992315E-08,5.10029885E-08,5.11068698E-08,5.12107832E-08,5.13148741E-08,5.14188194E-08,5.15230276E-08,5.16273708E-08,5.17316003E-08,5.18360181E-08,5.19404360E-08,5.20449603E-08,5.21495522E-08,5.22541583E-08,5.23589989E-08,5.24637898E-08,5.25687369E-08,5.26736486E-08,5.27786028E-08,5.28837454E-08,5.29888702E-08,5.30941335E-08,5.31994182E-08,5.33047420E-08,5.34101687E-08,5.35157660E-08,5.36212710E-08,5.37269429E-08,5.38326823E-08,5.39384928E-08,5.40444276E-08,5.41502843E-08,5.42564003E-08,5.43624346E-08,5.44685967E-08,5.45748691E-08,5.46811840E-08,5.47874706E-08,5.48938921E-08,5.50003989E-08,5.51070833E-08,5.52139028E-08,5.53205091E-08,5.54273356E-08,5.55340556E-08,5.56410811E-08,5.57480604E-08,5.58551925E-08,5.59622535E-08,5.60694531E-08,5.61767308E-08,5.62840796E-08,5.63915385E-08,5.64990223E-08,5.66067193E-08,5.67142173E-08,5.68220280E-08,5.69297391E-08,5.70377239E-08,5.71455487E-08,5.72535939E-08,5.73616248E-08,5.74697090E-08,5.75779460E-08,5.76861510E-08,5.77945052E-08,5.79028949E-08,5.80113202E-08,5.81198840E-08,5.82284549E-08,5.83371786E-08,5.84459627E-08,5.85548712E-08,5.86637157E-08,5.87726028E-08,5.88816640E-08,5.89907074E-08,5.90985927E-08,5.92076574E-08,5.93170029E-08,5.94263874E-08,5.95358181E-08,5.96455081E-08,5.97550596E-08,5.98646963E-08,5.99743828E-08,6.00841688E-08,6.01940329E-08,6.03038899E-08,6.04139103E-08,6.05239947E-08,6.06341573E-08 2 | -------------------------------------------------------------------------------- /library/.svn/text-base/eta_tables_massr.txt.svn-base: -------------------------------------------------------------------------------- 1 | 1.92740585E-14,2.08871413E-14,2.25984562E-14,2.44117945E-14,2.63311965E-14,2.83606231E-14,3.05042043E-14,3.27660940E-14,3.51506645E-14,3.76621443E-14,4.03049447E-14,4.30835245E-14,4.60025525E-14,4.90666637E-14,5.22802593E-14,5.56485366E-14,5.91760460E-14,6.28679915E-14,6.67292285E-14,7.07647984E-14,7.49800002E-14,7.93800857E-14,8.39701843E-14,8.87558256E-14,9.37424847E-14,9.89353388E-14,1.04340710E-13,1.09963776E-13,1.15810397E-13,1.21886320E-13,1.28197705E-13,1.34750297E-13,1.41550481E-13,1.48604246E-13,1.55917583E-13,1.63497362E-13,1.71349046E-13,1.79479980E-13,1.87896099E-13,1.96604329E-13,2.05611176E-13,2.14923565E-13,2.24547960E-13,2.34491408E-13,2.44761215E-13,2.55364143E-13,2.66306915E-13,2.77597390E-13,2.89242642E-13,3.01250642E-13,3.13627190E-13,3.26382042E-13,3.39520268E-13,3.53051166E-13,3.66982188E-13,3.81320951E-13,3.96075777E-13,4.11253171E-13,4.26862484E-13,4.42912037E-13,4.59410017E-13,4.76362222E-13,4.93780689E-13,5.11671489E-13,5.30043674E-13,5.48906244E-13,5.68267872E-13,5.88136636E-13,6.08519637E-13,6.29429234E-13,6.50871447E-13,6.72858253E-13,6.95395835E-13,7.18494491E-13,7.42164576E-13,7.66414167E-13,7.91253077E-13,8.16689435E-13,8.42733706E-13,8.69397057E-13,8.96686696E-13,9.24613142E-13,9.53184580E-13,9.82415646E-13,1.01231404E-12,1.04288843E-12,1.07415086E-12,1.10610978E-12,1.13877668E-12,1.17216209E-12,1.20627640E-12,1.24112699E-12,1.27673078E-12,1.31309210E-12,1.35022245E-12,1.38813668E-12,1.42684562E-12,1.46635492E-12,1.50668041E-12,1.54783261E-12,1.58982127E-12,1.63265571E-12,1.67635198E-12,1.72091735E-12,1.76636830E-12,1.81271350E-12,1.85996249E-12,1.90812427E-12,1.95721629E-12,2.00725569E-12,2.05824572E-12,2.11020069E-12,2.16313534E-12,2.21705575E-12,2.27197948E-12,2.32791997E-12,2.38488005E-12,2.44288487E-12,2.50193269E-12,2.56205452E-12,2.62325058E-12,2.68553734E-12,2.74892500E-12,2.81342918E-12,2.87905420E-12,2.94582826E-12,3.01375504E-12,3.08284778E-12,3.15312251E-12,3.22459290E-12,3.29727044E-12,3.37117031E-12,3.44630401E-12,3.52268952E-12,3.60033834E-12,3.67925395E-12,3.75945238E-12,3.84097138E-12,3.92379792E-12,4.00796800E-12,4.09347859E-12,4.18035745E-12,4.26860804E-12,4.35824467E-12,4.44929033E-12,4.54175239E-12,4.63564170E-12,4.73099164E-12,4.82779702E-12,4.92608732E-12,5.02586124E-12,5.12714827E-12,5.22995926E-12,5.33431676E-12,5.44022292E-12,5.54768514E-12,5.65674721E-12,5.76739004E-12,5.87966611E-12,5.99357066E-12,6.10911755E-12,6.22632935E-12,6.34520821E-12,6.46579188E-12,6.58808988E-12,6.71211090E-12,6.83787532E-12,6.96539181E-12,7.09468638E-12,7.22578161E-12,7.35867790E-12,7.49335143E-12,7.62992620E-12,7.76833025E-12,7.90863382E-12,8.05081869E-12,8.19490049E-12,8.34092431E-12,8.48890836E-12,8.63881969E-12,8.79071382E-12,8.94461154E-12,9.10051721E-12,9.25844644E-12,9.41845386E-12,9.58049265E-12,9.74462178E-12,9.91083951E-12,1.00791875E-11,1.02496700E-11,1.04222776E-11,1.05971091E-11,1.07740639E-11,1.09532999E-11,1.11347312E-11,1.13184054E-11,1.15043391E-11,1.16925454E-11,1.18830857E-11,1.20758898E-11,1.22711008E-11,1.24686225E-11,1.26685173E-11,1.28708190E-11,1.30755589E-11,1.32826727E-11,1.34922724E-11,1.37043337E-11,1.39188982E-11,1.41359641E-11,1.43555549E-11,1.45777019E-11,1.48023972E-11,1.50295956E-11,1.52595436E-11,1.54920243E-11,1.57272320E-11,1.59650973E-11,1.62056757E-11,1.64488301E-11,1.66948226E-11,1.69435473E-11,1.71950683E-11,1.74493059E-11,1.77064179E-11,1.79663194E-11,1.82290814E-11,1.84947370E-11,1.87632548E-11,1.90346783E-11,1.93091151E-11,1.95864523E-11,1.98667974E-11,2.01500986E-11,2.04363922E-11,2.07257718E-11,2.10181976E-11,2.13137286E-11,2.16123629E-11,2.19140851E-11,2.22189819E-11,2.25270375E-11,2.28383163E-11,2.31528147E-11,2.34705068E-11,2.37914671E-11,2.41157528E-11,2.44432530E-11,2.47741515E-11,2.51084240E-11,2.54459925E-11,2.57869837E-11,2.61313523E-11,2.64792667E-11,2.68305499E-11,2.71853477E-11,2.75435681E-11,2.79054592E-11,2.82708093E-11,2.86398006E-11,2.90123498E-11,2.93885818E-11,2.97681567E-11,3.01516208E-11,3.05388180E-11,3.09296720E-11,3.13242939E-11,3.17228327E-11,3.21249728E-11,3.25309744E-11,3.29408271E-11,3.33545171E-11,3.37721587E-11,3.41936687E-11,3.46189362E-11,3.50484919E-11,3.54817911E-11,3.59192086E-11,3.63606437E-11,3.68060270E-11,3.72556153E-11,3.77092385E-11,3.81670771E-11,3.86289195E-11,3.90951230E-11,3.95654551E-11,4.00400615E-11,4.05188626E-11,4.10019414E-11,4.14892495E-11,4.19810887E-11,4.24770670E-11,4.29776006E-11,4.34825335E-11,4.39917790E-11,4.45055520E-11,4.50237798E-11,4.55467712E-11,4.60739225E-11,4.66058650E-11,4.71422658E-11,4.76834648E-11,4.82292227E-11,4.87796019E-11,4.93347134E-11,4.98945087E-11,5.04591785E-11,5.10284662E-11,5.16025937E-11,5.21816305E-11,5.27655315E-11,5.33542446E-11,5.39479225E-11,5.45465270E-11,5.51499332E-11,5.57585852E-11,5.63721674E-11,5.69908253E-11,5.76144722E-11,5.82432852E-11,5.88772711E-11,5.95163363E-11,6.01600436E-11,6.08096420E-11,6.14644169E-11,6.21243196E-11,6.27897109E-11,6.34604591E-11,6.41364045E-11,6.48178594E-11,6.55046503E-11,6.61969368E-11,6.68946495E-11,6.75979758E-11,6.83065896E-11,6.90210666E-11,6.97409977E-11,7.04665493E-11,7.11977075E-11,7.19345347E-11,7.26771074E-11,7.34253561E-11,7.41793432E-11,7.49394019E-11,7.57048313E-11,7.64765681E-11,7.72537936E-11,7.80372086E-11,7.88264246E-11,7.96216010E-11,8.04228975E-11,8.12300990E-11,8.20435872E-11,8.28630983E-11,8.36885700E-11,8.45200854E-11,8.53579984E-11,8.62020316E-11,8.70523584E-11,8.79089510E-11,8.87718093E-11,8.96412805E-11,9.05169550E-11,9.13987427E-11,9.22872959E-11,9.31822952E-11,9.40836159E-11,9.49916257E-11,9.59061303E-11,9.68272199E-11,9.77549083E-11,9.86890639E-11,9.96303942E-11,1.00578011E-10,1.01532366E-10,1.02493722E-10,1.03461968E-10,1.04436911E-10,1.05418570E-10,1.06407085E-10,1.07402712E-10,1.08405396E-10,1.09415095E-10,1.10431768E-10,1.11455484E-10,1.12486152E-10,1.13524225E-10,1.14569326E-10,1.15621589E-10,1.16681123E-10,1.17747881E-10,1.18822133E-10,1.19902310E-10,1.20990759E-10,1.22087160E-10,1.23190846E-10,1.24302055E-10,1.25420480E-10,1.26546731E-10,1.27680033E-10,1.28821689E-10 2 | -------------------------------------------------------------------------------- /library/.svn/text-base/perturbation_variables.py.svn-base: -------------------------------------------------------------------------------- 1 | #module: pertibation_variables 2 | 3 | pert_variable_dict={} 4 | pert_variable_dict.update({'GEOP':('PH','PHB')}) 5 | pert_variable_dict.update({'Z':('PH','PHB')}) 6 | 7 | #pert_variable_dict.update({'T':('T',300.)}) 8 | pert_variable_dict.update({'THETA':('T',300.)}) 9 | 10 | #pert_variable_dict.update({'P':('P','PB')}) 11 | pert_variable_dict.update({'PRES':('P','PB')}) 12 | 13 | 14 | 15 | calc_variable_dict={} 16 | #calc_variable_dict.update({'TK':('PRES','T')}) 17 | calc_variable_dict.update({'TEMP':('PRES','THETA')}) 18 | 19 | calc_variable_dict.update({'RH':('QVAPOR','PRES','TEMP')}) 20 | 21 | calc_variable_dict.update({'TD':('QVAPOR','PRES')}) 22 | 23 | calc_variable_dict.update({'PRES':''}) #used to divide by 100. to get into mb 24 | 25 | calc_variable_dict.update({'Z':''}) # 26 | 27 | calc_variable_dict.update({'SPH':('QVAPOR',)}) 28 | -------------------------------------------------------------------------------- /library/.svn/text-base/skewt.py.svn-base: -------------------------------------------------------------------------------- 1 | #Copyright (c) 2008 Ryan May 2 | 3 | #Permission is hereby granted, free of charge, to any person obtaining a copy 4 | #of this software and associated documentation files (the "Software"), to deal 5 | #in the Software without restriction, including without limitation the rights 6 | #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | #copies of the Software, and to permit persons to whom the Software is 8 | #furnished to do so, subject to the following conditions: 9 | 10 | #The above copyright notice and this permission notice shall be included in 11 | #all copies or substantial portions of the Software. 12 | 13 | #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | #THE SOFTWARE. 20 | 21 | from matplotlib.axes import Axes 22 | from matplotlib.lines import Line2D 23 | from matplotlib.collections import LineCollection 24 | from matplotlib.ticker import FixedLocator, AutoLocator, ScalarFormatter 25 | import matplotlib.transforms as transforms 26 | import matplotlib.axis as maxis 27 | import matplotlib.artist as artist 28 | from matplotlib.projections import register_projection 29 | 30 | import numpy as np 31 | 32 | import pylab 33 | 34 | import matplotlib.pyplot as plt 35 | 36 | #TODO: 37 | # *Panning and zooming are horribly broken, probably because the 38 | # skewed data are used as bounds. Needs to be disabled (especially panning) 39 | # or updated to work sensibly 40 | # *How do we automatically pick appropriate limits so that all relevant 41 | # slanted gridlines are added? 42 | # *How do we get the labels we want at the top? 43 | # *Set good aspect ratio, at least by default 44 | # - set_aspect(1/11.17, adjustable='datalim') would seem to do what I want 45 | # except that when I resize the figure, there's a lot of jumping around 46 | # Might be related to panning/zooming problems 47 | # *New functions/methods needed to add the various significant lines: 48 | # -Moist adiabats: ThetaE (HOW THE HECK DOES IT WORK?) 49 | # *Combine skewT plot with separate subplot for vertical wind plot using 50 | # barbs? 51 | 52 | class SkewXTick(maxis.XTick): 53 | def draw(self, renderer): 54 | if not self.get_visible(): return 55 | renderer.open_group(self.__name__) 56 | 57 | if self.gridOn: 58 | self.gridline.draw(renderer) 59 | if self.tick1On: 60 | self.tick1line.draw(renderer) 61 | if self.tick2On: 62 | self.tick2line.draw(renderer) 63 | 64 | if self.label1On: 65 | self.label1.draw(renderer) 66 | if self.label2On: 67 | self.label2.draw(renderer) 68 | 69 | renderer.close_group(self.__name__) 70 | 71 | def set_clip_path(self, clippath, transform=None): 72 | artist.Artist.set_clip_path(self, clippath, transform) 73 | self.tick1line.set_clip_path(clippath, transform) 74 | self.tick2line.set_clip_path(clippath, transform) 75 | self.gridline.set_clip_path(clippath, transform) 76 | set_clip_path.__doc__ = artist.Artist.set_clip_path.__doc__ 77 | 78 | class SkewXAxis(maxis.XAxis): 79 | def _get_tick(self, major): 80 | return SkewXTick(self.axes, 0, '', major=major) 81 | 82 | def draw(self, renderer, *args, **kwargs): 83 | 'Draw the axis lines, grid lines, tick lines and labels' 84 | ticklabelBoxes = [] 85 | ticklabelBoxes2 = [] 86 | 87 | if not self.get_visible(): return 88 | renderer.open_group(__name__) 89 | interval = self.get_view_interval() 90 | for tick, loc, label in self.iter_ticks(): 91 | if tick is None: continue 92 | if transforms.interval_contains(interval, loc): 93 | tick.set_label1(label) 94 | tick.set_label2(label) 95 | tick.update_position(loc) 96 | tick.draw(renderer) 97 | if tick.label1On and tick.label1.get_visible(): 98 | extent = tick.label1.get_window_extent(renderer) 99 | ticklabelBoxes.append(extent) 100 | if tick.label2On and tick.label2.get_visible(): 101 | extent = tick.label2.get_window_extent(renderer) 102 | ticklabelBoxes2.append(extent) 103 | 104 | # scale up the axis label box to also find the neighbors, not 105 | # just the tick labels that actually overlap note we need a 106 | # *copy* of the axis label box because we don't wan't to scale 107 | # the actual bbox 108 | 109 | self._update_label_position(ticklabelBoxes, ticklabelBoxes2) 110 | 111 | self.label.draw(renderer) 112 | 113 | self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2) 114 | self.offsetText.set_text( self.major.formatter.get_offset() ) 115 | self.offsetText.draw(renderer) 116 | 117 | class SkewXAxes(Axes): 118 | # The projection must specify a name. This will be used be the 119 | # user to select the projection, i.e. ``subplot(111, 120 | # projection='skewx')``. 121 | name = 'skewx' 122 | 123 | def _init_axis(self): 124 | #Taken from Axes and modified to use our modified X-axis 125 | "move this out of __init__ because non-separable axes don't use it" 126 | self.xaxis = SkewXAxis(self) 127 | self.yaxis = maxis.YAxis(self) 128 | self._update_transScale() 129 | 130 | # def get_axes_patch(self): 131 | # """ 132 | # Override this method to define the shape that is used for the 133 | # background of the plot. It should be a subclass of Patch. 134 | 135 | # In this case, it is a Circle (that may be warped by the axes 136 | # transform into an ellipse). Any data and gridlines will be 137 | # clipped to this shape. 138 | # """ 139 | # return Circle((0.5, 0.5), 0.5) 140 | 141 | def draw(self, *args): 142 | ''' 143 | draw() is overridden here to allow the data transform to be updated 144 | before calling the Axes.draw() method. This allows resizes to be 145 | properly handled without registering callbacks. The amount of 146 | work done here is kept to a minimum. 147 | ''' 148 | self._update_data_transform() 149 | Axes.draw(self, *args) 150 | 151 | def _update_data_transform(self): 152 | ''' 153 | This separates out the creating of the data transform so that 154 | it alone is updated at draw time. 155 | ''' 156 | # This transforms x in pixel space to be x + the offset in y from 157 | # the lower left corner - producing an x-axis sloped 45 degrees 158 | # down, or x-axis grid lines sloped 45 degrees to the right 159 | self.transProjection.set(transforms.Affine2D( 160 | np.array([[1, 1, -self.bbox.ymin], [0, 1, 0], [0, 0, 1]]))) 161 | 162 | # Full data transform 163 | self.transData.set(self._transDataNonskew + self.transProjection) 164 | 165 | def _set_lim_and_transforms(self): 166 | """ 167 | This is called once when the plot is created to set up all the 168 | transforms for the data, text and grids. 169 | """ 170 | #Get the standard transform setup from the Axes base class 171 | Axes._set_lim_and_transforms(self) 172 | 173 | #Save the unskewed data transform for our own use when regenerating 174 | #the data transform. The user might want this as well 175 | self._transDataNonskew = self.transData 176 | 177 | #Create a wrapper for the data transform, so that any object that 178 | #grabs this transform will see an updated version when we change it 179 | self.transData = transforms.TransformWrapper( 180 | transforms.IdentityTransform()) 181 | 182 | #Create a wrapper for the proj. transform, so that any object that 183 | #grabs this transform will see an updated version when we change it 184 | self.transProjection = transforms.TransformWrapper( 185 | transforms.IdentityTransform()) 186 | self._update_data_transform() 187 | 188 | def get_xaxis_transform(self, which='grid'): 189 | """ 190 | Get the transformation used for drawing x-axis labels, ticks 191 | and gridlines. The x-direction is in data coordinates and the 192 | y-direction is in axis coordinates. 193 | 194 | We override here so that the x-axis gridlines get properly 195 | transformed for the skewed plot. 196 | """ 197 | return self._xaxis_transform + self.transProjection 198 | 199 | # Disable panning until we find a way to handle the problem with 200 | # the projection 201 | def start_pan(self, x, y, button): 202 | pass 203 | 204 | def end_pan(self): 205 | pass 206 | 207 | def drag_pan(self, button, key, x, y): 208 | pass 209 | 210 | # Now register the projection with matplotlib so the user can select 211 | # it. 212 | register_projection(SkewXAxes) 213 | 214 | def draw_skewt(p, h, T, Td, u, v, imagename, title = None, show = False): 215 | ''' 216 | If you want to plot a skewt, skewt.draw_skewt 217 | 218 | 219 | Inputs: 220 | p -> 1d numpy array, pressure in Pa/100.0 (hPa) 221 | h -> 1d numpy array, height in m 222 | t -> 1d numpy array, temp in C 223 | td -> 1d numpy array, dew pt temp in C 224 | imagename -> string, the name you want to call the image ... i.e. louise.png 225 | 226 | Optional Inputs: 227 | title -> string, obvious really 228 | show -> True/False, if True will open and show plot, if false, will just save to image file. 229 | 230 | Example usage: 231 | skewt.draw_skewt(p/100.0 (Grrr), h, t (C), td (C), 'louse.png', title = 'woo.png', show = False) 232 | 233 | ''' 234 | 235 | # print "repr(p)" 236 | # print repr(p) 237 | # print "repr(h)" 238 | # print repr(h) 239 | # print "repr(T)" 240 | # print repr(T) 241 | # print "repr(Td)" 242 | # print repr(Td) 243 | # 244 | plt.rcParams.update({'axes.linewidth':1,'ytick.color':'k'}) 245 | 246 | fig = plt.figure(1, figsize=(6.5875, 6.2125)) 247 | fig.clf() 248 | 249 | ax = fig.add_axes([.125,.1,.7,.8], projection='skewx') 250 | 251 | ax.grid(True) 252 | 253 | ax.semilogy(T, p, 'r') 254 | ax.semilogy(Td, p, 'g') 255 | 256 | xticklocs=np.arange(-80,45,10) 257 | 258 | # T0 = ax.get_xticks() 259 | T0 = xticklocs 260 | P0 = 1000. 261 | R = 287.05 262 | Cp = 1004. 263 | P = np.linspace(*ax.get_ylim()).reshape(1, -1) 264 | 265 | T = (T0[:,np.newaxis] + 273.15) * (P/P0)**(R/Cp) - 273.15 266 | linedata = [np.vstack((t[np.newaxis,:], P)).T for t in T] 267 | dry_adiabats = LineCollection(linedata, colors='r', linestyles='dashed', 268 | alpha=0.5) 269 | ax.add_collection(dry_adiabats) 270 | 271 | w = np.array([0.0004,0.001, 0.002, 0.004, 0.007, 0.01, 0.016, 0.024, 272 | 0.032]).reshape(-1, 1) 273 | e = P * w / (0.622 + w) 274 | T = 243.5/(17.67/np.log(e/6.112) - 1) 275 | linedata = [np.vstack((t[np.newaxis,:], P)).T for t in T] 276 | mixing = LineCollection(linedata, colors='g', linestyles='dashed', 277 | alpha=0.8) 278 | ax.add_collection(mixing) 279 | 280 | # Lv = 2.4e6 281 | # T = T[:,0][:,np.newaxis] * (P/P0)**(R/Cp) - (Lv/Cp) * w 282 | # linedata = [np.vstack((t[np.newaxis,:], P)).T for t in T] 283 | # moist_adiabat = LineCollection(linedata, colors='b', linestyles='dashed', 284 | # alpha=0.8) 285 | # ax.add_collection(moist_adiabat) 286 | 287 | 288 | ax.set_ylabel('Pressure (hPa)') 289 | ax.set_xlabel('Temperature (C)') 290 | if isinstance(title, str): 291 | ax.title.set_text(title) 292 | 293 | # change plotting parameters : white box, white tick labels 294 | plt.rcParams.update({'axes.linewidth':0,'ytick.color':'k', 'ytick.major.size':0, 'ytick.minor.size':0}) 295 | #plt.rcParams.update({'axes.linewidth':0,'ytick.color':'w', 'ytick.major.size':0, 'ytick.minor.size':0}) #simon changed 296 | 297 | wbax=fig.add_axes([0.85,0.1,0.125,0.8],sharey=ax) 298 | wbax.barbs(np.zeros(p.shape)[::2], p[::2], u[::2], v[::2]) 299 | 300 | wbax.xaxis.set_ticks([],[]) 301 | for tick in wbax.yaxis.get_major_ticks(): 302 | tick.label1On = False 303 | 304 | ax.set_yticks(np.linspace(100,1000,10)) 305 | ax.yaxis.set_major_formatter(ScalarFormatter()) 306 | ax.set_xticks(xticklocs) 307 | ax.set_xlim(-40,45) 308 | ax.set_ylim(1050,100) 309 | 310 | pylab.savefig(imagename) 311 | 312 | # if show: 313 | plt.draw() 314 | #plt.show() 315 | -------------------------------------------------------------------------------- /library/.svn/text-base/wrf_user_unstagger.py.svn-base: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as n 3 | 4 | 5 | def wrf_user_unstagger (varin, unstagDim): 6 | dims =() 7 | dims = n.shape(varin) 8 | nd = n.shape(dims)[0] 9 | 10 | if ( unstagDim == "X") | (unstagDim == "U" ): 11 | dimU = dims[nd-1] 12 | if ( nd == 5 ): 13 | #varout = 0.5*(varin[:,:,:,:,:dimU-2] + varin[:,:,:,:,1:dimU-1]) #python indexing appears to work differently than ncl, 1 less 14 | varout = 0.5*(varin[:,:,:,:,:dimU-2] + varin[:,:,:,:,1:dimU-0]) 15 | 16 | if ( nd == 4 ): 17 | #varout = 0.5*(varin[:,:,:,:dimU-2] + varin[:,:,:,1:dimU-1]) 18 | varout = 0.5*(varin[:,:,:,:dimU-1] + varin[:,:,:,1:dimU-0]) 19 | 20 | if ( nd == 3 ): 21 | #varout = 0.5*(varin[:,:,:dimU-2] + varin[:,:,1:dimU-1]) 22 | varout = 0.5*(varin[:,:,:dimU-1] + varin[:,:,1:dimU-0]) 23 | 24 | if ( nd == 2 ): 25 | #varout = 0.5*(varin[:,:dimU-2] + varin[:,1:dimU-1]) 26 | varout = 0.5*(varin[:,:dimU-1] + varin[:,1:dimU-0]) 27 | 28 | # do i = 0,nd-2 29 | # varout!i = varin!i 30 | # end do 31 | # i = nd-1 32 | # varout!i = "west_east" 33 | # copy_VarAtts(varin,varout) 34 | # varout@coordinates = "XLONG XLAT" 35 | # varout@stagger = " " 36 | # 37 | 38 | if ( unstagDim == "Y") | (unstagDim == "V" ): 39 | dimV = dims[nd-2] 40 | if ( nd == 5 ): 41 | #varout = 0.5*(varin[:,:,:,:dimV-2,:]+varin[:,:,:,1:dimV-1,:]) #python indexing appears to work differently than ncl, 1 less 42 | varout = 0.5*(varin[:,:,:,:dimV-1,:]+varin[:,:,:,1:dimV-0,:]) 43 | 44 | if ( nd == 4 ): 45 | #varout = 0.5*(varin[:,:,:dimV-2,:]+varin[:,:,1:dimV-1,:]) 46 | varout = 0.5*(varin[:,:,:dimV-1,:]+varin[:,:,1:dimV-0,:]) 47 | 48 | if ( nd == 3 ): 49 | #varout = 0.5*(varin[:,:dimV-2,:]+varin[:,1:dimV-1,:]) 50 | varout = 0.5*(varin[:,:dimV-1,:]+varin[:,1:dimV-0,:]) 51 | 52 | if ( nd == 2 ): 53 | #varout = 0.5*(varin[:dimV-2,:]+varin[1:dimV-1,:]) 54 | varout = 0.5*(varin[:dimV-1,:]+varin[1:dimV-0,:]) 55 | 56 | # do i = 0,nd-1 57 | # varout!i = varin!i 58 | # end do 59 | # i = nd-2 60 | # varout!i = "south_north" 61 | # copy_VarAtts(varin,varout) 62 | # varout@coordinates = "XLONG XLAT" 63 | # varout@stagger = " " 64 | 65 | 66 | if ( unstagDim == "Z" ): 67 | dimW = dims[nd-3] 68 | if ( nd == 5 ): 69 | #varout = 0.5*(varin[:,:,0:dimW-2,:,:]+varin[:,:,1:dimW-1,:,:]) 70 | varout = 0.5*(varin[:,:,0:dimW-1,:,:]+varin[:,:,1:dimW-0,:,:]) 71 | 72 | if ( nd == 4 ): 73 | #varout = 0.5*(varin[:,0:dimW-2,:,:]+varin[:,1:dimW-1,:,:]) 74 | varout = 0.5*(varin[:,0:dimW-1,:,:]+varin[:,1:dimW-0,:,:]) 75 | 76 | if ( nd == 3 ): 77 | #varout = 0.5*(varin[0:dimW-2,:,:]+varin[1:dimW-1,:,:]) 78 | varout = 0.5*(varin[0:dimW-1,:,:]+varin[1:dimW-0,:,:]) 79 | 80 | # do i = 0,nd-1 81 | # varout!i = varin!i 82 | # end do 83 | # i = nd-3 84 | # varout!i = "bottom_top" 85 | # copy_VarAtts(varin,varout) 86 | # varout@coordinates = "XLONG XLAT" 87 | # varout@stagger = " " 88 | 89 | if ( unstagDim == "M" ): 90 | print 'staggared dim is "M", no support for this yet' 91 | varout = varin 92 | 93 | 94 | 95 | 96 | 97 | for ele in ["X","U","Y","V","Z", "M"]: 98 | if (unstagDim == ele): 99 | return varout 100 | 101 | # if( any( unstagDim == ["X","U","Y","V","Z"] ) ): 102 | # return varout 103 | # else: 104 | # print "Warning: Input field was not unstaggered" 105 | # return varin 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /library/cython_commands.txt: -------------------------------------------------------------------------------- 1 | cython wrf_user_unstagger.pyx 2 | gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/home/Operator/anaconda3/envs/basemap/include/python3.6m/ -o wrf_user_unstagger.so wrf_user_unstagger.c 3 | -------------------------------------------------------------------------------- /library/dbzcalc_ferrier_py.f90: -------------------------------------------------------------------------------- 1 | SUBROUTINE CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL, & 2 | QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1, & 3 | NLICE1,NSDIM,WEDIM,MASSR,MASSI,im,jm) 4 | ! 5 | ! 6 | ! 7 | !To compile for python: 8 | ! 9 | ! f2py -c -m --f77flags="-fconvert=big-endian" --f90flags="-fconvert=big-endian" 10 | ! dbzcalc_ferrier_py dbzcalc_ferrier_py.f90 --fcompiler=gfortran 11 | ! 12 | !If successfull will create a *.so file which python can call. 13 | ! 14 | ! 15 | ! 16 | !$$$ SUBPROGRAM DOCUMENTATION BLOCK 17 | ! . . . 18 | ! SUBPROGRAM: CALMIC COMPUTES HYDROMETEORS 19 | ! PRGRMMR: JIN ORG: W/NP2 DATE: 01-08-14 20 | ! 21 | ! ABSTRACT: 22 | ! THIS ROUTINE COMPUTES THE MIXING RATIOS OF CLOUD WATER, 23 | ! CLOUD ICE, RAIN, AND SNOW. THE CODE IS BASED ON SUBROUTINES 24 | ! GSMDRIVE & GSMCOLUMN IN THE NMM MODEL. 25 | ! 26 | ! PROGRAM HISTORY LOG: 27 | ! 01-08-14 YI JIN 28 | ! 02-02-11 Brad Ferrier - Minor changes for consistency w/ NMM model 29 | ! 04-11-10 Brad Ferrier - Removed cloud fraction algorithm 30 | ! 04-11-17 H CHUANG - WRF VERSION 31 | ! USAGE: CALL CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL 32 | ! &, QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1) 33 | ! INPUT ARGUMENT LIST: 34 | ! P1D - PRESSURE (PA) 35 | ! T1D - TEMPERATURE (K) 36 | ! Q1D - SPECIFIC HUMIDITY (KG/KG) 37 | ! C1D - TOTAL CONDENSATE (CWM, KG/KG) 38 | ! FI1D - F_ice (fraction of condensate in form of ice) 39 | ! FR1D - F_rain (fraction of liquid water in form of rain) 40 | ! FS1D - F_RimeF ("Rime Factor", ratio of total ice growth 41 | ! to deposition growth) 42 | ! CUREFL - Radar reflectivity contribution from convection (mm**6/m**3) 43 | ! NOTE: when the grid size is small cumulus parameterisation is 44 | ! usually turned off and so this will be zero 45 | ! 46 | ! OUTPUT ARGUMENT LIST: 47 | ! QW1 - CLOUD WATER MIXING RATIO (KG/KG) 48 | ! QI1 - CLOUD ICE MIXING RATIO (KG/KG) 49 | ! QR1 - RAIN MIXING RATIO (KG/KG) 50 | ! QS1 - "SNOW" (precipitation ice) MIXING RATIO (KG/KG) 51 | ! DBZ1 - Equivalent radar reflectivity factor in dBZ; i.e., 10*LOG10(Z) 52 | ! DBZR - Equivalent radar reflectivity factor from rain in dBZ 53 | ! DBZI - Equivalent radar reflectivity factor from ice (all forms) in dBZ 54 | ! DBZC - Equivalent radar reflectivity factor from parameterized convection in dBZ 55 | ! 56 | ! OUTPUT FILES: 57 | ! NONE 58 | ! 59 | ! SUBPROGRAMS CALLED: 60 | ! FUNCTIONS: 61 | ! FPVS 62 | ! UTILITIES: 63 | ! LIBRARY: 64 | ! NONE 65 | ! 66 | ! ATTRIBUTES: 67 | ! LANGUAGE: FORTRAN 68 | ! MACHINE : IBM SP 69 | !$$$ 70 | ! 71 | !BSF: skip use params_mod 72 | 73 | !use cmassi_mod 74 | ! start CMASSI hardcoded 75 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 76 | implicit none 77 | ! 78 | !----------------------------------------------------------------------- 79 | REAL, PARAMETER :: DMImin=.05e-3, DMImax=1.e-3, & 80 | & XMImin=1.e6*DMImin, XMImax=1.e6*DMImax 81 | INTEGER, PARAMETER :: MDImin=XMImin, MDImax=XMImax 82 | !----------------------------------------------------------------------- 83 | !--- Mean mass of precpitation ice particles as functions of their mean 84 | ! size (in microns) 85 | ! 86 | !LW REAL MASSI(MDImin:MDImax) 87 | ! 88 | !--- Mean rain drop diameters vary from 50 microns to 450 microns 89 | ! 90 | REAL, PARAMETER :: DMRmin=.05E-3, DMRmax=.45E-3, DelDMR=1.E-6 & 91 | &, XMRmin=1.E6*DMRmin, XMRmax=1.E6*DMRmax, N0r0=8.E6, N0rmin=1.e4 92 | INTEGER, PARAMETER :: MDRmin=XMRmin, MDRmax=XMRmax 93 | ! 94 | !--- Various rain lookup tables 95 | ! 96 | REAL RQR_DRmin,RQR_DRmax, & 97 | CN0r0,CN0r_DMRmin,CN0r_DMRmax 98 | 99 | !REAL MASSR(MDRmin:MDRmax),RQR_DRmin,RQR_DRmax, & 100 | ! CN0r0,CN0r_DMRmin,CN0r_DMRmax 101 | 102 | !end CMASSI hardcoded 103 | 104 | 105 | ! hardcode in from params.f 106 | real, parameter :: D608=0.608 107 | real, parameter :: TFRZ=273.15 108 | real, parameter :: EPSQ=1.E-12 109 | real, parameter :: T_ICE=-30. 110 | real, parameter :: PI=3.141592653589793 111 | 112 | !BSF: need to define array limits for im, jm 113 | ! 114 | ! jm = WEdim and im=NSdim --> in pyWRF miy = WEdim and mjx=NSdim 115 | integer, intent(in) :: nsdim, wedim 116 | integer, intent(in) :: im,jm 117 | 118 | INTEGER INDEXS, INDEXR 119 | REAL, PARAMETER :: Cice=1.634e13, DBZmin=-20., RD=287.04, & 120 | ONEPS=1.-18.015/28.964 121 | 122 | !BSF: adjust following parameters based on whats in phys/module_mp_etanew.F: 123 | real, parameter :: NLImin=1.E3, NLImax=5.E3 124 | 125 | 126 | !real,dimension(nsdim,IM),intent(in) :: P1D,T1D,Q1D,C1D,FI1D,FR1D, & 127 | ! 128 | real,dimension(IM,JM),intent(in) :: P1D,T1D,Q1D,C1D,FI1D,FR1D, & 129 | FS1D,CUREFL 130 | !real,dimension(nsdim,IM),intent(inout) :: QW1,QI1,QR1,QS1,DBZ1,DBZR1,& 131 | ! 132 | real,dimension(IM,JM),intent(inout) :: QW1,QI1,QR1,QS1,DBZ1,DBZR1,& 133 | DBZI1,DBZC1,NLICE1 134 | 135 | REAL N0r,Ztot,Zrain,Zice,Zconv,Zmin 136 | integer I,J,JSTA,JEND 137 | 138 | 139 | real TC, Frain,Fice,Flimass,Flarge, & 140 | Fsmall,RimeF,Xsimass,Qice,Qsat,ESAT,WV,RHO,RRHO,RQR, & 141 | DRmm,Qsigrd,WVQW,Dum,XLi,Qlice,WC,DLI,xlimass 142 | 143 | ! From MICROINIT 144 | REAL, PARAMETER :: RHOL=1000. 145 | real ax,C_N0r0 146 | REAL, DIMENSION(MDRmin:MDRmax),intent(in) :: MASSR 147 | REAL, DIMENSION(MDImin:MDImax),intent(in) :: MASSI 148 | 149 | !integer i 150 | ! End MICROINIT 151 | 152 | !f2py intent(in) P1D 153 | !f2py intent(in) T1D 154 | !f2py intent(in) Q1D 155 | !f2py intent(in) C1D 156 | !f2py intent(in) FI1D 157 | !f2py intent(in) FR1D 158 | !f2py intent(in) FS1D 159 | !f2py intent(in) CUREFL 160 | !f2py intent(in) QW1 161 | !f2py intent(in) QI1 162 | !f2py intent(in) QR1 163 | !f2py intent(in) QS1 164 | !f2py intent(in,out) DBZ1 165 | !f2py intent(in) DBZR1 166 | !f2py intent(in) DBZI1 167 | !f2py intent(in) DBZC1 168 | !f2py intent(in) NLICE1 169 | !f2py intent(in) JM 170 | !f2py intent(in) IM 171 | !f2py intent(in) MASSR 172 | !f2py intent(in) MASSI 173 | 174 | !BSF: skip real,external :: fpvs 175 | !************************************************************************ 176 | !--- Determine composition of condensate in the form of cloud water, 177 | ! total ice (cloud ice & snow), & rain following GSMDRIVE in NMM model 178 | ! 179 | 180 | 181 | ! Start MICROINIT hardcoded 182 | !------------------------ START EXECUTION ------------------------ 183 | ! 184 | !--- READ IN MASSI FROM LOOKUP TABLES 185 | ! 186 | ! OPEN (UNIT=1,FILE="ETAMPNEW_DATA",FORM="UNFORMATTED", & 187 | ! &status='old') 188 | ! DO I=1,3 189 | ! READ(1) 190 | ! ENDDO 191 | ! READ(1) MASSR 192 | ! DO I=1,5 193 | ! READ(1) 194 | ! ENDDO 195 | ! READ(1) MASSI 196 | ! CLOSE(1) 197 | RQR_DRmin=N0r0*MASSR(MDRmin) ! Rain content for mean drop diameter of .05 mm 198 | RQR_DRmax=N0r0*MASSR(MDRmax) ! Rain content for mean drop diameter of .45 mm 199 | ! PI=ACOS(-1.) 200 | C_N0r0=PI*RHOL*N0r0 201 | CN0r0=1.E6/C_N0r0**.25 202 | CN0r_DMRmin=1./(PI*RHOL*DMRmin**4) 203 | CN0r_DMRmax=1./(PI*RHOL*DMRmax**4) 204 | ! print *,'MICROINIT: MDRmin, MASSR(MDRmin)=',MDRmin,MASSR(MDRmin) 205 | ! print *,'MICROINIT: MDRmax, MASSR(MDRmax)=',MDRmax,MASSR(MDRmax) 206 | !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 207 | 208 | ! Initialise empty arrays - set dBZ arrays = -20 (clear sky) 209 | JSTA=1 210 | JEND=JM 211 | 212 | Zmin=10.**(0.1*DBZmin) 213 | DO J=JSTA,JEND 214 | !DO I=1,IM 215 | DO I=1,IM 216 | !QW1(I,J)=0. ! Do not initialise these - these are now passed in from the WRF outfile 217 | !QI1(I,J)=0. 218 | !QR1(I,J)=0. 219 | !QS1(I,J)=0. 220 | NLICE1(I,J)=0. 221 | DBZ1(I,J)=DBZmin 222 | DBZR1(I,J)=DBZmin 223 | DBZI1(I,J)=DBZmin 224 | DBZC1(I,J)=DBZmin 225 | ENDDO 226 | ENDDO 227 | DO J=JSTA,JEND 228 | !DO I=1,IM 229 | DO I=1,IM 230 | Zrain=0. !--- Radar reflectivity from rain 231 | Zice=0. !--- Radar reflectivity from ice 232 | Zconv=CUREFL(I,J) !--- Radar reflectivity from convection 233 | IF (C1D(I,J) .LE. EPSQ) THEN 234 | ! 235 | !--- Skip rest of calculatiions if no condensate is present 236 | ! 237 | GO TO 10 238 | ELSE 239 | WC=C1D(I,J) 240 | ENDIF 241 | ! 242 | ! QI1 - total ice (cloud ice & snow) mixing ratio 243 | ! QW1 - cloud water mixing ratio 244 | ! QR1 - rain mixing ratio 245 | 246 | !BSF: If you're running the ARW and it has as output arrays qw, qr, qi, then 247 | ! start here. 248 | !-- array QW is the same as the array 'qc' from ARW output and 'QCLOUD' from wrfout 249 | !-- array QR is the same as the array 'qr' from ARW output and 'QRAIN' from wrfout 250 | !-- array QI is the same as the array 'qs' from ARW output and 'QSNOW' from wrfout 251 | ! => Here QI includes the total ice, large ice (snow) & small cloud ice 252 | ! This is separated out down below in the code starting with defining 253 | ! the constant 'FLARGE'. 254 | ! 255 | !BSF: skip WV=Q1D(I,J)/(1.-Q1D(I,J)) 256 | ! 257 | !--- Saturation vapor pressure w/r/t water ( >=0C ) or ice ( <0C ) 258 | ! 259 | !BSF: skip ESAT=1000.*FPVS(T1D(I,J)) 260 | !BSF: skip QSAT=EPS*ESAT/(P1D(I,J)-ESAT) 261 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+D608*Q1D(I,J))) 262 | RRHO=1./RHO 263 | ! 264 | !--- Based on code from GSMCOLUMN in model to determine reflectivity from rain 265 | ! 266 | ! 267 | ! Using a Marshall-Palmer distribution: 268 | ! 269 | ! Ze = integral of D*6 No e*(-lamda*D) 270 | ! where 271 | ! D is the droplet diameter in m 272 | ! No is the intercept parameter 273 | ! lamda is the slope 274 | ! 275 | ! Assuming that rain droplets are perfectly spherical 276 | ! and that D<<1: 277 | ! 278 | ! Ze,r = GAMMA(7) No,r / lamda*7 279 | ! where 280 | ! GAMMA(n) is the Euler gamma function and GAMMA(7)=720 (m) 281 | ! 282 | ! In the Ferrier scheme D=lamda*-1 283 | ! and so: 284 | ! 285 | ! Ze,r = 720 * No,r * lamda*7 286 | ! 287 | ! 288 | 289 | IF (QR1(I,J) .GT. EPSQ) THEN 290 | RQR=RHO*QR1(I,J) 291 | IF (RQR .LE. RQR_DRmin) THEN 292 | N0r=MAX(N0rmin, CN0r_DMRmin*RQR) 293 | INDEXR=MDRmin 294 | ELSE IF (RQR .GE. RQR_DRmax) THEN 295 | N0r=CN0r_DMRmax*RQR 296 | INDEXR=MDRmax 297 | ELSE 298 | N0r=N0r0 299 | INDEXR=MAX( XMRmin, MIN(CN0r0*RQR**.25, XMRmax) ) 300 | ENDIF 301 | ! 302 | !--- INDEXR is the mean drop size in microns, DR is 'drop radius'; 303 | ! convert all to mm: 304 | ! 305 | ! GAMMA(7) = 720 * 1E-3 = 0.72 306 | ! No,r = N0r (intercept) 307 | ! lamda = DRmm (slope) 308 | ! 309 | 310 | DRmm=1.e-3*REAL(INDEXR) 311 | Zrain=0.72*N0r*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm 312 | ENDIF !--- End IF (QR1(I,J) .GT. EPSQ) block 313 | ! 314 | !--- Based on code from GSMCOLUMN in model to determine partition of 315 | ! total ice into cloud ice & snow (precipitation ice) 316 | ! 317 | IF (QI1(I,J) .GT. EPSQ) THEN 318 | QICE=QI1(I,J) 319 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+ONEPS*Q1D(I,J))) 320 | RRHO=1./RHO 321 | !BSF: skip QSIgrd=RHgrd*QSAT 322 | !BSF: skip WVQW=WV+QW1(I,J) 323 | ! 324 | ! * FLARGE - ratio of number of large ice to total (large & small) ice 325 | ! * FSMALL - ratio of number of small ice crystals to large ice particles 326 | ! -> Small ice particles are assumed to have a mean diameter of 50 microns. 327 | ! * XSIMASS - used for calculating small ice mixing ratio 328 | ! * XLIMASS - used for calculating large ice mixing ratio 329 | ! * INDEXS - mean size of snow to the nearest micron (units of microns) 330 | ! * RimeF - Rime Factor, which is the mass ratio of total (unrimed & 331 | ! rimed) ice mass to the unrimed ice mass (>=1) 332 | ! * FLIMASS - mass fraction of large ice 333 | ! * QTICE - time-averaged mixing ratio of total ice 334 | ! * QLICE - time-averaged mixing ratio of large ice 335 | ! * NLICE1 - time-averaged number concentration of large ice 336 | 337 | ! 338 | ! 339 | ! 340 | IF (TC.GE.0.) THEN !-- BSF: skip .OR. WVQW.LT.QSIgrd) THEN 341 | FLARGE=1. 342 | ELSE 343 | FLARGE=.1 344 | IF (TC.GE.-8. .AND. TC.LE.-3.) FLARGE=.5*FLARGE 345 | ENDIF 346 | FSMALL=(1.-FLARGE)/FLARGE 347 | XSIMASS=RRHO*MASSI(MDImin)*FSMALL 348 | DUM=XMImax*EXP(.0536*TC) 349 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DUM) ) ) 350 | RimeF=AMAX1(1., FS1D(I,J) ) 351 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 352 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 353 | QLICE=FLIMASS*QICE 354 | NLICE1(I,J)=QLICE/XLIMASS 355 | IF (NLICE1(I,J).LT.NLImin .OR. NLICE1(I,J).GT.NLImax) THEN 356 | ! 357 | !--- Force NLICE1 to be between NLImin and NLImax 358 | ! 359 | DUM=MAX(NLImin, MIN(NLImax, NLICE1(I,J)) ) 360 | XLI=RHO*(QICE/DUM-XSIMASS)/RimeF 361 | IF (XLI .LE. MASSI(MDImin) ) THEN 362 | INDEXS=MDImin 363 | ELSE IF (XLI .LE. MASSI(450) ) THEN 364 | DLI=9.5885E5*XLI**.42066 ! DLI in microns 365 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 366 | ELSE IF (XLI .LE. MASSI(MDImax) ) THEN 367 | DLI=3.9751E6*XLI**.49870 ! DLI in microns 368 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 369 | ELSE 370 | INDEXS=MDImax 371 | ! 372 | !--- 8/22/01: Increase density of large ice if maximum limits 373 | ! are reached for number concentration (NLImax) and mean size 374 | ! (MDImax). Done to increase fall out of ice. 375 | ! 376 | IF (DUM .GE. NLImax) & 377 | RimeF=RHO*(QICE/NLImax-XSIMASS)/MASSI(INDEXS) 378 | ENDIF ! End IF (XLI .LE. MASSI(MDImin) ) 379 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 380 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 381 | QLICE=FLIMASS*QICE 382 | NLICE1(I,J)=QLICE/XLIMASS 383 | ENDIF ! End IF (NLICE.LT.NLImin ... 384 | !LW QS1(I,J)=AMIN1(QI1(I,J), QLICE) 385 | !LW QI1(I,J)=AMAX1(0., QI1(I,J)-QS1(I,J)) 386 | 387 | 388 | ! Equation (C.8) in Ferrier (1994, JAS, p. 272) 389 | ! Radar reflectivity of dry ice particles as a function of mass and number concentrations 390 | ! 391 | ! Zi = C'x(RHO*Qi)**2 / ni 392 | ! where 393 | ! C'x = 0.224 * 10**12 ( 6/PI*RHO )**2 * GAMMA(7-ax) * ( GAMMA(1-ax) / GAMMA(4-ax)**2) 394 | ! = 1.63410E13 for exponential ice distributions (ax = 0) 395 | ! ni = NLICE number concetration in cm**-3 396 | ! RHO = Density in g/cm**3 397 | ! Qi = QLICE 398 | ! 399 | 400 | !--- Equation (C.8) in Ferrier (1994, JAS, p. 272), which when 401 | ! converted from cgs units to mks units results in the same 402 | ! value for Cice, which is equal to the {} term below: 403 | ! 404 | ! Zi={.224*720*(10**18)/[(PI*RHOL)**2]}*(RHO*QLICE)**2/NLICE1(I,J), 405 | ! where RHOL=1000 kg/m**3 is the density of liquid water 406 | ! 407 | !--- Valid only for exponential ice distributions 408 | ! 409 | Zice=Cice*RHO*RHO*QLICE*QLICE/NLICE1(I,J) 410 | ENDIF ! End IF (QI1(I,J) .GT. 0.) THEN 411 | ! 412 | !--- Calculate total (convective + grid-scale) radar reflectivity 413 | 10 Ztot=Zrain+Zice+Zconv 414 | IF (Ztot .GT. Zmin) DBZ1(I,J)= 10.*ALOG10(Ztot) 415 | IF (Zrain .GT. Zmin) DBZR1(I,J)=10.*ALOG10(Zrain) 416 | IF (Zice .GT. Zmin) DBZI1(I,J)=10.*ALOG10(Zice) 417 | IF (Zconv .GT. Zmin) DBZC1(I,J)=10.*ALOG10(Zconv) 418 | ENDDO 419 | ENDDO 420 | ! 421 | RETURN 422 | END 423 | -------------------------------------------------------------------------------- /library/dbzcalc_lin_py.f: -------------------------------------------------------------------------------- 1 | subroutine dbzcalc(qvp,qra,qsn,qgr,tmk,prs,dbz,miy,mjx,mkzh, 2 | & in0r,in0s,in0g,iliqskin) 3 | 4 | c this routine expects to be passed the following. 5 | c qvp = water vapor mixing ratio 6 | c qra = rain mixing ratio 7 | c qsn = snow mixing ratio 8 | c qgr = graupel mixing ratio 9 | c tmk = temperature in kelvin (I think) 10 | c prs = pressure 11 | c dbz = input dbz array to store your dbz data (zeros) 12 | c miy = horizontal dimenions (not sure which one) 13 | c mjx = horizontal dimenion (not sure which one) 14 | c mkzh= vertical dimension 15 | c in0r = can be 0 or 1, 1 means use variable intercepts, 0 means use the constants defined below as rn0_x 16 | c in0s = 0 or 1, dont use 1 for the Lin scheme 17 | c in0g = 0 or 1, even though it mentions thompson below, this scheme is not consistant with his assumptions! DO NOT USE WITH THOMPSON 18 | c iliqskin = 1, simulate bright-band effect for frozen particles above 0 degrees (assume they have liquid water on the outside) 19 | 20 | 21 | 22 | c !set up dimensions for our arrays 23 | dimension qra(miy,mjx,mkzh),qvp(miy,mjx,mkzh), 24 | & qsn(miy,mjx,mkzh),qgr(miy,mjx,mkzh),tmk(miy,mjx,mkzh), 25 | & prs(miy,mjx,mkzh),dbz(miy,mjx,mkzh) 26 | 27 | 28 | 29 | c The line below is required to get python to use the fortran code 30 | 31 | Cf2py intent(in,out) dbz(miy,mjx,mkzh) 32 | 33 | character meth*1 34 | 35 | 36 | 37 | c include 'comconst' 38 | c 39 | c Constant intercepts 40 | c 41 | 42 | c in the lin scheme the particle-size drop distrbutions are modelled by a marshall-palmer distribution of the 43 | c form N(x) = rn0_x exp (-lambda_x D) where D is the drop diameter, lambda is the slope of the distrbujtion and 44 | c lambda is defined as ((pi rn0_x rho_x) / (rho_air* q_x))**(1/4) where q_x is the mixing ratio 45 | 46 | c rn0_r= intercept parameter for rain 47 | c rn0_s= intercept parameter for snow 48 | c rn0_g= intercept parameter for graupel 49 | 50 | rn0_r = 8.e6 ! m^-4 51 | c rn0_s = 2.e7 ! m^-4 simon changed for old lin 52 | rn0_s = 3.e6 53 | rn0_g = 4.e6 ! m^-4 54 | c 55 | c Constants used to calculate variable intercepts 56 | c 57 | rhowat=1000. !density of water 58 | pi=4.*atan(1.) !pi 59 | rgas=287.04 !gas constant 60 | r1=1.e-15 !minimum rain threshold value (guessing) 61 | ron=8.e6 62 | ron2=1.e10 63 | son=2.e7 64 | gon=5.e7 65 | ron_min = 8.e6 66 | ron_qr0 = 0.00010 67 | ron_delqr0 = 0.25*ron_qr0 68 | ron_const1r = (ron2-ron_min)*0.5 69 | ron_const2r = (ron2+ron_min)*0.5 70 | c 71 | c Other constants: 72 | c 73 | 74 | c For a particle-drop size distrbution represented by a marshall-palmer distribution 75 | c simulated radar reflectivty can be represented as the 6th moment of the drop size 76 | c distribution which works out to be (Z_ex = equivelent reflectivity factor for x) 77 | c Z_ex = gamma(7) rn0_x lambda_x**-7 78 | c where lambda_x = ((pi rn0_x rho_x) / (rho_air* q_x))**(1/4) 79 | 80 | c substituing lambda_x into Z_e gives 81 | c Z_ex = (720(rho_air q_x)**(7/4))/ ( nr0_x**(3/4) ( pi rho_x) **(7/4)) 82 | 83 | 84 | 85 | gamma_seven = 720. !gamma(7) ! 86 | rho_r = rhowat ! density of water 1000. kg m^-3 87 | rho_s = 100. ! density of snow in kg m^-3 88 | rho_g = 400. ! density of graupel in kg m^-3 89 | alpha = 0.224 ! this factor is used to take into account that ice scatters the radar beam differently to water 90 | 91 | factor_r = gamma_seven * 1.e18 * (1./(pi*rho_r))**1.75 ! 1e18 is to get it to convert to standard reflectivity units. 92 | factor_s = gamma_seven * 1.e18 * (1./(pi*rho_s))**1.75 ! these factors will bs used later, they are just calculated now 93 | & * (rho_s/rhowat)**2 * alpha ! this is only half the relfectivty equation 94 | factor_g = gamma_seven * 1.e18 * (1./(pi*rho_g))**1.75 95 | & * (rho_g/rhowat)**2 * alpha 96 | c 97 | 98 | 99 | 100 | do k=1,mkzh 101 | c do j=1,mjx-1 102 | c do i=1,miy-1 103 | do j=1,mjx 104 | do i=1,miy 105 | 106 | c 107 | c rhoair=prs(i,j,k)*100./ 108 | c & (rgas*virtual(tmk(i,j,k),qvp(i,j,k))) ! air density 109 | 110 | c########################SIMON CHANCE RHOAIR############################# 111 | 112 | rhoair=prs(i,j,k)*100.0/(rgas*(tmk(i,j,k)* !calculate rho air, this should actually be dry air (fix) 113 | & (0.622+qvp(i,j,k))/(0.622*(1.+qvp(i,j,k))))) 114 | 115 | c 116 | c Adjust factor for brightband, where snow or graupel particle 117 | c scatters like liquid water (alpha=1.0) because it is assumed to 118 | c have a liquid skin. 119 | c 120 | if (iliqskin.eq.1.and.tmk(i,j,k).gt.celkel) then 121 | factorb_s=factor_s/alpha 122 | factorb_g=factor_g/alpha 123 | else 124 | factorb_s=factor_s 125 | factorb_g=factor_g 126 | endif 127 | 128 | 129 | c 130 | c Calculate variable intercept parameters if want ed c 131 | c this is stupid, you can calculate the variable as in Thompson et al, but he uses totally different assumptions so you cannot actually apply this algorithm to his data! 132 | 133 | c SKIP TO LINE 172 and below 134 | 135 | if (in0s.eq.1) then ! N_0s as in Thompson et al. 136 | temp_c = amin1(-0.001, tmk(i,j,k)-celkel) 137 | sonv = amin1(2.0e8, 2.0e6*exp(-0.12*temp_c)) 138 | else 139 | sonv = rn0_s 140 | endif 141 | 142 | 143 | 144 | c 145 | if (in0g.eq.1) then ! N_0g as in Thompson et al. 146 | gonv = gon 147 | if (qgr(i,j,k).gt.r1) then 148 | gonv = 2.38*(pi*rho_g/ 149 | + (rhoair*qgr(i,j,k)))**0.92 150 | gonv = max(1.e4, min(gonv,gon)) 151 | endif 152 | else 153 | gonv = rn0_g 154 | endif 155 | 156 | 157 | c 158 | if (in0r.eq.1) then ! N_0r as in Thompson et al. 159 | ronv = ron2 160 | if (qra(i,j,k).gt. r1) then 161 | ronv = ron_const1r*tanh((ron_qr0-qra(i,j,k)) 162 | + /ron_delqr0) + ron_const2r 163 | endif 164 | c if (i.eq.97.and.j.eq.100) then 165 | c print*,'k,ron2,qra(i,j,k),r1,ronv,rn0_r=' 166 | c print*,' ',k,ron2,qra(i,j,k),r1,ronv,rn0_r 167 | c endif 168 | else 169 | ronv = rn0_r 170 | endif 171 | 172 | 173 | c 174 | c Total equivalent reflectivity factor (z_e, in mm^6 m^-3) is 175 | c the sum of z_e for each hydrometeor species: 176 | c 177 | z_e = factor_r * (rhoair*qra(i,j,k))**1.75 / ! rain !this is the second half of the relfectivity equation, using factor_x defined above 178 | & ronv**.75 ! ronv = rn0_r = intercept parameter 179 | & + factorb_s * (rhoair*qsn(i,j,k))**1.75 / ! snow 180 | & sonv**.75 181 | & + factorb_g * (rhoair*qgr(i,j,k))**1.75 / ! graupel 182 | & gonv**.75 183 | 184 | c print * , factor_r 185 | c print * , (rhoair*qra(i,j,k))**1.75 ! rain 186 | c print * , ronv**0.75 187 | 188 | 189 | 190 | 191 | c 192 | c Adjust small values of Z_e so that dBZ is no lower than -20 193 | c 194 | z_e = max(z_e,.01) 195 | 196 | 197 | c 198 | c Convert to dBZ 199 | c 200 | dbz(i,j,k) = 10. * log10(z_e) !convert from dB to dBZ 201 | 202 | 203 | c 204 | enddo 205 | enddo 206 | enddo 207 | c 208 | return 209 | end 210 | -------------------------------------------------------------------------------- /library/eta_tables_massi.txt: -------------------------------------------------------------------------------- 1 | 7.50197196E-11,7.83764928E-11,8.18111204E-11,8.53237966E-11,8.89151253E-11,9.25857724E-11,9.63360572E-11,1.00166576E-10,1.04078128E-10,1.08070872E-10,1.12145737E-10,1.16303238E-10,1.20543742E-10,1.24868144E-10,1.29276923E-10,1.33770342E-10,1.38349665E-10,1.43015155E-10,1.47767215E-10,1.52606788E-10,1.57534236E-10,1.62550445E-10,1.67655514E-10,1.72850526E-10,1.78136172E-10,1.83512691E-10,1.88980567E-10,1.94541425E-10,2.00195069E-10,2.05942124E-10,2.11783355E-10,2.17719634E-10,2.23750990E-10,2.29878810E-10,2.36102804E-10,2.42424636E-10,2.48844778E-10,2.55362786E-10,2.61980021E-10,2.68697592E-10,2.75515388E-10,2.82434409E-10,2.89455154E-10,2.96578373E-10,3.03804315E-10,3.11134368E-10,3.18567867E-10,3.26107197E-10,3.33752886E-10,3.41504020E-10,3.49361484E-10,3.57326529E-10,3.65400654E-10,3.73582387E-10,3.81874338E-10,3.90276783E-10,3.98788752E-10,4.07413159E-10,4.16148171E-10,4.24996621E-10,4.33958952E-10,4.43033721E-10,4.52223786E-10,4.61529259E-10,4.70950001E-10,4.80487761E-10,4.90139873E-10,4.99912223E-10,5.09802311E-10,5.19810694E-10,5.29940147E-10,5.40188005E-10,5.50557988E-10,5.61049762E-10,5.71662884E-10,5.82397741E-10,5.93257110E-10,6.04239825E-10,6.15347939E-10,6.26579122E-10,6.37938591E-10,6.49422460E-10,6.61034671E-10,6.72774170E-10,6.84640511E-10,6.96636027E-10,7.08762105E-10,7.21017468E-10,7.33403338E-10,7.45920326E-10,7.58569263E-10,7.71350761E-10,7.84264875E-10,7.97308719E-10,8.10490952E-10,8.23807744E-10,8.37259428E-10,8.50847948E-10,8.64571248E-10,8.78431439E-10,8.92429797E-10,9.06566322E-10,9.20841403E-10,9.35255540E-10,9.49810341E-10,9.64503255E-10,9.79337389E-10,9.94315297E-10,1.00943409E-09,1.02469355E-09,1.04009912E-09,1.05564513E-09,1.07133702E-09,1.08717235E-09,1.10315246E-09,1.11927956E-09,1.13555043E-09,1.15196974E-09,1.16853305E-09,1.18524701E-09,1.20210630E-09,1.21911659E-09,1.23627508E-09,1.25358279E-09,1.27104016E-09,1.28864652E-09,1.30639921E-09,1.32430811E-09,1.34236999E-09,1.36058220E-09,1.37894518E-09,1.39746448E-09,1.41613499E-09,1.43495882E-09,1.45393808E-09,1.47307067E-09,1.49235679E-09,1.51180357E-09,1.53140278E-09,1.55115798E-09,1.57106883E-09,1.59113556E-09,1.61136138E-09,1.63174552E-09,1.65228420E-09,1.67298297E-09,1.69384162E-09,1.71485204E-09,1.73602865E-09,1.75736148E-09,1.77885340E-09,1.80050941E-09,1.82232673E-09,1.84429783E-09,1.86643367E-09,1.88872917E-09,1.91118721E-09,1.93381156E-09,1.95659133E-09,1.97953676E-09,2.00264272E-09,2.02590900E-09,2.04934558E-09,2.07294004E-09,2.09669948E-09,2.12061146E-09,2.14469686E-09,2.16895080E-09,2.19336305E-09,2.21794139E-09,2.24268448E-09,2.26760055E-09,2.29267583E-09,2.31791342E-09,2.34331710E-09,2.36889242E-09,2.39462339E-09,2.42052822E-09,2.44659693E-09,2.47283372E-09,2.49923282E-09,2.52580223E-09,2.55253108E-09,2.57943733E-09,2.60650013E-09,2.63373878E-09,2.66113798E-09,2.68870592E-09,2.71644329E-09,2.74435008E-09,2.77242207E-09,2.80065349E-09,2.82906232E-09,2.85763879E-09,2.88637581E-09,2.91528934E-09,2.94436697E-09,2.97361336E-09,3.00302316E-09,3.03259950E-09,3.06235437E-09,3.09227333E-09,3.12235615E-09,3.15260773E-09,3.18303073E-09,3.21361937E-09,3.24437988E-09,3.27530114E-09,3.30639693E-09,3.33765793E-09,3.36908546E-09,3.40068440E-09,3.43245365E-09,3.46437234E-09,3.49647111E-09,3.52874441E-09,3.56118290E-09,3.59378749E-09,3.62656105E-09,3.65949893E-09,3.69261488E-09,3.72588893E-09,3.75934084E-09,3.79294240E-09,3.82673093E-09,3.86067933E-09,3.89479871E-09,3.92907307E-09,3.96352773E-09,3.99814271E-09,4.03292733E-09,4.06787715E-09,4.10299705E-09,4.13828483E-09,4.17373824E-09,4.20935464E-09,4.24514024E-09,4.28109947E-09,4.31721192E-09,4.35349312E-09,4.38994796E-09,4.42656400E-09,4.46334392E-09,4.50029392E-09,4.53740823E-09,4.57469085E-09,4.61213334E-09,4.64973438E-09,4.68750949E-09,4.72546180E-09,4.76356288E-09,4.80182738E-09,4.84026019E-09,4.87886842E-09,4.91762941E-09,4.95654762E-09,4.99563368E-09,5.03489206E-09,5.07430631E-09,5.11388043E-09,5.15363974E-09,5.19353627E-09,5.23360066E-09,5.27383870E-09,5.31423394E-09,5.35480016E-09,5.39550493E-09,5.43639400E-09,5.47742696E-09,5.51863932E-09,5.56000490E-09,5.60152591E-09,5.64322722E-09,5.68502267E-09,5.72703307E-09,5.76921977E-09,5.81153570E-09,5.85402349E-09,5.89667826E-09,5.93948934E-09,5.98245320E-09,6.02557471E-09,6.06886985E-09,6.11231821E-09,6.15591800E-09,6.19968121E-09,6.24360874E-09,6.28769170E-09,6.33192965E-09,6.37631281E-09,6.42085363E-09,6.46559517E-09,6.51045040E-09,6.55545440E-09,6.60063648E-09,6.64597044E-09,6.69146294E-09,6.73712242E-09,6.78290579E-09,6.82887435E-09,6.87497437E-09,6.92125512E-09,6.96767088E-09,7.01423808E-09,7.06097714E-09,7.10786896E-09,7.15489978E-09,7.20209847E-09,7.24944149E-09,7.29693594E-09,7.34460226E-09,7.39239114E-09,7.44033635E-09,7.48844187E-09,7.53670637E-09,7.58512186E-09,7.63367591E-09,7.68239694E-09,7.73126541E-09,7.78026976E-09,7.82943577E-09,7.87874477E-09,7.92821275E-09,7.97783795E-09,8.02760436E-09,8.07751999E-09,8.12757328E-09,8.17778023E-09,8.22814350E-09,8.27864977E-09,8.32929903E-09,8.38010195E-09,8.43104964E-09,8.48215009E-09,8.53338467E-09,8.58477289E-09,8.63632366E-09,8.68800409E-09,8.73982842E-09,8.79180906E-09,8.84392293E-09,8.89618779E-09,8.94858765E-09,9.00114738E-09,9.05384301E-09,9.10669229E-09,9.15967568E-09,9.21272836E-09,9.26602350E-09,9.31942701E-09,9.37298239E-09,9.42667455E-09,9.48055323E-09,9.53452428E-09,9.58864366E-09,9.64292113E-09,9.69733893E-09,9.75188019E-09,9.80658932E-09,9.86142901E-09,9.91637705E-09,9.97150007E-09,1.00267696E-08,1.00821564E-08,1.01377315E-08,1.01933892E-08,1.02492166E-08,1.03051381E-08,1.03612336E-08,1.04174696E-08,1.04738360E-08,1.05303322E-08,1.05869740E-08,1.06437312E-08,1.07006777E-08,1.07577405E-08,1.08149143E-08,1.08722498E-08,1.09297051E-08,1.09873204E-08,1.10450324E-08,1.11028973E-08,1.11609246E-08,1.12190346E-08,1.12773186E-08,1.13357430E-08,1.13943015E-08,1.14529719E-08,1.15117746E-08,1.15707337E-08,1.16297763E-08,1.16889920E-08,1.17483312E-08,1.18077885E-08,1.18674039E-08,1.19271659E-08,1.19870256E-08,1.20470354E-08,1.21071571E-08,1.21674351E-08,1.22277974E-08,1.22883304E-08,1.23489663E-08,1.24098110E-08,1.24707036E-08,1.25317339E-08,1.25928858E-08,1.26541906E-08,1.27156179E-08,1.27771997E-08,1.28389033E-08,1.29007223E-08,1.29626256E-08,1.30246880E-08,1.30869289E-08,1.31492497E-08,1.32117295E-08,1.32742679E-08,1.33370133E-08,1.33998244E-08,1.34627740E-08,1.35258489E-08,1.35890783E-08,1.36524250E-08,1.37158871E-08,1.37794629E-08,1.38431595E-08,1.39070284E-08,1.39709888E-08,1.40350664E-08,1.40992791E-08,1.41636090E-08,1.42280436E-08,1.42926710E-08,1.43573287E-08,1.44221772E-08,1.44871013E-08,1.45522092E-08,1.46173775E-08,1.46827004E-08,1.47481334E-08,1.48136694E-08,1.48792250E-08,1.49449768E-08,1.50108885E-08,1.50769566E-08,1.51431383E-08,1.52094053E-08,1.52757842E-08,1.53423176E-08,1.54089985E-08,1.54756918E-08,1.55425752E-08,1.56095670E-08,1.56767062E-08,1.57439750E-08,1.58113025E-08,1.58787543E-08,1.59463838E-08,1.60140772E-08,1.60818932E-08,1.61498477E-08,1.62179070E-08,1.62860516E-08,1.63543916E-08,1.64227423E-08,1.64912901E-08,1.65599765E-08,1.66287233E-08,1.66975767E-08,1.67665952E-08,1.68356706E-08,1.69049059E-08,1.69742052E-08,1.70436518E-08,1.71132850E-08,1.71828898E-08,1.72526686E-08,1.73225985E-08,1.73926171E-08,1.74627584E-08,1.75330239E-08,1.76033534E-08,1.76738748E-08,1.77444175E-08,1.78151556E-08,1.78859043E-08,1.79568218E-08,1.80278548E-08,1.80989872E-08,1.81703026E-08,1.82416517E-08,1.83130933E-08,1.83847266E-08,1.84563564E-08,1.85282580E-08,1.86001774E-08,1.86721643E-08,1.87443305E-08,1.88165767E-08,1.88889366E-08,1.89614013E-08,1.90340206E-08,1.91066967E-08,1.91794509E-08,1.92523757E-08,1.93254177E-08,1.93985681E-08,1.94717593E-08,1.95451300E-08,1.96185841E-08,1.96921146E-08,1.97657712E-08,1.98395362E-08,1.99134735E-08,1.99874783E-08,2.00615418E-08,2.01357579E-08,2.02100754E-08,2.02844639E-08,2.03589909E-08,2.04336388E-08,2.05083523E-08,2.05832311E-08,2.06581685E-08,2.07331929E-08,2.08083097E-08,2.08836060E-08,2.09589501E-08,2.10344666E-08,2.11100364E-08,2.11856577E-08,2.12614673E-08,2.13373266E-08,2.14133653E-08,2.14894005E-08,2.15656648E-08,2.16419220E-08,2.17183782E-08,2.17948646E-08,2.18714735E-08,2.19481802E-08,2.20250058E-08,2.21019310E-08,2.21790017E-08,2.22560903E-08,2.23332997E-08,2.24106298E-08,2.24880417E-08,2.25655779E-08,2.26432348E-08,2.27209327E-08,2.27988135E-08,2.28767512E-08,2.29547581E-08,2.30329107E-08,2.31111628E-08,2.31895196E-08,2.32679405E-08,2.33465069E-08,2.34251125E-08,2.35038318E-08,2.35826771E-08,2.36616149E-08,2.37403395E-08,2.38194868E-08,2.38987141E-08,2.39780409E-08,2.40574547E-08,2.41369893E-08,2.42166589E-08,2.42963605E-08,2.43762059E-08,2.44561136E-08,2.45360994E-08,2.46162699E-08,2.46964689E-08,2.47768153E-08,2.48572469E-08,2.49377390E-08,2.50183358E-08,2.50990340E-08,2.51798831E-08,2.52607695E-08,2.53417110E-08,2.54228691E-08,2.55040167E-08,2.55852886E-08,2.56667168E-08,2.57481112E-08,2.58297792E-08,2.59114081E-08,2.59931525E-08,2.60750088E-08,2.61569877E-08,2.62390234E-08,2.63211568E-08,2.64033613E-08,2.64856865E-08,2.65682125E-08,2.66506657E-08,2.67332556E-08,2.68160125E-08,2.68988174E-08,2.69817306E-08,2.70647398E-08,2.71477489E-08,2.72309713E-08,2.73142309E-08,2.73975846E-08,2.74811160E-08,2.75646297E-08,2.76482339E-08,2.77319945E-08,2.78158812E-08,2.78997199E-08,2.79837931E-08,2.80678822E-08,2.81520727E-08,2.82363501E-08,2.83207306E-08,2.84051929E-08,2.84898061E-08,2.85745276E-08,2.86591426E-08,2.87440791E-08,2.88290352E-08,2.89140054E-08,2.89991018E-08,2.90843793E-08,2.91696054E-08,2.92549771E-08,2.93404963E-08,2.94260651E-08,2.95116980E-08,2.95974854E-08,2.96833047E-08,2.97692004E-08,2.98552543E-08,2.99414040E-08,3.00275289E-08,3.01138385E-08,3.02002370E-08,3.02866958E-08,3.03732186E-08,3.04599261E-08,3.05466301E-08,3.06334371E-08,3.07203329E-08,3.08073957E-08,3.08943910E-08,3.09817132E-08,3.10688542E-08,3.11562971E-08,3.12436335E-08,3.13312576E-08,3.14188320E-08,3.15065449E-08,3.15942614E-08,3.16822586E-08,3.17701883E-08,3.18582210E-08,3.19464384E-08,3.20345848E-08,3.21229336E-08,3.22112967E-08,3.22998268E-08,3.23884386E-08,3.24770539E-08,3.25657830E-08,3.26546115E-08,3.27435785E-08,3.28326095E-08,3.29216441E-08,3.30108882E-08,3.31001715E-08,3.31895045E-08,3.32789192E-08,3.33684902E-08,3.34581145E-08,3.35477104E-08,3.36375123E-08,3.37274102E-08,3.38173933E-08,3.39073942E-08,3.39975443E-08,3.40877051E-08,3.41780897E-08,3.42684139E-08,3.43588518E-08,3.44494069E-08,3.45400935E-08,3.46308120E-08,3.47215092E-08,3.48124445E-08,3.49034046E-08,3.49944642E-08,3.50855842E-08,3.51768499E-08,3.52680871E-08,3.53595837E-08,3.54510448E-08,3.55425094E-08,3.56341445E-08,3.57259005E-08,3.58176884E-08,3.59095260E-08,3.60015626E-08,3.60935886E-08,3.61857495E-08,3.62780277E-08,3.63702739E-08,3.64626480E-08,3.65551607E-08,3.66477160E-08,3.67403032E-08,3.68329651E-08,3.69258402E-08,3.70186761E-08,3.71116293E-08,3.72046607E-08,3.72977205E-08,3.73910041E-08,3.74842450E-08,3.75776814E-08,3.76703682E-08,3.77639573E-08,3.78575606E-08,3.79512564E-08,3.80450409E-08,3.81388752E-08,3.82328729E-08,3.83267533E-08,3.84208505E-08,3.85151182E-08,3.86094356E-08,3.87036572E-08,3.87980919E-08,3.88926011E-08,3.89872383E-08,3.90818791E-08,3.91766193E-08,3.92714234E-08,3.93664195E-08,3.94613195E-08,3.95563724E-08,3.96515141E-08,3.97467659E-08,3.98420639E-08,3.99374223E-08,4.00328624E-08,4.01284268E-08,4.02240978E-08,4.03197618E-08,4.04156353E-08,4.05114733E-08,4.06073752E-08,4.07033234E-08,4.07993817E-08,4.08955465E-08,4.09917646E-08,4.10881924E-08,4.11846628E-08,4.12810550E-08,4.13776782E-08,4.14742765E-08,4.15709742E-08,4.16678851E-08,4.17647001E-08,4.18617496E-08,4.19587209E-08,4.20557207E-08,4.21529052E-08,4.22501287E-08,4.23475441E-08,4.24449986E-08,4.25424744E-08,4.26400888E-08,4.27377316E-08,4.28354632E-08,4.29332268E-08,4.30311751E-08,4.31292797E-08,4.32273843E-08,4.33253824E-08,4.34234089E-08,4.35216911E-08,4.36200622E-08,4.37185079E-08,4.38170531E-08,4.39156338E-08,4.40143140E-08,4.41130794E-08,4.42118484E-08,4.43107524E-08,4.44097026E-08,4.45087487E-08,4.46078161E-08,4.47070754E-08,4.48064199E-08,4.49057396E-08,4.50051374E-08,4.51045530E-08,4.52040467E-08,4.53037146E-08,4.54034854E-08,4.55032811E-08,4.56031515E-08,4.57031035E-08,4.58031231E-08,4.59032670E-08,4.60034002E-08,4.61036862E-08,4.62040042E-08,4.63043754E-08,4.64048462E-08,4.65054448E-08,4.66060790E-08,4.67067913E-08,4.68075605E-08,4.69084469E-08,4.70093404E-08,4.71103938E-08,4.72114401E-08,4.73126924E-08,4.74137387E-08,4.75150586E-08,4.76164246E-08,4.77178190E-08,4.78193947E-08,4.79209312E-08,4.80226809E-08,4.81243667E-08,4.82261662E-08,4.83281113E-08,4.84300671E-08,4.85320300E-08,4.86341669E-08,4.87363003E-08,4.88385652E-08,4.89409544E-08,4.90433720E-08,4.91458678E-08,4.92483352E-08,4.93510228E-08,4.94537318E-08,4.95564336E-08,4.96594197E-08,4.97622779E-08,4.98652071E-08,4.99683601E-08,5.00714066E-08,5.01746342E-08,5.02779756E-08,5.03812707E-08,5.04847648E-08,5.05881914E-08,5.06917814E-08,5.07954745E-08,5.08992315E-08,5.10029885E-08,5.11068698E-08,5.12107832E-08,5.13148741E-08,5.14188194E-08,5.15230276E-08,5.16273708E-08,5.17316003E-08,5.18360181E-08,5.19404360E-08,5.20449603E-08,5.21495522E-08,5.22541583E-08,5.23589989E-08,5.24637898E-08,5.25687369E-08,5.26736486E-08,5.27786028E-08,5.28837454E-08,5.29888702E-08,5.30941335E-08,5.31994182E-08,5.33047420E-08,5.34101687E-08,5.35157660E-08,5.36212710E-08,5.37269429E-08,5.38326823E-08,5.39384928E-08,5.40444276E-08,5.41502843E-08,5.42564003E-08,5.43624346E-08,5.44685967E-08,5.45748691E-08,5.46811840E-08,5.47874706E-08,5.48938921E-08,5.50003989E-08,5.51070833E-08,5.52139028E-08,5.53205091E-08,5.54273356E-08,5.55340556E-08,5.56410811E-08,5.57480604E-08,5.58551925E-08,5.59622535E-08,5.60694531E-08,5.61767308E-08,5.62840796E-08,5.63915385E-08,5.64990223E-08,5.66067193E-08,5.67142173E-08,5.68220280E-08,5.69297391E-08,5.70377239E-08,5.71455487E-08,5.72535939E-08,5.73616248E-08,5.74697090E-08,5.75779460E-08,5.76861510E-08,5.77945052E-08,5.79028949E-08,5.80113202E-08,5.81198840E-08,5.82284549E-08,5.83371786E-08,5.84459627E-08,5.85548712E-08,5.86637157E-08,5.87726028E-08,5.88816640E-08,5.89907074E-08,5.90985927E-08,5.92076574E-08,5.93170029E-08,5.94263874E-08,5.95358181E-08,5.96455081E-08,5.97550596E-08,5.98646963E-08,5.99743828E-08,6.00841688E-08,6.01940329E-08,6.03038899E-08,6.04139103E-08,6.05239947E-08,6.06341573E-08 2 | -------------------------------------------------------------------------------- /library/eta_tables_massr.txt: -------------------------------------------------------------------------------- 1 | 1.92740585E-14,2.08871413E-14,2.25984562E-14,2.44117945E-14,2.63311965E-14,2.83606231E-14,3.05042043E-14,3.27660940E-14,3.51506645E-14,3.76621443E-14,4.03049447E-14,4.30835245E-14,4.60025525E-14,4.90666637E-14,5.22802593E-14,5.56485366E-14,5.91760460E-14,6.28679915E-14,6.67292285E-14,7.07647984E-14,7.49800002E-14,7.93800857E-14,8.39701843E-14,8.87558256E-14,9.37424847E-14,9.89353388E-14,1.04340710E-13,1.09963776E-13,1.15810397E-13,1.21886320E-13,1.28197705E-13,1.34750297E-13,1.41550481E-13,1.48604246E-13,1.55917583E-13,1.63497362E-13,1.71349046E-13,1.79479980E-13,1.87896099E-13,1.96604329E-13,2.05611176E-13,2.14923565E-13,2.24547960E-13,2.34491408E-13,2.44761215E-13,2.55364143E-13,2.66306915E-13,2.77597390E-13,2.89242642E-13,3.01250642E-13,3.13627190E-13,3.26382042E-13,3.39520268E-13,3.53051166E-13,3.66982188E-13,3.81320951E-13,3.96075777E-13,4.11253171E-13,4.26862484E-13,4.42912037E-13,4.59410017E-13,4.76362222E-13,4.93780689E-13,5.11671489E-13,5.30043674E-13,5.48906244E-13,5.68267872E-13,5.88136636E-13,6.08519637E-13,6.29429234E-13,6.50871447E-13,6.72858253E-13,6.95395835E-13,7.18494491E-13,7.42164576E-13,7.66414167E-13,7.91253077E-13,8.16689435E-13,8.42733706E-13,8.69397057E-13,8.96686696E-13,9.24613142E-13,9.53184580E-13,9.82415646E-13,1.01231404E-12,1.04288843E-12,1.07415086E-12,1.10610978E-12,1.13877668E-12,1.17216209E-12,1.20627640E-12,1.24112699E-12,1.27673078E-12,1.31309210E-12,1.35022245E-12,1.38813668E-12,1.42684562E-12,1.46635492E-12,1.50668041E-12,1.54783261E-12,1.58982127E-12,1.63265571E-12,1.67635198E-12,1.72091735E-12,1.76636830E-12,1.81271350E-12,1.85996249E-12,1.90812427E-12,1.95721629E-12,2.00725569E-12,2.05824572E-12,2.11020069E-12,2.16313534E-12,2.21705575E-12,2.27197948E-12,2.32791997E-12,2.38488005E-12,2.44288487E-12,2.50193269E-12,2.56205452E-12,2.62325058E-12,2.68553734E-12,2.74892500E-12,2.81342918E-12,2.87905420E-12,2.94582826E-12,3.01375504E-12,3.08284778E-12,3.15312251E-12,3.22459290E-12,3.29727044E-12,3.37117031E-12,3.44630401E-12,3.52268952E-12,3.60033834E-12,3.67925395E-12,3.75945238E-12,3.84097138E-12,3.92379792E-12,4.00796800E-12,4.09347859E-12,4.18035745E-12,4.26860804E-12,4.35824467E-12,4.44929033E-12,4.54175239E-12,4.63564170E-12,4.73099164E-12,4.82779702E-12,4.92608732E-12,5.02586124E-12,5.12714827E-12,5.22995926E-12,5.33431676E-12,5.44022292E-12,5.54768514E-12,5.65674721E-12,5.76739004E-12,5.87966611E-12,5.99357066E-12,6.10911755E-12,6.22632935E-12,6.34520821E-12,6.46579188E-12,6.58808988E-12,6.71211090E-12,6.83787532E-12,6.96539181E-12,7.09468638E-12,7.22578161E-12,7.35867790E-12,7.49335143E-12,7.62992620E-12,7.76833025E-12,7.90863382E-12,8.05081869E-12,8.19490049E-12,8.34092431E-12,8.48890836E-12,8.63881969E-12,8.79071382E-12,8.94461154E-12,9.10051721E-12,9.25844644E-12,9.41845386E-12,9.58049265E-12,9.74462178E-12,9.91083951E-12,1.00791875E-11,1.02496700E-11,1.04222776E-11,1.05971091E-11,1.07740639E-11,1.09532999E-11,1.11347312E-11,1.13184054E-11,1.15043391E-11,1.16925454E-11,1.18830857E-11,1.20758898E-11,1.22711008E-11,1.24686225E-11,1.26685173E-11,1.28708190E-11,1.30755589E-11,1.32826727E-11,1.34922724E-11,1.37043337E-11,1.39188982E-11,1.41359641E-11,1.43555549E-11,1.45777019E-11,1.48023972E-11,1.50295956E-11,1.52595436E-11,1.54920243E-11,1.57272320E-11,1.59650973E-11,1.62056757E-11,1.64488301E-11,1.66948226E-11,1.69435473E-11,1.71950683E-11,1.74493059E-11,1.77064179E-11,1.79663194E-11,1.82290814E-11,1.84947370E-11,1.87632548E-11,1.90346783E-11,1.93091151E-11,1.95864523E-11,1.98667974E-11,2.01500986E-11,2.04363922E-11,2.07257718E-11,2.10181976E-11,2.13137286E-11,2.16123629E-11,2.19140851E-11,2.22189819E-11,2.25270375E-11,2.28383163E-11,2.31528147E-11,2.34705068E-11,2.37914671E-11,2.41157528E-11,2.44432530E-11,2.47741515E-11,2.51084240E-11,2.54459925E-11,2.57869837E-11,2.61313523E-11,2.64792667E-11,2.68305499E-11,2.71853477E-11,2.75435681E-11,2.79054592E-11,2.82708093E-11,2.86398006E-11,2.90123498E-11,2.93885818E-11,2.97681567E-11,3.01516208E-11,3.05388180E-11,3.09296720E-11,3.13242939E-11,3.17228327E-11,3.21249728E-11,3.25309744E-11,3.29408271E-11,3.33545171E-11,3.37721587E-11,3.41936687E-11,3.46189362E-11,3.50484919E-11,3.54817911E-11,3.59192086E-11,3.63606437E-11,3.68060270E-11,3.72556153E-11,3.77092385E-11,3.81670771E-11,3.86289195E-11,3.90951230E-11,3.95654551E-11,4.00400615E-11,4.05188626E-11,4.10019414E-11,4.14892495E-11,4.19810887E-11,4.24770670E-11,4.29776006E-11,4.34825335E-11,4.39917790E-11,4.45055520E-11,4.50237798E-11,4.55467712E-11,4.60739225E-11,4.66058650E-11,4.71422658E-11,4.76834648E-11,4.82292227E-11,4.87796019E-11,4.93347134E-11,4.98945087E-11,5.04591785E-11,5.10284662E-11,5.16025937E-11,5.21816305E-11,5.27655315E-11,5.33542446E-11,5.39479225E-11,5.45465270E-11,5.51499332E-11,5.57585852E-11,5.63721674E-11,5.69908253E-11,5.76144722E-11,5.82432852E-11,5.88772711E-11,5.95163363E-11,6.01600436E-11,6.08096420E-11,6.14644169E-11,6.21243196E-11,6.27897109E-11,6.34604591E-11,6.41364045E-11,6.48178594E-11,6.55046503E-11,6.61969368E-11,6.68946495E-11,6.75979758E-11,6.83065896E-11,6.90210666E-11,6.97409977E-11,7.04665493E-11,7.11977075E-11,7.19345347E-11,7.26771074E-11,7.34253561E-11,7.41793432E-11,7.49394019E-11,7.57048313E-11,7.64765681E-11,7.72537936E-11,7.80372086E-11,7.88264246E-11,7.96216010E-11,8.04228975E-11,8.12300990E-11,8.20435872E-11,8.28630983E-11,8.36885700E-11,8.45200854E-11,8.53579984E-11,8.62020316E-11,8.70523584E-11,8.79089510E-11,8.87718093E-11,8.96412805E-11,9.05169550E-11,9.13987427E-11,9.22872959E-11,9.31822952E-11,9.40836159E-11,9.49916257E-11,9.59061303E-11,9.68272199E-11,9.77549083E-11,9.86890639E-11,9.96303942E-11,1.00578011E-10,1.01532366E-10,1.02493722E-10,1.03461968E-10,1.04436911E-10,1.05418570E-10,1.06407085E-10,1.07402712E-10,1.08405396E-10,1.09415095E-10,1.10431768E-10,1.11455484E-10,1.12486152E-10,1.13524225E-10,1.14569326E-10,1.15621589E-10,1.16681123E-10,1.17747881E-10,1.18822133E-10,1.19902310E-10,1.20990759E-10,1.22087160E-10,1.23190846E-10,1.24302055E-10,1.25420480E-10,1.26546731E-10,1.27680033E-10,1.28821689E-10 2 | -------------------------------------------------------------------------------- /library/perturbation_variables.py: -------------------------------------------------------------------------------- 1 | #module: pertibation_variables 2 | 3 | 4 | #####################FOR THE ARW CORE############## 5 | #####################FOR THE ARW CORE############## 6 | #####################FOR THE ARW CORE############## 7 | pert_variable_dict_ARW={} 8 | pert_variable_dict_ARW.update({'GEOP':('PH','PHB')}) 9 | pert_variable_dict_ARW.update({'Z':('PH','PHB')}) 10 | pert_variable_dict_ARW.update({'THETA':('T',300.)}) 11 | pert_variable_dict_ARW.update({'PRES':('P','PB')}) 12 | 13 | calc_variable_dict_ARW={} 14 | calc_variable_dict_ARW.update({'TEMP':('PRES','THETA')}) 15 | calc_variable_dict_ARW.update({'RH':('QVAPOR','PRES','TEMP')}) 16 | calc_variable_dict_ARW.update({'TD':('QVAPOR','PRES')}) 17 | calc_variable_dict_ARW.update({'PRES':''}) #used to divide by 100. to get into mb 18 | calc_variable_dict_ARW.update({'Z':''}) # 19 | calc_variable_dict_ARW.update({'SPH':('QVAPOR',)}) 20 | 21 | 22 | #####################FOR THE NMM CORE############## 23 | #####################FOR THE NMM CORE############## 24 | #####################FOR THE NMM CORE############## 25 | 26 | pert_variable_dict_NMM={} 27 | calc_variable_dict_NMM={} 28 | calc_variable_dict_NMM.update({'PRES':('PINT',)}) #used to divide by 100. to get into mb 29 | calc_variable_dict_NMM.update({'TEMP':('T',)}) #used to divide by 100. to get into mb 30 | calc_variable_dict_NMM.update({'SPH':('QVAPOR',)}) 31 | calc_variable_dict_NMM.update({'RH':('QVAPOR','PRES','TEMP')}) 32 | calc_variable_dict_NMM.update({'TD':('QVAPOR','PRES')}) 33 | calc_variable_dict_NMM.update({'Z':('',)}) 34 | calc_variable_dict_NMM.update({'VTMK':('TEMP','QVAPOR')}) 35 | calc_variable_dict_NMM.update({'XLAT':('GLAT',)}) 36 | calc_variable_dict_NMM.update({'XLONG':('GLON',)}) 37 | #calc_variable_dict_NMM.update=({'XLAT':'GLAT'}) 38 | #calc_variable_dict_NMM.update=({'XLONG':'GLON'}) 39 | #calc_variable_dict_NMM.update({'PRES':''}) #used to divide by 100. to get into mb 40 | -------------------------------------------------------------------------------- /library/skewt.py: -------------------------------------------------------------------------------- 1 | #Copyright (c) 2008 Ryan May 2 | 3 | #Permission is hereby granted, free of charge, to any person obtaining a copy 4 | #of this software and associated documentation files (the "Software"), to deal 5 | #in the Software without restriction, including without limitation the rights 6 | #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | #copies of the Software, and to permit persons to whom the Software is 8 | #furnished to do so, subject to the following conditions: 9 | 10 | #The above copyright notice and this permission notice shall be included in 11 | #all copies or substantial portions of the Software. 12 | 13 | #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | #THE SOFTWARE. 20 | 21 | from matplotlib.axes import Axes 22 | from matplotlib.lines import Line2D 23 | from matplotlib.collections import LineCollection 24 | from matplotlib.ticker import FixedLocator, AutoLocator, ScalarFormatter 25 | import matplotlib.transforms as transforms 26 | import matplotlib.axis as maxis 27 | import matplotlib.artist as artist 28 | from matplotlib.projections import register_projection 29 | 30 | import numpy as np 31 | 32 | import pylab 33 | 34 | import matplotlib.pyplot as plt 35 | 36 | #TODO: 37 | # *Panning and zooming are horribly broken, probably because the 38 | # skewed data are used as bounds. Needs to be disabled (especially panning) 39 | # or updated to work sensibly 40 | # *How do we automatically pick appropriate limits so that all relevant 41 | # slanted gridlines are added? 42 | # *How do we get the labels we want at the top? 43 | # *Set good aspect ratio, at least by default 44 | # - set_aspect(1/11.17, adjustable='datalim') would seem to do what I want 45 | # except that when I resize the figure, there's a lot of jumping around 46 | # Might be related to panning/zooming problems 47 | # *New functions/methods needed to add the various significant lines: 48 | # -Moist adiabats: ThetaE (HOW THE HECK DOES IT WORK?) 49 | # *Combine skewT plot with separate subplot for vertical wind plot using 50 | # barbs? 51 | 52 | class SkewXTick(maxis.XTick): 53 | def draw(self, renderer): 54 | if not self.get_visible(): return 55 | renderer.open_group(self.__name__) 56 | 57 | if self.gridOn: 58 | self.gridline.draw(renderer) 59 | if self.tick1On: 60 | self.tick1line.draw(renderer) 61 | if self.tick2On: 62 | self.tick2line.draw(renderer) 63 | 64 | if self.label1On: 65 | self.label1.draw(renderer) 66 | if self.label2On: 67 | self.label2.draw(renderer) 68 | 69 | renderer.close_group(self.__name__) 70 | 71 | def set_clip_path(self, clippath, transform=None): 72 | artist.Artist.set_clip_path(self, clippath, transform) 73 | self.tick1line.set_clip_path(clippath, transform) 74 | self.tick2line.set_clip_path(clippath, transform) 75 | self.gridline.set_clip_path(clippath, transform) 76 | set_clip_path.__doc__ = artist.Artist.set_clip_path.__doc__ 77 | 78 | class SkewXAxis(maxis.XAxis): 79 | def _get_tick(self, major): 80 | return SkewXTick(self.axes, 0, '', major=major) 81 | 82 | def draw(self, renderer, *args, **kwargs): 83 | 'Draw the axis lines, grid lines, tick lines and labels' 84 | ticklabelBoxes = [] 85 | ticklabelBoxes2 = [] 86 | 87 | if not self.get_visible(): return 88 | renderer.open_group(__name__) 89 | interval = self.get_view_interval() 90 | for tick, loc, label in self.iter_ticks(): 91 | if tick is None: continue 92 | if transforms.interval_contains(interval, loc): 93 | tick.set_label1(label) 94 | tick.set_label2(label) 95 | tick.update_position(loc) 96 | tick.draw(renderer) 97 | if tick.label1On and tick.label1.get_visible(): 98 | extent = tick.label1.get_window_extent(renderer) 99 | ticklabelBoxes.append(extent) 100 | if tick.label2On and tick.label2.get_visible(): 101 | extent = tick.label2.get_window_extent(renderer) 102 | ticklabelBoxes2.append(extent) 103 | 104 | # scale up the axis label box to also find the neighbors, not 105 | # just the tick labels that actually overlap note we need a 106 | # *copy* of the axis label box because we don't wan't to scale 107 | # the actual bbox 108 | 109 | self._update_label_position(ticklabelBoxes, ticklabelBoxes2) 110 | 111 | self.label.draw(renderer) 112 | 113 | self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2) 114 | self.offsetText.set_text( self.major.formatter.get_offset() ) 115 | self.offsetText.draw(renderer) 116 | 117 | class SkewXAxes(Axes): 118 | # The projection must specify a name. This will be used be the 119 | # user to select the projection, i.e. ``subplot(111, 120 | # projection='skewx')``. 121 | name = 'skewx' 122 | 123 | def _init_axis(self): 124 | #Taken from Axes and modified to use our modified X-axis 125 | "move this out of __init__ because non-separable axes don't use it" 126 | self.xaxis = SkewXAxis(self) 127 | self.yaxis = maxis.YAxis(self) 128 | self._update_transScale() 129 | 130 | # def get_axes_patch(self): 131 | # """ 132 | # Override this method to define the shape that is used for the 133 | # background of the plot. It should be a subclass of Patch. 134 | 135 | # In this case, it is a Circle (that may be warped by the axes 136 | # transform into an ellipse). Any data and gridlines will be 137 | # clipped to this shape. 138 | # """ 139 | # return Circle((0.5, 0.5), 0.5) 140 | 141 | def draw(self, *args): 142 | ''' 143 | draw() is overridden here to allow the data transform to be updated 144 | before calling the Axes.draw() method. This allows resizes to be 145 | properly handled without registering callbacks. The amount of 146 | work done here is kept to a minimum. 147 | ''' 148 | self._update_data_transform() 149 | Axes.draw(self, *args) 150 | 151 | def _update_data_transform(self): 152 | ''' 153 | This separates out the creating of the data transform so that 154 | it alone is updated at draw time. 155 | ''' 156 | # This transforms x in pixel space to be x + the offset in y from 157 | # the lower left corner - producing an x-axis sloped 45 degrees 158 | # down, or x-axis grid lines sloped 45 degrees to the right 159 | self.transProjection.set(transforms.Affine2D( 160 | np.array([[1, 1, -self.bbox.ymin], [0, 1, 0], [0, 0, 1]]))) 161 | 162 | # Full data transform 163 | self.transData.set(self._transDataNonskew + self.transProjection) 164 | 165 | def _set_lim_and_transforms(self): 166 | """ 167 | This is called once when the plot is created to set up all the 168 | transforms for the data, text and grids. 169 | """ 170 | #Get the standard transform setup from the Axes base class 171 | Axes._set_lim_and_transforms(self) 172 | 173 | #Save the unskewed data transform for our own use when regenerating 174 | #the data transform. The user might want this as well 175 | self._transDataNonskew = self.transData 176 | 177 | #Create a wrapper for the data transform, so that any object that 178 | #grabs this transform will see an updated version when we change it 179 | self.transData = transforms.TransformWrapper( 180 | transforms.IdentityTransform()) 181 | 182 | #Create a wrapper for the proj. transform, so that any object that 183 | #grabs this transform will see an updated version when we change it 184 | self.transProjection = transforms.TransformWrapper( 185 | transforms.IdentityTransform()) 186 | self._update_data_transform() 187 | 188 | def get_xaxis_transform(self, which='grid'): 189 | """ 190 | Get the transformation used for drawing x-axis labels, ticks 191 | and gridlines. The x-direction is in data coordinates and the 192 | y-direction is in axis coordinates. 193 | 194 | We override here so that the x-axis gridlines get properly 195 | transformed for the skewed plot. 196 | """ 197 | return self._xaxis_transform + self.transProjection 198 | 199 | # Disable panning until we find a way to handle the problem with 200 | # the projection 201 | def start_pan(self, x, y, button): 202 | pass 203 | 204 | def end_pan(self): 205 | pass 206 | 207 | def drag_pan(self, button, key, x, y): 208 | pass 209 | 210 | # Now register the projection with matplotlib so the user can select 211 | # it. 212 | register_projection(SkewXAxes) 213 | 214 | def draw_skewt(p, h, T, Td, u, v, imagename, title = None, show = False): 215 | ''' 216 | If you want to plot a skewt, skewt.draw_skewt 217 | 218 | 219 | Inputs: 220 | p -> 1d numpy array, pressure in Pa/100.0 (hPa) 221 | h -> 1d numpy array, height in m 222 | t -> 1d numpy array, temp in C 223 | td -> 1d numpy array, dew pt temp in C 224 | imagename -> string, the name you want to call the image ... i.e. louise.png 225 | 226 | Optional Inputs: 227 | title -> string, obvious really 228 | show -> True/False, if True will open and show plot, if false, will just save to image file. 229 | 230 | Example usage: 231 | skewt.draw_skewt(p/100.0 (Grrr), h, t (C), td (C), 'louse.png', title = 'woo.png', show = False) 232 | 233 | ''' 234 | 235 | # print "repr(p)" 236 | # print repr(p) 237 | # print "repr(h)" 238 | # print repr(h) 239 | # print "repr(T)" 240 | # print repr(T) 241 | # print "repr(Td)" 242 | # print repr(Td) 243 | # 244 | plt.rcParams.update({'axes.linewidth':1,'ytick.color':'k'}) 245 | 246 | fig = plt.figure(1, figsize=(6.5875, 6.2125)) 247 | fig.clf() 248 | 249 | ax = fig.add_axes([.125,.1,.7,.8], projection='skewx') 250 | 251 | ax.grid(True) 252 | 253 | ax.semilogy(T, p, 'r') 254 | ax.semilogy(Td, p, 'g') 255 | 256 | xticklocs=np.arange(-80,45,10) 257 | 258 | # T0 = ax.get_xticks() 259 | T0 = xticklocs 260 | P0 = 1000. 261 | R = 287.05 262 | Cp = 1004. 263 | P = np.linspace(*ax.get_ylim()).reshape(1, -1) 264 | 265 | T = (T0[:,np.newaxis] + 273.15) * (P/P0)**(R/Cp) - 273.15 266 | linedata = [np.vstack((t[np.newaxis,:], P)).T for t in T] 267 | dry_adiabats = LineCollection(linedata, colors='r', linestyles='dashed', 268 | alpha=0.5) 269 | ax.add_collection(dry_adiabats) 270 | 271 | w = np.array([0.0004,0.001, 0.002, 0.004, 0.007, 0.01, 0.016, 0.024, 272 | 0.032]).reshape(-1, 1) 273 | e = P * w / (0.622 + w) 274 | T = 243.5/(17.67/np.log(e/6.112) - 1) 275 | linedata = [np.vstack((t[np.newaxis,:], P)).T for t in T] 276 | mixing = LineCollection(linedata, colors='g', linestyles='dashed', 277 | alpha=0.8) 278 | ax.add_collection(mixing) 279 | 280 | # Lv = 2.4e6 281 | # T = T[:,0][:,np.newaxis] * (P/P0)**(R/Cp) - (Lv/Cp) * w 282 | # linedata = [np.vstack((t[np.newaxis,:], P)).T for t in T] 283 | # moist_adiabat = LineCollection(linedata, colors='b', linestyles='dashed', 284 | # alpha=0.8) 285 | # ax.add_collection(moist_adiabat) 286 | 287 | 288 | ax.set_ylabel('Pressure (hPa)') 289 | ax.set_xlabel('Temperature (C)') 290 | if isinstance(title, str): 291 | ax.title.set_text(title) 292 | 293 | # change plotting parameters : white box, white tick labels 294 | plt.rcParams.update({'axes.linewidth':0,'ytick.color':'k', 'ytick.major.size':0, 'ytick.minor.size':0}) 295 | #plt.rcParams.update({'axes.linewidth':0,'ytick.color':'w', 'ytick.major.size':0, 'ytick.minor.size':0}) #simon changed 296 | 297 | wbax=fig.add_axes([0.85,0.1,0.125,0.8],sharey=ax) 298 | wbax.barbs(np.zeros(p.shape)[::2], p[::2], u[::2], v[::2]) 299 | 300 | wbax.xaxis.set_ticks([],[]) 301 | for tick in wbax.yaxis.get_major_ticks(): 302 | tick.label1On = False 303 | 304 | ax.set_yticks(np.linspace(100,1000,10)) 305 | ax.yaxis.set_major_formatter(ScalarFormatter()) 306 | ax.set_xticks(xticklocs) 307 | ax.set_xlim(-40,45) 308 | ax.set_ylim(1050,100) 309 | 310 | pylab.savefig(imagename) 311 | 312 | # if show: 313 | plt.draw() 314 | #plt.show() 315 | -------------------------------------------------------------------------------- /library/wrf_user_unstagger.pyx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as np 3 | cimport numpy as np 4 | cimport cython 5 | #from datetime import datetime 6 | 7 | DTYPE = np.float32 8 | 9 | def wrf_user_unstagger_ARW(varin, unstagDim): 10 | #begin = datetime.now() 11 | dims = np.shape(varin) 12 | nd = np.shape(dims)[0] 13 | 14 | #print(unstagDim, nd) 15 | if unstagDim == "X" or unstagDim == "U": 16 | dimU = dims[nd - 1] 17 | if nd == 5: 18 | varout = 0.5 * ( 19 | varin[:, :, :, :, :dimU - 2] + varin[:, :, :, :, 1:dimU - 0]) 20 | elif nd == 4: 21 | varout = 0.5 * ( 22 | varin[:, :, :, :dimU - 1] + varin[:, :, :, 1:dimU - 0]) 23 | elif nd == 3: 24 | varout = 0.5 * (varin[:, :, :dimU - 1] + varin[:, :, 1:dimU - 0]) 25 | elif nd == 2: 26 | varout = 0.5 * (varin[:, :dimU - 1] + varin[:, 1:dimU - 0]) 27 | elif unstagDim == "Y" or unstagDim == "V": 28 | dimV = dims[nd - 2] 29 | if nd == 5: 30 | varout = 0.5 * ( 31 | varin[:, :, :, :dimV - 1, :] + varin[:, :, :, 1:dimV - 0, :]) 32 | elif nd == 4: 33 | varout = 0.5 * ( 34 | varin[:, :, :dimV - 1, :] + varin[:, :, 1:dimV - 0, :]) 35 | elif nd == 3: 36 | varout = 0.5 * (varin[:, :dimV - 1, :] + varin[:, 1:dimV - 0, :]) 37 | elif nd == 2: 38 | varout = 0.5 * (varin[:dimV - 1, :] + varin[1:dimV - 0, :]) 39 | elif unstagDim == "Z": 40 | dimW = dims[nd - 3] 41 | if nd == 5: 42 | varout = 0.5 * ( 43 | varin[:, :, 0:dimW - 1, :, :] + varin[:, :, 1:dimW - 0, :, :]) 44 | elif nd == 4: 45 | varout = 0.5 * ( 46 | varin[:, 0:dimW - 1, :, :] + varin[:, 1:dimW - 0, :, :]) 47 | elif nd == 3: 48 | varout = 0.5 * (varin[0:dimW - 1, :, :] + varin[1:dimW - 0, :, :]) 49 | elif nd == 2: 50 | varout = 0.5 * (varin[:, 0:dimW - 1] + varin[:, 1:dimW - 0]) 51 | elif unstagDim == "M": 52 | print('staggared dim is "M", no support for this yet') 53 | varout = varin 54 | 55 | #print(f'total time for ARW destagger was {(datetime.now() - begin).total_seconds()}') 56 | for ele in ["X", "U", "Y", "V", "Z", "M"]: 57 | if (unstagDim == ele): 58 | return varout 59 | 60 | def unstagger_NMM_Z(varin): 61 | #begin = datetime.now() 62 | dims_in = np.shape(varin) 63 | n_dims = len(dims_in) 64 | dimW = dims_in[n_dims - 3] 65 | if (n_dims == 5): 66 | var_out = 0.5 * ( 67 | varin[:, :, 0:dimW - 1, :, :] + varin[:, :, 1:dimW - 0, :, :]) 68 | if (n_dims == 4): 69 | var_out = 0.5 * ( 70 | varin[:, 0:dimW - 1, :, :] + varin[:, 1:dimW - 0, :, :]) 71 | if (n_dims == 3): 72 | var_out = 0.5 * (varin[:, 0:dimW - 1] + varin[:, 1:dimW - 0]) 73 | if (n_dims == 2): 74 | var_out = 0.5 * (varin[:, 0:dimW - 1] + varin[:, 1:dimW - 0]) 75 | #print(f'total time for unstag_Z was {(datetime.now() - begin).total_seconds()}') 76 | return var_out 77 | 78 | 79 | @cython.boundscheck(False) 80 | @cython.wraparound(False) 81 | def get_gridmask_NMM(Py_ssize_t dim_ns, Py_ssize_t dim_we, str unstagDim): 82 | """ 83 | This part is general and should not depend on the 84 | higher dimenions, essentially setting up how the 85 | grid is structured 86 | """ 87 | 88 | #begin = datetime.now() 89 | grid_mask = np.zeros((dim_ns, dim_we), dtype=DTYPE) 90 | cdef float[:, :] grid_mask_view = grid_mask 91 | cdef float NaN = float('NaN') 92 | cdef Py_ssize_t ii, jj 93 | 94 | if unstagDim == 'H' or unstagDim == 'Z': 95 | grid_mask_view[:, :] = NaN 96 | elif unstagDim == 'V': 97 | grid_mask_view[:, :] = 1 98 | 99 | if unstagDim == 'H' or unstagDim == 'Z': 100 | for ii in range(dim_ns): 101 | for jj in range(dim_we): 102 | if ii % 2 == 0 and jj % 2 == 0: 103 | grid_mask_view[ii, jj] = 1 104 | elif ii % 2 == 1 and jj % 2 == 1: 105 | grid_mask_view[ii, jj] = 1 106 | elif unstagDim == 'V': 107 | for ii in range(dim_ns): 108 | for jj in range(dim_we): 109 | if ii % 2 == 0 and jj % 2 == 0: 110 | grid_mask_view[ii, jj] = NaN 111 | elif ii % 2 == 1 and jj % 2 == 1: 112 | grid_mask_view[ii, jj] = NaN 113 | #print(f'total time for grid_mask was {(datetime.now() - begin).total_seconds()}') 114 | return grid_mask 115 | 116 | #@cython.boundscheck(False) 117 | #@cython.wraparound(False) 118 | #def regrid_NMM_rank2(np.ndarray[float, ndim=2] varin, np.ndarray[float, ndim=2] grid_mask, unstagDim): 119 | # """ 120 | # Function to regrid the NMM data when dealing with 121 | # 2-dimenional arrays. 122 | # Actually this probably never occurs due to the fact that if 123 | # we have 2-d data one of them is probably time or level 124 | # """ 125 | 126 | @cython.boundscheck(False) 127 | @cython.wraparound(False) 128 | def regrid_NMM_rank3(np.ndarray[float, ndim=3] varin, np.ndarray[float, ndim=2] grid_mask, str unstagDim): 129 | """ 130 | Function to regrid the NMM data when dealing with 131 | 3-dimenional arrays 132 | """ 133 | 134 | #begin = datetime.now() 135 | cdef float NaN = float('NaN') 136 | cdef int dim_we_orig = np.shape(varin)[2] 137 | cdef Py_ssize_t dim1 = np.shape(varin)[0] # typically time but not neccessarly 138 | cdef Py_ssize_t dim_ns = np.shape(varin)[1] 139 | cdef Py_ssize_t dim_we = np.shape(varin)[2] * 2 140 | cdef Py_ssize_t indx_1 # dim1 index 141 | cdef Py_ssize_t ii, jj # spatial index 142 | cdef Py_ssize_t ii_count = 0 # spatial indx on orig grid 143 | cdef Py_ssize_t jj_count = 0 # spatial indx on orig grid 144 | # defined view_arrays for fast access 145 | cdef float[:, :, :] varin_view = varin 146 | cdef float[:, :] grid_mask_view = grid_mask 147 | var_out = np.zeros((dim1, dim_ns, dim_we), dtype=DTYPE) 148 | cdef float[:, :, :] var_out_view = var_out 149 | var_out_view[:, :, :] = NaN 150 | 151 | for indx_1 in range(dim1): 152 | ii_count = 0 153 | jj_count = 0 154 | for ii in range(dim_ns): 155 | for jj in range(dim_we): 156 | # nans and equality are tricky if we are not using is.nan 157 | if grid_mask_view[ii, jj] == 1: 158 | var_out_view[indx_1, ii, jj] = varin_view[indx_1, ii_count, jj_count] 159 | jj_count = jj_count + 1 160 | if jj_count == dim_we_orig: 161 | jj_count = 0 162 | ii_count = ii_count + 1 163 | 164 | #print(f'total time for fill was {(datetime.now() - begin).total_seconds()}') 165 | #begin = datetime.now() 166 | # now use your copied values to fill in the blank spots 167 | #this method uses 4 grid ;points to work out the value of the point, the borders have nans though 168 | cdef float var1 169 | cdef float var2 170 | cdef float var3 171 | cdef float var4 172 | 173 | for indx_1 in range(dim1): 174 | for ii in range(1, dim_ns-1): 175 | for jj in range(1, dim_we-1): 176 | if grid_mask_view[ii, jj] != 1: 177 | var1 = var_out_view[indx_1, ii - 1, jj] 178 | var2 = var_out_view[indx_1, ii + 1, jj] 179 | var3 = var_out_view[indx_1, ii, jj - 1] 180 | var4 = var_out_view[indx_1, ii, jj + 1] 181 | var_out_view[indx_1, ii, jj] = 0.25 * (var1 + var2 + var3 + var4) 182 | # below fixes the "edge" problem caused by destaggering 183 | #print(f'total time for interp was {(datetime.now() - begin).total_seconds()}') 184 | return var_out[:, 1:dim_ns-1, 1:dim_we-1] 185 | 186 | @cython.boundscheck(False) 187 | @cython.wraparound(False) 188 | def regrid_NMM_rank4(np.ndarray[float, ndim=4] varin, np.ndarray[float, ndim=2] grid_mask, str unstagDim): 189 | """ 190 | Function to regrid the NMM data when dealing with 191 | 4-dimenional arrays 192 | """ 193 | #begin = datetime.now() 194 | cdef float NaN = float('NaN') 195 | cdef Py_ssize_t dim1 = np.shape(varin)[0] # typically time but not neccessarly 196 | cdef Py_ssize_t dim2 = np.shape(varin)[1] # typically bottom-top but not necessarly 197 | cdef Py_ssize_t dim_ns = np.shape(varin)[2] 198 | cdef int dim_we_orig = np.shape(varin)[3] 199 | cdef Py_ssize_t dim_we = np.shape(varin)[3] * 2 200 | cdef Py_ssize_t indx_1 # dim1 index 201 | cdef Py_ssize_t indx_2 # dim2 index 202 | cdef Py_ssize_t ii, jj # spatial index 203 | cdef Py_ssize_t ii_count = 0 # spatial indx on orig grid 204 | cdef Py_ssize_t jj_count = 0 # spatial indx on orig grid 205 | 206 | # defined view_arrays for fast access 207 | cdef float[:, :, :, :] varin_view = varin 208 | cdef float[:, :] grid_mask_view = grid_mask 209 | var_out = np.zeros((dim1, dim2, dim_ns, dim_we), dtype=DTYPE) 210 | cdef float[:, :, :, :] var_out_view = var_out 211 | var_out_view[:, :, :, :] = NaN 212 | 213 | for indx_1 in range(dim1): 214 | for indx_2 in range(dim2): 215 | ii_count = 0 216 | jj_count = 0 217 | for ii in range(dim_ns): 218 | for jj in range(dim_we): 219 | if grid_mask_view[ii, jj] == 1: 220 | var_out_view[indx_1, indx_2, ii, jj] = varin_view[indx_1, indx_2, ii_count, jj_count] 221 | jj_count = jj_count + 1 222 | if jj_count == dim_we_orig: 223 | jj_count = 0 224 | ii_count = ii_count + 1 225 | 226 | #print(f'total time for fill was {(datetime.now() - begin).total_seconds()}') 227 | #begin = datetime.now() 228 | # now use your copied values to fill in the blank spots 229 | #this method uses 4 grid ;points to work out the value of the point, the borders have nans though 230 | cdef float var1 231 | cdef float var2 232 | cdef float var3 233 | cdef float var4 234 | 235 | for indx_1 in range(dim1): 236 | for indx_2 in range(dim2): 237 | for ii in range(1, dim_ns-1): 238 | for jj in range(1, dim_we-1): 239 | if grid_mask_view[ii, jj] != 1: 240 | var1 = var_out_view[indx_1, indx_2, ii - 1, jj] 241 | var2 = var_out_view[indx_1, indx_2, ii + 1, jj] 242 | var3 = var_out_view[indx_1, indx_2, ii, jj - 1] 243 | var4 = var_out_view[indx_1, indx_2, ii, jj + 1] 244 | var_out_view[indx_1, indx_2, ii, jj] = 0.25 * (var1 + var2 + var3 + var4) 245 | # below fixes the "edge" problem caused by destaggering 246 | 247 | #print(f'total time for interp was {(datetime.now() - begin).total_seconds()}') 248 | return var_out[:, :, 1:dim_ns-1, 1:dim_we-1] 249 | 250 | 251 | def wrf_user_unstagger_NMM(varin, unstagDim): 252 | if unstagDim == "Z": 253 | var_out = unstagger_NMM_Z(varin) 254 | # Incase we Destaggered Z## we need to also do the we dim## 255 | varin = var_out 256 | 257 | n_dims = len(np.shape(varin)) 258 | #print(unstagDim, n_dims) 259 | 260 | if n_dims == 2: 261 | # we only have time and height so no need for spatial fix 262 | return var_out 263 | #if n_dims == 2: 264 | # # will never hit as is coded now 265 | # return regrid_NMM_rank2(varin, unstagDim) 266 | 267 | n_dims = len(np.shape(varin)) 268 | dim_ns_in = np.shape(varin)[n_dims - 2] 269 | dim_we_in = np.shape(varin)[n_dims - 1] 270 | dim_ns_out = dim_ns_in 271 | dim_we_out = dim_we_in * 2 272 | grid_mask = get_gridmask_NMM(dim_ns_out, dim_we_out, unstagDim) 273 | 274 | if n_dims == 3: 275 | return regrid_NMM_rank3(varin, grid_mask, unstagDim) 276 | if n_dims == 4: 277 | return regrid_NMM_rank4(varin, grid_mask, unstagDim) 278 | -------------------------------------------------------------------------------- /library/wrf_user_unstagger_pure.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import numpy as np 3 | 4 | 5 | def wrf_user_unstagger_ARW(varin, unstagDim): 6 | dims = () 7 | dims = np.shape(varin) 8 | nd = np.shape(dims)[0] 9 | 10 | print(unstagDim, nd) 11 | if (unstagDim == "X") | (unstagDim == "U"): 12 | dimU = dims[nd - 1] 13 | if (nd == 5): 14 | varout = 0.5 * ( 15 | varin[:, :, :, :, :dimU - 2] + varin[:, :, :, :, 1:dimU - 0]) 16 | 17 | if (nd == 4): 18 | varout = 0.5 * ( 19 | varin[:, :, :, :dimU - 1] + varin[:, :, :, 1:dimU - 0]) 20 | 21 | if (nd == 3): 22 | varout = 0.5 * (varin[:, :, :dimU - 1] + varin[:, :, 1:dimU - 0]) 23 | 24 | if (nd == 2): 25 | varout = 0.5 * (varin[:, :dimU - 1] + varin[:, 1:dimU - 0]) 26 | 27 | if (unstagDim == "Y") | (unstagDim == "V"): 28 | dimV = dims[nd - 2] 29 | if (nd == 5): 30 | varout = 0.5 * ( 31 | varin[:, :, :, :dimV - 1, :] + varin[:, :, :, 1:dimV - 0, :]) 32 | 33 | if (nd == 4): 34 | varout = 0.5 * ( 35 | varin[:, :, :dimV - 1, :] + varin[:, :, 1:dimV - 0, :]) 36 | 37 | if (nd == 3): 38 | varout = 0.5 * (varin[:, :dimV - 1, :] + varin[:, 1:dimV - 0, :]) 39 | 40 | if (nd == 2): 41 | varout = 0.5 * (varin[:dimV - 1, :] + varin[1:dimV - 0, :]) 42 | 43 | if (unstagDim == "Z"): 44 | dimW = dims[nd - 3] 45 | if (nd == 5): 46 | varout = 0.5 * ( 47 | varin[:, :, 0:dimW - 1, :, :] + varin[:, :, 1:dimW - 0, :, :]) 48 | 49 | if (nd == 4): 50 | varout = 0.5 * ( 51 | varin[:, 0:dimW - 1, :, :] + varin[:, 1:dimW - 0, :, :]) 52 | 53 | if (nd == 3): 54 | varout = 0.5 * (varin[0:dimW - 1, :, :] + varin[1:dimW - 0, :, :]) 55 | 56 | if (nd == 2): 57 | varout = 0.5 * (varin[:, 0:dimW - 1] + varin[:, 1:dimW - 0]) 58 | 59 | 60 | if (unstagDim == "M"): 61 | print('staggared dim is "M", no support for this yet') 62 | varout = varin 63 | 64 | for ele in ["X", "U", "Y", "V", "Z", "M"]: 65 | if (unstagDim == ele): 66 | return varout 67 | 68 | def unstagger_NMM_Z(varin): 69 | dims_in = np.shape(varin) 70 | n_dims = len(dims_in) 71 | dimW = dims_in[n_dims - 3] 72 | if (n_dims == 5): 73 | var_out = 0.5 * ( 74 | varin[:, :, 0:dimW - 1, :, :] + varin[:, :, 1:dimW - 0, :, :]) 75 | if (n_dims == 4): 76 | var_out = 0.5 * ( 77 | varin[:, 0:dimW - 1, :, :] + varin[:, 1:dimW - 0, :, :]) 78 | if (n_dims == 3): 79 | var_out = 0.5 * (varin[:, 0:dimW - 1] + varin[:, 1:dimW - 0]) 80 | if (n_dims == 2): 81 | var_out = 0.5 * (varin[:, 0:dimW - 1] + varin[:, 1:dimW - 0]) 82 | return var_out 83 | 84 | 85 | def get_gridmask_NMM(dim_ns_out, dim_we_out, unstagDim): 86 | """ 87 | This part is general and should not depend on the 88 | higher dimenions, essentially setting up how the 89 | grid is structured 90 | """ 91 | 92 | grid_mask = np.zeros((dim_ns_out, dim_we_out), dtype="float") 93 | 94 | if (unstagDim == 'H'): 95 | grid_mask[:, :] = np.nan 96 | if (unstagDim == 'V'): 97 | grid_mask[:, :] = 1 98 | if (unstagDim == 'Z'): 99 | grid_mask[:, :] = np.nan 100 | 101 | for ii in range(dim_ns_out): 102 | for jj in range(dim_we_out): 103 | if np.mod(ii, 2) == 0 and np.mod(jj, 2) == 0: 104 | if unstagDim == 'H' or unstagDim == 'Z': 105 | grid_mask[ii, jj] = 1 106 | elif unstagDim == 'V': 107 | grid_mask[ii, jj] = np.nan 108 | 109 | if np.mod(ii, 2) == 1 and np.mod(jj, 2) == 1: 110 | if unstagDim == 'H' or unstagDim == 'Z': 111 | grid_mask[ii, jj] = 1 112 | if unstagDim == 'V': 113 | grid_mask[ii, jj] = np.nan 114 | return grid_mask 115 | 116 | 117 | def regrid_NMM_rank2(varin, unstagDim): 118 | """ 119 | Function to regrid the NMM data when dealing with 120 | 2-dimenional arrays. 121 | Actually this probably never occurs due to the fact that if 122 | we have 2-d data one of them is probably time or level 123 | """ 124 | 125 | n_dims = len(np.shape(varin)) 126 | # spatial dimensions are always the last two 127 | dim_ns_in = np.shape(varin)[n_dims - 2] 128 | dim_we_in = np.shape(varin)[n_dims - 1] 129 | # output grid will have double the WE dimension 130 | dim_ns_out = dim_ns_in 131 | dim_we_out = dim_we_in * 2 132 | 133 | grid_mask = get_gridmask_NMM(dim_ns_out, dim_we_out, unstagDim) 134 | 135 | # 2 times but no time, i dont think this ever occurs 136 | var_out = np.zeros((dim_ns_out, dim_we_out), dtype="float") 137 | var_out[:, :] = grid_mask[:, :] 138 | ii_count = 0 139 | jj_count = 0 140 | for ii in range(dim_ns_out): 141 | for jj in range(dim_we_out): 142 | if not np.isnan(grid_mask[ii, jj]): 143 | var_out[ii, jj] = varin[ii_count, jj_count] 144 | jj_count = jj_count + 1 145 | if jj_count == dim_we_in: 146 | jj_count = 0 147 | ii_count = ii_count + 1 148 | # now use your copied values to fill in the blank spots 149 | #this method uses 4 grid ;points to work out the value of the point, the borders have nans though 150 | ns_dim = np.shape(grid_mask)[0] 151 | we_dim = np.shape(grid_mask)[1] 152 | for ii in range(1, ns_dim-1): 153 | for jj in range(1, we_dim-1): 154 | if np.isnan(grid_mask[ii, jj]): 155 | var1 = var_out[ii - 1, jj] 156 | var2 = var_out[ii + 1, jj] 157 | var3 = var_out[ii, jj - 1] 158 | var4 = var_out[ii, jj + 1] 159 | var_out[ii, jj] = 0.25 * (var1 + var2 + var3 + var4) 160 | # below fixes the "edge" problem caused by destaggering 161 | return var_out[1:ns_dim-1, 1:we_dim-1] 162 | 163 | def regrid_NMM_rank3(varin, unstagDim): 164 | """ 165 | Function to regrid the NMM data when dealing with 166 | 3-dimenional arrays 167 | """ 168 | 169 | n_dims = len(np.shape(varin)) 170 | # spatial dimensions are always the last two 171 | dim_ns_in = np.shape(varin)[n_dims - 2] 172 | dim_we_in = np.shape(varin)[n_dims - 1] 173 | # output grid will have double the WE dimension 174 | dim_ns_out = dim_ns_in 175 | dim_we_out = dim_we_in * 2 176 | 177 | grid_mask = get_gridmask_NMM(dim_ns_out, dim_we_out, unstagDim) 178 | 179 | ## 180 | dim1 = np.shape(varin)[0] 181 | var_out = np.zeros((dim1, dim_ns_out, dim_we_out), dtype="float") 182 | var_out[:, :, :] = np.nan 183 | ii_count = 0 184 | jj_count = 0 185 | for ii in range(dim_ns_out): 186 | for jj in range(dim_we_out): 187 | if not np.isnan(grid_mask[ii, jj]): 188 | var_out[:, ii, jj] = varin[:, ii_count, jj_count] 189 | jj_count = jj_count + 1 190 | if (jj_count == dim_we_in): 191 | jj_count = 0 192 | ii_count = ii_count + 1 193 | # now use your copied values to fill in the blank spots 194 | #this method uses 4 grid ;points to work out the value of the point, the borders have nans though 195 | ns_dim = np.shape(grid_mask)[0] 196 | we_dim = np.shape(grid_mask)[1] 197 | for dim_1 in range(dim1): 198 | for ii in range(1, ns_dim-1): 199 | for jj in range(1, we_dim-1): 200 | if np.isnan(grid_mask[ii, jj]): 201 | var1 = var_out[dim_1, ii - 1, jj] 202 | var2 = var_out[dim_1, ii + 1, jj] 203 | var3 = var_out[dim_1, ii, jj - 1] 204 | var4 = var_out[dim_1, ii, jj + 1] 205 | var_out[dim_1, ii, jj] = 0.25 * (var1 + var2 + var3 + var4) 206 | # below fixes the "edge" problem caused by destaggering 207 | return var_out[:, 1:ns_dim-1, 1:we_dim-1] 208 | 209 | def regrid_NMM_rank4(varin, unstagDim): 210 | """ 211 | Function to regrid the NMM data when dealing with 212 | 4-dimenional arrays 213 | """ 214 | 215 | n_dims = len(np.shape(varin)) 216 | # spatial dimensions are always the last two 217 | dim_ns_in = np.shape(varin)[n_dims - 2] 218 | dim_we_in = np.shape(varin)[n_dims - 1] 219 | # output grid will have double the WE dimension 220 | dim_ns_out = dim_ns_in 221 | dim_we_out = dim_we_in * 2 222 | 223 | grid_mask = get_gridmask_NMM(dim_ns_out, dim_we_out, unstagDim) 224 | 225 | ## 226 | dim1 = np.shape(varin)[0] 227 | dim2 = np.shape(varin)[1] 228 | var_out = np.zeros((dim1, dim2, dim_ns_out, dim_we_out), dtype="float") 229 | var_out[:, :, :, :] = np.nan 230 | ii_count = 0 231 | jj_count = 0 232 | for ii in range(dim_ns_out): 233 | for jj in range(dim_we_out): 234 | if not np.isnan(grid_mask[ii, jj]): 235 | var_out[:, :, ii, jj] = varin[:, :, ii_count, jj_count] 236 | jj_count = jj_count + 1 237 | if jj_count == dim_we_in: 238 | jj_count = 0 239 | ii_count = ii_count + 1 240 | # now use your copied values to fill in the blank spots 241 | #this method uses 4 grid ;points to work out the value of the point, the borders have nans though 242 | ns_dim = np.shape(grid_mask)[0] 243 | we_dim = np.shape(grid_mask)[1] 244 | test = np.zeros((4, dim2)) 245 | for dim_1 in range(dim1): 246 | for ii in range(1, ns_dim-1): 247 | for jj in range(1, we_dim-1): 248 | if np.isnan(grid_mask[ii, jj]): 249 | test[0, :] = var_out[dim_1, :, ii - 1, jj] 250 | test[1, :] = var_out[dim_1, :, ii + 1, jj] 251 | test[2, :] = var_out[dim_1, :, ii, jj - 1] 252 | test[3, :] = var_out[dim_1, :, ii, jj + 1] 253 | var_out[dim_1, :, ii, jj] = 0.25 * np.sum(test, 0) 254 | # below fixes the "edge" problem caused by destaggering 255 | return var_out[:, :, 1:ns_dim-1, 1:we_dim-1] 256 | 257 | 258 | def wrf_user_unstagger_NMM(varin, unstagDim): 259 | done_Z = False 260 | if unstagDim == "Z": 261 | var_out = unstagger_NMM_Z(varin) 262 | done_Z = True 263 | # Incase we Destaggered Z## we need to also do the we dim## 264 | varin = var_out 265 | 266 | n_dims = len(np.shape(varin)) 267 | print(unstagDim, n_dims) 268 | if n_dims == 2: 269 | # we only have time and height so no need for spatial fix 270 | return var_out 271 | if n_dims == 2: 272 | # will never hit as is coded now 273 | return regrid_NMM_rank2(varin, unstagDim) 274 | if n_dims == 3: 275 | return regrid_NMM_rank3(varin, unstagDim) 276 | if n_dims == 4: 277 | return regrid_NMM_rank4(varin, unstagDim) 278 | -------------------------------------------------------------------------------- /sample/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 24 5 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn/wrf_project/sample 6 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn 7 | 8 | 9 | 10 | 2012-03-14T01:38:45.822261Z 11 | 18 12 | scaine 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 717768ba-3af3-49a0-9c46-b1c1e31f1073 28 | 29 | WRFUserARW.ncl 30 | file 31 | 32 | 33 | 34 | 35 | 2012-03-15T01:06:19.000000Z 36 | 5748f443488db0c65ff6689774b599da 37 | 2011-09-13T12:36:55.381351Z 38 | 1 39 | scaine 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 34396 62 | 63 | wrf_user_fortran_util_0.f 64 | file 65 | 66 | 67 | 68 | 69 | 2012-03-15T01:06:19.000000Z 70 | 7ade74722d7b70a088a36a76add8d1ac 71 | 2011-09-13T12:36:55.381351Z 72 | 1 73 | scaine 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 17813 96 | 97 | Ferrier 98 | dir 99 | 100 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 24 5 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn/wrf_project/sample/Ferrier 6 | svn+ssh://scaine@eddy.earthsci.unimelb.edu.au/data/cdgs1/share/simon/svn 7 | 8 | 9 | 10 | 2012-03-14T01:38:45.822261Z 11 | 18 12 | scaine 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 717768ba-3af3-49a0-9c46-b1c1e31f1073 28 | 29 | CALMICT.f 30 | file 31 | 32 | 33 | 34 | 35 | 2012-03-15T01:06:19.000000Z 36 | 920d68e3c8be08267758932fa0fda6b7 37 | 2012-03-14T01:38:45.822261Z 38 | 18 39 | scaine 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 10400 62 | 63 | MICROINIT.f 64 | file 65 | 66 | 67 | 68 | 69 | 2012-03-15T01:06:19.000000Z 70 | aea7d5d800a1750ba7d4b7a2c15ad86d 71 | 2012-03-14T01:38:45.822261Z 72 | 18 73 | scaine 74 | has-props 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 2118 96 | 97 | eta_micro_lookup.dat 98 | file 99 | 100 | 101 | 102 | 103 | 2012-03-15T01:06:19.000000Z 104 | fac8a9f1b73c62777675d77aeb1be4a7 105 | 2012-03-14T01:38:45.822261Z 106 | 18 107 | scaine 108 | has-props 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 30200 130 | 131 | CMASSI.f 132 | file 133 | 134 | 135 | 136 | 137 | 2012-03-15T01:06:19.000000Z 138 | c427d7085c3f06d491ae7ba0e0db71ca 139 | 2012-03-14T01:38:45.822261Z 140 | 18 141 | scaine 142 | has-props 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 992 164 | 165 | params.f 166 | file 167 | 168 | 169 | 170 | 171 | 2012-03-15T01:06:19.000000Z 172 | bbe2a3cc3c957f047279e2c01a760158 173 | 2012-03-14T01:38:45.822261Z 174 | 18 175 | scaine 176 | has-props 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 3735 198 | 199 | CALMICT.f90 200 | file 201 | 202 | 203 | 204 | 205 | 2012-03-15T01:06:19.000000Z 206 | b58351a9daac0365ff852702e92545c5 207 | 2012-03-14T01:38:45.822261Z 208 | 18 209 | scaine 210 | has-props 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 11615 232 | 233 | CALMICT.so 234 | file 235 | 236 | 237 | 238 | 239 | 2012-03-15T01:06:19.000000Z 240 | c05f2eab84134317930c678fd2b62a47 241 | 2012-03-14T01:38:45.822261Z 242 | 18 243 | scaine 244 | has-props 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 110756 266 | 267 | CMASSI.f90 268 | file 269 | 270 | 271 | 272 | 273 | 2012-03-15T01:06:19.000000Z 274 | c427d7085c3f06d491ae7ba0e0db71ca 275 | 2012-03-14T01:38:45.822261Z 276 | 18 277 | scaine 278 | has-props 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 992 300 | 301 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/CALMICT.f.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/CALMICT.f90.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/CALMICT.so.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | K 13 6 | svn:mime-type 7 | V 24 8 | application/octet-stream 9 | END 10 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/CMASSI.f.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/CMASSI.f90.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/MICROINIT.f.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/eta_micro_lookup.dat.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 24 4 | application/octet-stream 5 | END 6 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/prop-base/params.f.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 1 4 | * 5 | END 6 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/CALMICT.f.svn-base: -------------------------------------------------------------------------------- 1 | SUBROUTINE CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL, & 2 | QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1,NLICE1) 3 | !$$$ SUBPROGRAM DOCUMENTATION BLOCK 4 | ! . . . 5 | ! SUBPROGRAM: CALMIC COMPUTES HYDROMETEORS 6 | ! PRGRMMR: JIN ORG: W/NP2 DATE: 01-08-14 7 | ! 8 | ! ABSTRACT: 9 | ! THIS ROUTINE COMPUTES THE MIXING RATIOS OF CLOUD WATER, 10 | ! CLOUD ICE, RAIN, AND SNOW. THE CODE IS BASED ON SUBROUTINES 11 | ! GSMDRIVE & GSMCOLUMN IN THE NMM MODEL. 12 | ! 13 | ! PROGRAM HISTORY LOG: 14 | ! 01-08-14 YI JIN 15 | ! 02-02-11 Brad Ferrier - Minor changes for consistency w/ NMM model 16 | ! 04-11-10 Brad Ferrier - Removed cloud fraction algorithm 17 | ! 04-11-17 H CHUANG - WRF VERSION 18 | ! USAGE: CALL CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL 19 | ! &, QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1) 20 | ! INPUT ARGUMENT LIST: 21 | ! P1D - PRESSURE (PA) 22 | ! T1D - TEMPERATURE (K) 23 | ! Q1D - SPECIFIC HUMIDITY (KG/KG) 24 | ! C1D - TOTAL CONDENSATE (CWM, KG/KG) 25 | ! FI1D - F_ice (fraction of condensate in form of ice) 26 | ! FR1D - F_rain (fraction of liquid water in form of rain) 27 | ! FS1D - F_RimeF ("Rime Factor", ratio of total ice growth 28 | ! to deposition growth) 29 | ! CUREFL - Radar reflectivity contribution from convection (mm**6/m**3) 30 | ! 31 | ! OUTPUT ARGUMENT LIST: 32 | ! QW1 - CLOUD WATER MIXING RATIO (KG/KG) 33 | ! QI1 - CLOUD ICE MIXING RATIO (KG/KG) 34 | ! QR1 - RAIN MIXING RATIO (KG/KG) 35 | ! QS1 - "SNOW" (precipitation ice) MIXING RATIO (KG/KG) 36 | ! DBZ1 - Equivalent radar reflectivity factor in dBZ; i.e., 10*LOG10(Z) 37 | ! DBZR - Equivalent radar reflectivity factor from rain in dBZ 38 | ! DBZI - Equivalent radar reflectivity factor from ice (all forms) in dBZ 39 | ! DBZC - Equivalent radar reflectivity factor from parameterized convection in dBZ 40 | ! 41 | ! OUTPUT FILES: 42 | ! NONE 43 | ! 44 | ! SUBPROGRAMS CALLED: 45 | ! FUNCTIONS: 46 | ! FPVS 47 | ! UTILITIES: 48 | ! LIBRARY: 49 | ! NONE 50 | ! 51 | ! ATTRIBUTES: 52 | ! LANGUAGE: FORTRAN 53 | ! MACHINE : IBM SP 54 | !$$$ 55 | ! 56 | !BSF: skip use params_mod 57 | 58 | use cmassi_mod 59 | 60 | !BSF: need to define array limits for im, jm 61 | integer, parameter :: im=100, jm=100 62 | 63 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 64 | implicit none 65 | ! 66 | INTEGER INDEXS, INDEXR 67 | REAL, PARAMETER :: Cice=1.634e13, DBZmin=-20., RD=287.04, & 68 | ONEPS=1.-18.015/28.964 69 | 70 | !BSF: adjust following parameters based on whats in phys/module_mp_etanew.F: 71 | real, parameter :: NLImin=1.E3, NLImax=5.E3 72 | 73 | real,dimension(IM,JM),intent(in) :: P1D,T1D,Q1D,C1D,FI1D,FR1D, & 74 | FS1D,CUREFL 75 | real,dimension(IM,JM),intent(inout) :: QW1,QI1,QR1,QS1,DBZ1,DBZR1,& 76 | DBZI1,DBZC1,NLICE1 77 | 78 | REAL N0r,Ztot,Zrain,Zice,Zconv,Zmin 79 | integer I,J 80 | real TC, Frain,Fice,Flimass,Flarge, & 81 | Fsmall,RimeF,Xsimass,Qice,Qsat,ESAT,WV,RHO,RRHO,RQR, & 82 | DRmm,Qsigrd,WVQW,Dum,XLi,Qlice,WC,DLI,xlimass 83 | !BSF: skip real,external :: fpvs 84 | !************************************************************************ 85 | !--- Determine composition of condensate in the form of cloud water, 86 | ! total ice (cloud ice & snow), & rain following GSMDRIVE in NMM model 87 | ! 88 | Zmin=10.**(0.1*DBZmin) 89 | DO J=JSTA,JEND 90 | DO I=1,IM 91 | QW1(I,J)=0. 92 | QI1(I,J)=0. 93 | QR1(I,J)=0. 94 | QS1(I,J)=0. 95 | NLICE1(I,J)=0. 96 | DBZ1(I,J)=DBZmin 97 | DBZR1(I,J)=DBZmin 98 | DBZI1(I,J)=DBZmin 99 | DBZC1(I,J)=DBZmin 100 | ENDDO 101 | ENDDO 102 | DO J=JSTA,JEND 103 | DO I=1,IM 104 | Zrain=0. !--- Radar reflectivity from rain 105 | Zice=0. !--- Radar reflectivity from ice 106 | Zconv=CUREFL(I,J) !--- Radar reflectivity from convection 107 | IF (C1D(I,J) .LE. EPSQ) THEN 108 | ! 109 | !--- Skip rest of calculatiions if no condensate is present 110 | ! 111 | GO TO 10 112 | ELSE 113 | WC=C1D(I,J) 114 | ENDIF 115 | ! 116 | !--- Code below is from GSMDRIVE for determining: 117 | ! QI1 - total ice (cloud ice & snow) mixing ratio 118 | ! QW1 - cloud water mixing ratio 119 | ! QR1 - rain mixing ratio 120 | ! 121 | TC=T1D(I,J)-TFRZ 122 | Fice=FI1D(I,J) 123 | Frain=FR1D(I,J) 124 | IF (TC.LE.T_ICE .OR. Fice.GE.1.) THEN 125 | ! IF (Fice.GE.1.) THEN 126 | QI1(I,J)=WC 127 | ELSE IF (Fice .LE. 0.) THEN 128 | QW1(I,J)=WC 129 | ELSE 130 | QI1(I,J)=Fice*WC 131 | QW1(I,J)=WC-QI1(I,J) 132 | ENDIF 133 | IF (QW1(I,J).GT.0. .AND. Frain.GT.0.) THEN 134 | IF (Frain .GE. 1.) THEN 135 | QR1(I,J)=QW1(I,J) 136 | QW1(I,J)=0. 137 | ELSE 138 | QR1(I,J)=Frain*QW1(I,J) 139 | QW1(I,J)=QW1(I,J)-QR1(I,J) 140 | ENDIF 141 | ENDIF 142 | !BSF: If you're running the ARW and it has as output arrays qw, qr, qi, then 143 | ! start here. 144 | !-- array QW is the same as the array 'qc' from ARW output 145 | !-- array QR is the same as the array 'qr' from ARW output 146 | !-- array QI is the same as the array 'qs' from ARW output 147 | ! => Here QI includes the total ice, large ice (snow) & small cloud ice 148 | ! This is separated out down below in the code starting with defining 149 | ! the constant 'FLARGE'. 150 | ! 151 | !BSF: skip WV=Q1D(I,J)/(1.-Q1D(I,J)) 152 | ! 153 | !--- Saturation vapor pressure w/r/t water ( >=0C ) or ice ( <0C ) 154 | ! 155 | !BSF: skip ESAT=1000.*FPVS(T1D(I,J)) 156 | !BSF: skip QSAT=EPS*ESAT/(P1D(I,J)-ESAT) 157 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+D608*Q1D(I,J))) 158 | RRHO=1./RHO 159 | ! 160 | !--- Based on code from GSMCOLUMN in model to determine reflectivity from rain 161 | ! 162 | IF (QR1(I,J) .GT. EPSQ) THEN 163 | RQR=RHO*QR1(I,J) 164 | IF (RQR .LE. RQR_DRmin) THEN 165 | N0r=MAX(N0rmin, CN0r_DMRmin*RQR) 166 | INDEXR=MDRmin 167 | ELSE IF (RQR .GE. RQR_DRmax) THEN 168 | N0r=CN0r_DMRmax*RQR 169 | INDEXR=MDRmax 170 | ELSE 171 | N0r=N0r0 172 | INDEXR=MAX( XMRmin, MIN(CN0r0*RQR**.25, XMRmax) ) 173 | ENDIF 174 | ! 175 | !--- INDEXR is the mean drop size in microns; convert to mm 176 | ! 177 | DRmm=1.e-3*REAL(INDEXR) 178 | Zrain=0.72*N0r*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm 179 | ENDIF !--- End IF (QR1(I,J) .GT. EPSQ) block 180 | ! 181 | !--- Based on code from GSMCOLUMN in model to determine partition of 182 | ! total ice into cloud ice & snow (precipitation ice) 183 | ! 184 | IF (QI1(I,J) .GT. EPSQ) THEN 185 | QICE=QI1(I,J) 186 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+ONEPS*Q1D(I,J))) 187 | RRHO=1./RHO 188 | !BSF: skip QSIgrd=RHgrd*QSAT 189 | !BSF: skip WVQW=WV+QW1(I,J) 190 | ! 191 | ! * FLARGE - ratio of number of large ice to total (large & small) ice 192 | ! * FSMALL - ratio of number of small ice crystals to large ice particles 193 | ! -> Small ice particles are assumed to have a mean diameter of 50 microns. 194 | ! * XSIMASS - used for calculating small ice mixing ratio 195 | ! * XLIMASS - used for calculating large ice mixing ratio 196 | ! * INDEXS - mean size of snow to the nearest micron (units of microns) 197 | ! * RimeF - Rime Factor, which is the mass ratio of total (unrimed & 198 | ! rimed) ice mass to the unrimed ice mass (>=1) 199 | ! * FLIMASS - mass fraction of large ice 200 | ! * QTICE - time-averaged mixing ratio of total ice 201 | ! * QLICE - time-averaged mixing ratio of large ice 202 | ! * NLICE1 - time-averaged number concentration of large ice 203 | ! 204 | IF (TC.GE.0.) THEN !-- BSF: skip .OR. WVQW.LT.QSIgrd) THEN 205 | FLARGE=1. 206 | ELSE 207 | FLARGE=.1 208 | IF (TC.GE.-8. .AND. TC.LE.-3.) FLARGE=.5*FLARGE 209 | ENDIF 210 | FSMALL=(1.-FLARGE)/FLARGE 211 | XSIMASS=RRHO*MASSI(MDImin)*FSMALL 212 | DUM=XMImax*EXP(.0536*TC) 213 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DUM) ) ) 214 | RimeF=AMAX1(1., FS1D(I,J) ) 215 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 216 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 217 | QLICE=FLIMASS*QICE 218 | NLICE1(I,J)=QLICE/XLIMASS 219 | IF (NLICE1(I,J).LT.NLImin .OR. NLICE1(I,J).GT.NLImax) THEN 220 | ! 221 | !--- Force NLICE1 to be between NLImin and NLImax 222 | ! 223 | DUM=MAX(NLImin, MIN(NLImax, NLICE1(I,J)) ) 224 | XLI=RHO*(QICE/DUM-XSIMASS)/RimeF 225 | IF (XLI .LE. MASSI(MDImin) ) THEN 226 | INDEXS=MDImin 227 | ELSE IF (XLI .LE. MASSI(450) ) THEN 228 | DLI=9.5885E5*XLI**.42066 ! DLI in microns 229 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 230 | ELSE IF (XLI .LE. MASSI(MDImax) ) THEN 231 | DLI=3.9751E6*XLI**.49870 ! DLI in microns 232 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 233 | ELSE 234 | INDEXS=MDImax 235 | ! 236 | !--- 8/22/01: Increase density of large ice if maximum limits 237 | ! are reached for number concentration (NLImax) and mean size 238 | ! (MDImax). Done to increase fall out of ice. 239 | ! 240 | IF (DUM .GE. NLImax) & 241 | RimeF=RHO*(QICE/NLImax-XSIMASS)/MASSI(INDEXS) 242 | ENDIF ! End IF (XLI .LE. MASSI(MDImin) ) 243 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 244 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 245 | QLICE=FLIMASS*QICE 246 | NLICE1(I,J)=QLICE/XLIMASS 247 | ENDIF ! End IF (NLICE.LT.NLImin ... 248 | QS1(I,J)=AMIN1(QI1(I,J), QLICE) 249 | QI1(I,J)=AMAX1(0., QI1(I,J)-QS1(I,J)) 250 | ! 251 | !--- Equation (C.8) in Ferrier (1994, JAS, p. 272), which when 252 | ! converted from cgs units to mks units results in the same 253 | ! value for Cice, which is equal to the {} term below: 254 | ! 255 | ! Zi={.224*720*(10**18)/[(PI*RHOL)**2]}*(RHO*QLICE)**2/NLICE1(I,J), 256 | ! where RHOL=1000 kg/m**3 is the density of liquid water 257 | ! 258 | !--- Valid only for exponential ice distributions 259 | ! 260 | Zice=Cice*RHO*RHO*QLICE*QLICE/NLICE1(I,J) 261 | ENDIF ! End IF (QI1(I,J) .GT. 0.) THEN 262 | ! 263 | !--- Calculate total (convective + grid-scale) radar reflectivity 264 | 10 Ztot=Zrain+Zice+Zconv 265 | IF (Ztot .GT. Zmin) DBZ1(I,J)= 10.*ALOG10(Ztot) 266 | IF (Zrain .GT. Zmin) DBZR1(I,J)=10.*ALOG10(Zrain) 267 | IF (Zice .GT. Zmin) DBZI1(I,J)=10.*ALOG10(Zice) 268 | IF (Zconv .GT. Zmin) DBZC1(I,J)=10.*ALOG10(Zconv) 269 | ENDDO 270 | ENDDO 271 | ! 272 | RETURN 273 | END 274 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/CALMICT.f90.svn-base: -------------------------------------------------------------------------------- 1 | SUBROUTINE CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL, & 2 | QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1,NLICE1) 3 | !$$$ SUBPROGRAM DOCUMENTATION BLOCK 4 | ! . . . 5 | ! SUBPROGRAM: CALMIC COMPUTES HYDROMETEORS 6 | ! PRGRMMR: JIN ORG: W/NP2 DATE: 01-08-14 7 | ! 8 | ! ABSTRACT: 9 | ! THIS ROUTINE COMPUTES THE MIXING RATIOS OF CLOUD WATER, 10 | ! CLOUD ICE, RAIN, AND SNOW. THE CODE IS BASED ON SUBROUTINES 11 | ! GSMDRIVE & GSMCOLUMN IN THE NMM MODEL. 12 | ! 13 | ! PROGRAM HISTORY LOG: 14 | ! 01-08-14 YI JIN 15 | ! 02-02-11 Brad Ferrier - Minor changes for consistency w/ NMM model 16 | ! 04-11-10 Brad Ferrier - Removed cloud fraction algorithm 17 | ! 04-11-17 H CHUANG - WRF VERSION 18 | ! USAGE: CALL CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL 19 | ! &, QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1) 20 | ! INPUT ARGUMENT LIST: 21 | ! P1D - PRESSURE (PA) 22 | ! T1D - TEMPERATURE (K) 23 | ! Q1D - SPECIFIC HUMIDITY (KG/KG) 24 | ! C1D - TOTAL CONDENSATE (CWM, KG/KG) 25 | ! FI1D - F_ice (fraction of condensate in form of ice) 26 | ! FR1D - F_rain (fraction of liquid water in form of rain) 27 | ! FS1D - F_RimeF ("Rime Factor", ratio of total ice growth 28 | ! to deposition growth) 29 | ! CUREFL - Radar reflectivity contribution from convection (mm**6/m**3) 30 | ! 31 | ! OUTPUT ARGUMENT LIST: 32 | ! QW1 - CLOUD WATER MIXING RATIO (KG/KG) 33 | ! QI1 - CLOUD ICE MIXING RATIO (KG/KG) 34 | ! QR1 - RAIN MIXING RATIO (KG/KG) 35 | ! QS1 - "SNOW" (precipitation ice) MIXING RATIO (KG/KG) 36 | ! DBZ1 - Equivalent radar reflectivity factor in dBZ; i.e., 10*LOG10(Z) 37 | ! DBZR - Equivalent radar reflectivity factor from rain in dBZ 38 | ! DBZI - Equivalent radar reflectivity factor from ice (all forms) in dBZ 39 | ! DBZC - Equivalent radar reflectivity factor from parameterized convection in dBZ 40 | ! 41 | ! OUTPUT FILES: 42 | ! NONE 43 | ! 44 | ! SUBPROGRAMS CALLED: 45 | ! FUNCTIONS: 46 | ! FPVS 47 | ! UTILITIES: 48 | ! LIBRARY: 49 | ! NONE 50 | ! 51 | ! ATTRIBUTES: 52 | ! LANGUAGE: FORTRAN 53 | ! MACHINE : IBM SP 54 | !$$$ 55 | ! 56 | !BSF: skip use params_mod 57 | 58 | !use cmassi_mod 59 | ! start CMASSI hardcoded 60 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 61 | implicit none 62 | ! 63 | !----------------------------------------------------------------------- 64 | REAL, PARAMETER :: DMImin=.05e-3, DMImax=1.e-3, & 65 | & XMImin=1.e6*DMImin, XMImax=1.e6*DMImax 66 | INTEGER, PARAMETER :: MDImin=XMImin, MDImax=XMImax 67 | !----------------------------------------------------------------------- 68 | !--- Mean mass of precpitation ice particles as functions of their mean 69 | ! size (in microns) 70 | ! 71 | REAL MASSI(MDImin:MDImax) 72 | ! 73 | !--- Mean rain drop diameters vary from 50 microns to 450 microns 74 | ! 75 | REAL, PARAMETER :: DMRmin=.05E-3, DMRmax=.45E-3, DelDMR=1.E-6 & 76 | &, XMRmin=1.E6*DMRmin, XMRmax=1.E6*DMRmax, N0r0=8.E6, N0rmin=1.e4 77 | INTEGER, PARAMETER :: MDRmin=XMRmin, MDRmax=XMRmax 78 | ! 79 | !--- Various rain lookup tables 80 | ! 81 | REAL MASSR(MDRmin:MDRmax),RQR_DRmin,RQR_DRmax, & 82 | CN0r0,CN0r_DMRmin,CN0r_DMRmax 83 | !end CMASSI hardcoded 84 | 85 | ! hardcode in from params.f 86 | real, parameter :: D608=0.608 87 | real, parameter :: TFRZ=273.15 88 | real, parameter :: EPSQ=1.E-12 89 | real, parameter :: T_ICE=-30. 90 | 91 | 92 | !BSF: need to define array limits for im, jm 93 | ! 94 | ! implicit none 95 | integer, parameter :: im=100, jm=100 96 | 97 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 98 | ! 99 | INTEGER INDEXS, INDEXR 100 | REAL, PARAMETER :: Cice=1.634e13, DBZmin=-20., RD=287.04, & 101 | ONEPS=1.-18.015/28.964 102 | 103 | !BSF: adjust following parameters based on whats in phys/module_mp_etanew.F: 104 | real, parameter :: NLImin=1.E3, NLImax=5.E3 105 | 106 | real,dimension(IM,JM),intent(in) :: P1D,T1D,Q1D,C1D,FI1D,FR1D, & 107 | FS1D,CUREFL 108 | real,dimension(IM,JM),intent(inout) :: QW1,QI1,QR1,QS1,DBZ1,DBZR1,& 109 | DBZI1,DBZC1,NLICE1 110 | 111 | REAL N0r,Ztot,Zrain,Zice,Zconv,Zmin 112 | integer I,J,JSTA,JEND 113 | real TC, Frain,Fice,Flimass,Flarge, & 114 | Fsmall,RimeF,Xsimass,Qice,Qsat,ESAT,WV,RHO,RRHO,RQR, & 115 | DRmm,Qsigrd,WVQW,Dum,XLi,Qlice,WC,DLI,xlimass 116 | !BSF: skip real,external :: fpvs 117 | !************************************************************************ 118 | !--- Determine composition of condensate in the form of cloud water, 119 | ! total ice (cloud ice & snow), & rain following GSMDRIVE in NMM model 120 | ! 121 | 122 | JSTA=1 123 | JEND=100 124 | 125 | Zmin=10.**(0.1*DBZmin) 126 | DO J=JSTA,JEND 127 | DO I=1,IM 128 | QW1(I,J)=0. 129 | QI1(I,J)=0. 130 | QR1(I,J)=0. 131 | QS1(I,J)=0. 132 | NLICE1(I,J)=0. 133 | DBZ1(I,J)=DBZmin 134 | DBZR1(I,J)=DBZmin 135 | DBZI1(I,J)=DBZmin 136 | DBZC1(I,J)=DBZmin 137 | ENDDO 138 | ENDDO 139 | DO J=JSTA,JEND 140 | DO I=1,IM 141 | Zrain=0. !--- Radar reflectivity from rain 142 | Zice=0. !--- Radar reflectivity from ice 143 | Zconv=CUREFL(I,J) !--- Radar reflectivity from convection 144 | IF (C1D(I,J) .LE. EPSQ) THEN 145 | ! 146 | !--- Skip rest of calculatiions if no condensate is present 147 | ! 148 | GO TO 10 149 | ELSE 150 | WC=C1D(I,J) 151 | ENDIF 152 | ! 153 | !--- Code below is from GSMDRIVE for determining: 154 | ! QI1 - total ice (cloud ice & snow) mixing ratio 155 | ! QW1 - cloud water mixing ratio 156 | ! QR1 - rain mixing ratio 157 | ! 158 | TC=T1D(I,J)-TFRZ 159 | Fice=FI1D(I,J) 160 | Frain=FR1D(I,J) 161 | IF (TC.LE.T_ICE .OR. Fice.GE.1.) THEN 162 | ! IF (Fice.GE.1.) THEN 163 | QI1(I,J)=WC 164 | ELSE IF (Fice .LE. 0.) THEN 165 | QW1(I,J)=WC 166 | ELSE 167 | QI1(I,J)=Fice*WC 168 | QW1(I,J)=WC-QI1(I,J) 169 | ENDIF 170 | IF (QW1(I,J).GT.0. .AND. Frain.GT.0.) THEN 171 | IF (Frain .GE. 1.) THEN 172 | QR1(I,J)=QW1(I,J) 173 | QW1(I,J)=0. 174 | ELSE 175 | QR1(I,J)=Frain*QW1(I,J) 176 | QW1(I,J)=QW1(I,J)-QR1(I,J) 177 | ENDIF 178 | ENDIF 179 | !BSF: If you're running the ARW and it has as output arrays qw, qr, qi, then 180 | ! start here. 181 | !-- array QW is the same as the array 'qc' from ARW output 182 | !-- array QR is the same as the array 'qr' from ARW output 183 | !-- array QI is the same as the array 'qs' from ARW output 184 | ! => Here QI includes the total ice, large ice (snow) & small cloud ice 185 | ! This is separated out down below in the code starting with defining 186 | ! the constant 'FLARGE'. 187 | ! 188 | !BSF: skip WV=Q1D(I,J)/(1.-Q1D(I,J)) 189 | ! 190 | !--- Saturation vapor pressure w/r/t water ( >=0C ) or ice ( <0C ) 191 | ! 192 | !BSF: skip ESAT=1000.*FPVS(T1D(I,J)) 193 | !BSF: skip QSAT=EPS*ESAT/(P1D(I,J)-ESAT) 194 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+D608*Q1D(I,J))) 195 | RRHO=1./RHO 196 | ! 197 | !--- Based on code from GSMCOLUMN in model to determine reflectivity from rain 198 | ! 199 | IF (QR1(I,J) .GT. EPSQ) THEN 200 | RQR=RHO*QR1(I,J) 201 | IF (RQR .LE. RQR_DRmin) THEN 202 | N0r=MAX(N0rmin, CN0r_DMRmin*RQR) 203 | INDEXR=MDRmin 204 | ELSE IF (RQR .GE. RQR_DRmax) THEN 205 | N0r=CN0r_DMRmax*RQR 206 | INDEXR=MDRmax 207 | ELSE 208 | N0r=N0r0 209 | INDEXR=MAX( XMRmin, MIN(CN0r0*RQR**.25, XMRmax) ) 210 | ENDIF 211 | ! 212 | !--- INDEXR is the mean drop size in microns; convert to mm 213 | ! 214 | DRmm=1.e-3*REAL(INDEXR) 215 | Zrain=0.72*N0r*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm 216 | ENDIF !--- End IF (QR1(I,J) .GT. EPSQ) block 217 | ! 218 | !--- Based on code from GSMCOLUMN in model to determine partition of 219 | ! total ice into cloud ice & snow (precipitation ice) 220 | ! 221 | IF (QI1(I,J) .GT. EPSQ) THEN 222 | QICE=QI1(I,J) 223 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+ONEPS*Q1D(I,J))) 224 | RRHO=1./RHO 225 | !BSF: skip QSIgrd=RHgrd*QSAT 226 | !BSF: skip WVQW=WV+QW1(I,J) 227 | ! 228 | ! * FLARGE - ratio of number of large ice to total (large & small) ice 229 | ! * FSMALL - ratio of number of small ice crystals to large ice particles 230 | ! -> Small ice particles are assumed to have a mean diameter of 50 microns. 231 | ! * XSIMASS - used for calculating small ice mixing ratio 232 | ! * XLIMASS - used for calculating large ice mixing ratio 233 | ! * INDEXS - mean size of snow to the nearest micron (units of microns) 234 | ! * RimeF - Rime Factor, which is the mass ratio of total (unrimed & 235 | ! rimed) ice mass to the unrimed ice mass (>=1) 236 | ! * FLIMASS - mass fraction of large ice 237 | ! * QTICE - time-averaged mixing ratio of total ice 238 | ! * QLICE - time-averaged mixing ratio of large ice 239 | ! * NLICE1 - time-averaged number concentration of large ice 240 | ! 241 | IF (TC.GE.0.) THEN !-- BSF: skip .OR. WVQW.LT.QSIgrd) THEN 242 | FLARGE=1. 243 | ELSE 244 | FLARGE=.1 245 | IF (TC.GE.-8. .AND. TC.LE.-3.) FLARGE=.5*FLARGE 246 | ENDIF 247 | FSMALL=(1.-FLARGE)/FLARGE 248 | XSIMASS=RRHO*MASSI(MDImin)*FSMALL 249 | DUM=XMImax*EXP(.0536*TC) 250 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DUM) ) ) 251 | RimeF=AMAX1(1., FS1D(I,J) ) 252 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 253 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 254 | QLICE=FLIMASS*QICE 255 | NLICE1(I,J)=QLICE/XLIMASS 256 | IF (NLICE1(I,J).LT.NLImin .OR. NLICE1(I,J).GT.NLImax) THEN 257 | ! 258 | !--- Force NLICE1 to be between NLImin and NLImax 259 | ! 260 | DUM=MAX(NLImin, MIN(NLImax, NLICE1(I,J)) ) 261 | XLI=RHO*(QICE/DUM-XSIMASS)/RimeF 262 | IF (XLI .LE. MASSI(MDImin) ) THEN 263 | INDEXS=MDImin 264 | ELSE IF (XLI .LE. MASSI(450) ) THEN 265 | DLI=9.5885E5*XLI**.42066 ! DLI in microns 266 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 267 | ELSE IF (XLI .LE. MASSI(MDImax) ) THEN 268 | DLI=3.9751E6*XLI**.49870 ! DLI in microns 269 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 270 | ELSE 271 | INDEXS=MDImax 272 | ! 273 | !--- 8/22/01: Increase density of large ice if maximum limits 274 | ! are reached for number concentration (NLImax) and mean size 275 | ! (MDImax). Done to increase fall out of ice. 276 | ! 277 | IF (DUM .GE. NLImax) & 278 | RimeF=RHO*(QICE/NLImax-XSIMASS)/MASSI(INDEXS) 279 | ENDIF ! End IF (XLI .LE. MASSI(MDImin) ) 280 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 281 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 282 | QLICE=FLIMASS*QICE 283 | NLICE1(I,J)=QLICE/XLIMASS 284 | ENDIF ! End IF (NLICE.LT.NLImin ... 285 | QS1(I,J)=AMIN1(QI1(I,J), QLICE) 286 | QI1(I,J)=AMAX1(0., QI1(I,J)-QS1(I,J)) 287 | ! 288 | !--- Equation (C.8) in Ferrier (1994, JAS, p. 272), which when 289 | ! converted from cgs units to mks units results in the same 290 | ! value for Cice, which is equal to the {} term below: 291 | ! 292 | ! Zi={.224*720*(10**18)/[(PI*RHOL)**2]}*(RHO*QLICE)**2/NLICE1(I,J), 293 | ! where RHOL=1000 kg/m**3 is the density of liquid water 294 | ! 295 | !--- Valid only for exponential ice distributions 296 | ! 297 | Zice=Cice*RHO*RHO*QLICE*QLICE/NLICE1(I,J) 298 | ENDIF ! End IF (QI1(I,J) .GT. 0.) THEN 299 | ! 300 | !--- Calculate total (convective + grid-scale) radar reflectivity 301 | 10 Ztot=Zrain+Zice+Zconv 302 | IF (Ztot .GT. Zmin) DBZ1(I,J)= 10.*ALOG10(Ztot) 303 | IF (Zrain .GT. Zmin) DBZR1(I,J)=10.*ALOG10(Zrain) 304 | IF (Zice .GT. Zmin) DBZI1(I,J)=10.*ALOG10(Zice) 305 | IF (Zconv .GT. Zmin) DBZC1(I,J)=10.*ALOG10(Zconv) 306 | ENDDO 307 | ENDDO 308 | ! 309 | RETURN 310 | END 311 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/CALMICT.so.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaine1/pyWRF/3f5724c446b036f5cf252cb18df0b42b74eb0552/sample/Ferrier/.svn/text-base/CALMICT.so.svn-base -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/CMASSI.f.svn-base: -------------------------------------------------------------------------------- 1 | module CMASSI_mod 2 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 | implicit none 4 | ! 5 | !----------------------------------------------------------------------- 6 | REAL, PARAMETER :: DMImin=.05e-3, DMImax=1.e-3, & 7 | & XMImin=1.e6*DMImin, XMImax=1.e6*DMImax 8 | INTEGER, PARAMETER :: MDImin=XMImin, MDImax=XMImax 9 | !----------------------------------------------------------------------- 10 | !--- Mean mass of precpitation ice particles as functions of their mean 11 | ! size (in microns) 12 | ! 13 | REAL MASSI(MDImin:MDImax) 14 | ! 15 | !--- Mean rain drop diameters vary from 50 microns to 450 microns 16 | ! 17 | REAL, PARAMETER :: DMRmin=.05E-3, DMRmax=.45E-3, DelDMR=1.E-6 & 18 | &, XMRmin=1.E6*DMRmin, XMRmax=1.E6*DMRmax, N0r0=8.E6, N0rmin=1.e4 19 | INTEGER, PARAMETER :: MDRmin=XMRmin, MDRmax=XMRmax 20 | ! 21 | !--- Various rain lookup tables 22 | ! 23 | REAL MASSR(MDRmin:MDRmax),RQR_DRmin,RQR_DRmax, & 24 | CN0r0,CN0r_DMRmin,CN0r_DMRmax 25 | ! 26 | end module CMASSI_mod 27 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/CMASSI.f90.svn-base: -------------------------------------------------------------------------------- 1 | module CMASSI_mod 2 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 | implicit none 4 | ! 5 | !----------------------------------------------------------------------- 6 | REAL, PARAMETER :: DMImin=.05e-3, DMImax=1.e-3, & 7 | & XMImin=1.e6*DMImin, XMImax=1.e6*DMImax 8 | INTEGER, PARAMETER :: MDImin=XMImin, MDImax=XMImax 9 | !----------------------------------------------------------------------- 10 | !--- Mean mass of precpitation ice particles as functions of their mean 11 | ! size (in microns) 12 | ! 13 | REAL MASSI(MDImin:MDImax) 14 | ! 15 | !--- Mean rain drop diameters vary from 50 microns to 450 microns 16 | ! 17 | REAL, PARAMETER :: DMRmin=.05E-3, DMRmax=.45E-3, DelDMR=1.E-6 & 18 | &, XMRmin=1.E6*DMRmin, XMRmax=1.E6*DMRmax, N0r0=8.E6, N0rmin=1.e4 19 | INTEGER, PARAMETER :: MDRmin=XMRmin, MDRmax=XMRmax 20 | ! 21 | !--- Various rain lookup tables 22 | ! 23 | REAL MASSR(MDRmin:MDRmax),RQR_DRmin,RQR_DRmax, & 24 | CN0r0,CN0r_DMRmin,CN0r_DMRmax 25 | ! 26 | end module CMASSI_mod 27 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/MICROINIT.f.svn-base: -------------------------------------------------------------------------------- 1 | SUBROUTINE MICROINIT 2 | ! 3 | !-- ABSTRACT: 4 | ! Initializes arrays for new cloud microphysics 5 | ! 6 | !-- Program History Log: 7 | ! 02-02-08 B. Ferrier 8 | ! 04-11-19 H CHUANG - WRF VERSION 9 | ! 10 | !-- Input argument list: 11 | ! None 12 | ! 13 | !-- Output argument list: 14 | ! None 15 | ! 16 | !-- Subprograms called: 17 | ! Function FPVS 18 | ! 19 | !-- Common blocks: 20 | ! CMASSI 21 | ! RMASS_TABLES 22 | ! MAPOT 23 | ! CRHgrd 24 | ! 25 | !-- Attributes: 26 | ! Language: FORTRAN 90 27 | ! Machine : IBM SP 28 | ! 29 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 30 | use cmassi_mod 31 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32 | implicit none 33 | ! 34 | REAL, PARAMETER :: RHOL=1000. 35 | real ax,C_N0r0 36 | integer i 37 | ! 38 | !------------------------ START EXECUTION ------------------------ 39 | ! 40 | !--- READ IN MASSI FROM LOOKUP TABLES 41 | ! 42 | OPEN (UNIT=1,FILE="eta_micro_lookup.dat",FORM="UNFORMATTED") 43 | DO I=1,3 44 | READ(1) 45 | ENDDO 46 | READ(1) MASSR 47 | DO I=1,5 48 | READ(1) 49 | ENDDO 50 | READ(1) MASSI 51 | CLOSE(1) 52 | RQR_DRmin=N0r0*MASSR(MDRmin) ! Rain content for mean drop diameter of .05 mm 53 | RQR_DRmax=N0r0*MASSR(MDRmax) ! Rain content for mean drop diameter of .45 mm 54 | PI=ACOS(-1.) 55 | C_N0r0=PI*RHOL*N0r0 56 | CN0r0=1.E6/C_N0r0**.25 57 | CN0r_DMRmin=1./(PI*RHOL*DMRmin**4) 58 | CN0r_DMRmax=1./(PI*RHOL*DMRmax**4) 59 | print *,'MICROINIT: MDRmin, MASSR(MDRmin)=',MDRmin,MASSR(MDRmin) 60 | print *,'MICROINIT: MDRmax, MASSR(MDRmax)=',MDRmax,MASSR(MDRmax) 61 | ! print *, 'ETA2P:MASSI(50)= ', MASSI(50) 62 | ! print *, 'ETA2P:MASSI(450)= ', MASSI(450) 63 | ! print *, 'ETA2P:MASSI(1000)= ', MASSI(1000) 64 | ! 65 | !--- Initialize saturation vapor pressure lookup tables (functions FPVS, FPVS0) 66 | ! 67 | !BSF: skip CALL GPVS 68 | ! 69 | !--- Initialize RHgrd, grid-scale RH for onset of condensation. 70 | ! See GSMCONST in Eta model for algorithm with grid-size dependence. 71 | ! 72 | ! AX=111.*(DPHD**2+DLMD**2)**.5 73 | ! AX=111.*(DYVAL/1000.**2+DXVAL/1000.**2)**.5 74 | ! AX=MIN(100., MAX(5., AX) ) 75 | ! RHgrd=0.90+.08*((100.-AX)/95.)**.5 76 | !BSF skip: RHgrd=1. 77 | !--- 78 | RETURN 79 | END 80 | -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/eta_micro_lookup.dat.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaine1/pyWRF/3f5724c446b036f5cf252cb18df0b42b74eb0552/sample/Ferrier/.svn/text-base/eta_micro_lookup.dat.svn-base -------------------------------------------------------------------------------- /sample/Ferrier/.svn/text-base/params.f.svn-base: -------------------------------------------------------------------------------- 1 | module params_mod 2 | 3 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4 | implicit none 5 | ! 6 | ! file: params.f 7 | ! defines physical constants and smoothing coefficients 8 | ! last update: 09/06/2006 9 | ! 10 | ! SMOOTHING PARAMETERS. 11 | integer, parameter :: KSMUD=4 12 | integer, parameter :: KSLPD=1 13 | integer, parameter :: KSSLP=2 14 | integer, parameter :: KSFI=2 15 | integer, parameter :: KST=2 16 | integer, parameter :: KSUV=2 17 | integer, parameter :: KSRH=2 18 | integer, parameter :: KSAV=2 19 | integer, parameter :: KSLI=2 20 | integer, parameter :: KSLP=2 21 | integer, parameter :: NSUMD=1 22 | 23 | real, parameter :: SMTHA=-1.8E-4 24 | real, parameter :: SMTHB=16.0 25 | ! 26 | ! CONSTANTS. 27 | real, parameter :: CM1=2937.4 28 | real, parameter :: CM2=4.9283 29 | real, parameter :: CM3=23.5518 30 | real, parameter :: D00=0.0 31 | real, parameter :: D1=0.1 32 | real, parameter :: D01=0.01 33 | real, parameter :: D001=0.001 34 | real, parameter :: D50=0.50 35 | real, parameter :: H999=999. 36 | real, parameter :: H1=1.0 37 | real, parameter :: H2=2.0 38 | real, parameter :: H4=4.0 39 | real, parameter :: H99999=99999. 40 | real, parameter :: H1M12=1.E-12 41 | real, parameter :: H1000=1000. 42 | real, parameter :: H1M5=1.E-5 43 | real, parameter :: D125=.125 44 | real, parameter :: D25=0.25 45 | real, parameter :: H100=100. 46 | real, parameter :: H10000=10000. 47 | real, parameter :: H10E5=1.E5 48 | real, parameter :: CAPA=0.28589641E0 49 | real, parameter :: D115=0.115 50 | real, parameter :: D608=0.608 51 | real, parameter :: D05=0.05 52 | real, parameter :: D0065=0.0065 53 | real, parameter :: H1E2=100. 54 | real, parameter :: H1E4=1.E4 55 | real, parameter :: H1M2=1.E-2 56 | real, parameter :: G=9.81 57 | real, parameter :: RD=287.04 58 | real, parameter :: ROG=RD/G 59 | real, parameter :: GI=1./G 60 | real, parameter :: OVERRC=1.10 61 | real, parameter :: AD05=OVERRC*D05 62 | real, parameter :: CFT0=OVERRC-H1 63 | real, parameter :: PI=3.141592653589793 64 | real, parameter :: DTR=3.1415926/180. 65 | real, parameter :: RTD=1./DTR 66 | real, parameter :: ERAD=6.370E6 67 | real, parameter :: CP=1004.6 68 | real, parameter :: RCAPA=1./CAPA 69 | real, parameter :: P1000=1000.E2,DP10M=110 70 | real, parameter :: ELWV=2.50E6 71 | real, parameter :: CPDR=CP/RD 72 | real, parameter :: RG=1./GI 73 | real, parameter :: ELDR=ELWV/RD 74 | real, parameter :: BETA=.00367 75 | real, parameter :: BTG=BETA*G 76 | real, parameter :: FMW=18.015 77 | real, parameter :: FMD=28.964 78 | real, parameter :: EPS=FMW/FMD 79 | real, parameter :: ONEPS=1.-EPS 80 | real, parameter :: TFRZ=273.15 81 | real, parameter :: RDOCP=RD/CP 82 | real, parameter :: LHEAT=2.5E6 83 | real, parameter :: LHTOCP=LHEAT/CP 84 | real, parameter :: EPSQ2=0.02 85 | real, parameter :: PQ0=379.90516 86 | real, parameter :: A2=17.2693882 87 | real, parameter :: A3=273.16 88 | real, parameter :: A4=35.86 89 | real, parameter :: EPSQ=1.E-12 90 | real, parameter :: QCLDmin=1.E-6 91 | real, parameter :: CLFRmin=D1 92 | real, parameter :: NLImin=1.E3 93 | real, parameter :: NLImax=5.E3 94 | real, parameter :: T_ICE=-30. 95 | real, parameter :: TRAD_ice=0.5*T_ICE+TFRZ 96 | real, parameter :: Qconv=0.1E-3 97 | ! 98 | real, parameter :: STBOL=1./5.67E-8 99 | real, parameter :: DBZmin=-20. 100 | real, parameter :: abscoef=8.0 101 | real, parameter :: abscoefi=5.0 102 | real, parameter :: XLAI=4.0 ! Leaf area index 103 | real, parameter :: RHmin=1.0E-6 ! minimal RH bound 104 | real, parameter :: SMALL=1.E-6 105 | real, parameter :: PTHRESH=0.000000 106 | real, parameter :: ELIVW=2.72E6 107 | real, parameter :: ELOCP=ELIVW/CP 108 | ! 109 | real, parameter :: GAMMA=6.5E-3 110 | real, parameter :: RGAMOG=RD*GAMMA/G 111 | 112 | end module params_mod 113 | -------------------------------------------------------------------------------- /sample/Ferrier/CALMICT.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL, & 2 | QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1,NLICE1) 3 | !$$$ SUBPROGRAM DOCUMENTATION BLOCK 4 | ! . . . 5 | ! SUBPROGRAM: CALMIC COMPUTES HYDROMETEORS 6 | ! PRGRMMR: JIN ORG: W/NP2 DATE: 01-08-14 7 | ! 8 | ! ABSTRACT: 9 | ! THIS ROUTINE COMPUTES THE MIXING RATIOS OF CLOUD WATER, 10 | ! CLOUD ICE, RAIN, AND SNOW. THE CODE IS BASED ON SUBROUTINES 11 | ! GSMDRIVE & GSMCOLUMN IN THE NMM MODEL. 12 | ! 13 | ! PROGRAM HISTORY LOG: 14 | ! 01-08-14 YI JIN 15 | ! 02-02-11 Brad Ferrier - Minor changes for consistency w/ NMM model 16 | ! 04-11-10 Brad Ferrier - Removed cloud fraction algorithm 17 | ! 04-11-17 H CHUANG - WRF VERSION 18 | ! USAGE: CALL CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL 19 | ! &, QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1) 20 | ! INPUT ARGUMENT LIST: 21 | ! P1D - PRESSURE (PA) 22 | ! T1D - TEMPERATURE (K) 23 | ! Q1D - SPECIFIC HUMIDITY (KG/KG) 24 | ! C1D - TOTAL CONDENSATE (CWM, KG/KG) 25 | ! FI1D - F_ice (fraction of condensate in form of ice) 26 | ! FR1D - F_rain (fraction of liquid water in form of rain) 27 | ! FS1D - F_RimeF ("Rime Factor", ratio of total ice growth 28 | ! to deposition growth) 29 | ! CUREFL - Radar reflectivity contribution from convection (mm**6/m**3) 30 | ! 31 | ! OUTPUT ARGUMENT LIST: 32 | ! QW1 - CLOUD WATER MIXING RATIO (KG/KG) 33 | ! QI1 - CLOUD ICE MIXING RATIO (KG/KG) 34 | ! QR1 - RAIN MIXING RATIO (KG/KG) 35 | ! QS1 - "SNOW" (precipitation ice) MIXING RATIO (KG/KG) 36 | ! DBZ1 - Equivalent radar reflectivity factor in dBZ; i.e., 10*LOG10(Z) 37 | ! DBZR - Equivalent radar reflectivity factor from rain in dBZ 38 | ! DBZI - Equivalent radar reflectivity factor from ice (all forms) in dBZ 39 | ! DBZC - Equivalent radar reflectivity factor from parameterized convection in dBZ 40 | ! 41 | ! OUTPUT FILES: 42 | ! NONE 43 | ! 44 | ! SUBPROGRAMS CALLED: 45 | ! FUNCTIONS: 46 | ! FPVS 47 | ! UTILITIES: 48 | ! LIBRARY: 49 | ! NONE 50 | ! 51 | ! ATTRIBUTES: 52 | ! LANGUAGE: FORTRAN 53 | ! MACHINE : IBM SP 54 | !$$$ 55 | ! 56 | !BSF: skip use params_mod 57 | 58 | use cmassi_mod 59 | 60 | !BSF: need to define array limits for im, jm 61 | integer, parameter :: im=100, jm=100 62 | 63 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 64 | implicit none 65 | ! 66 | INTEGER INDEXS, INDEXR 67 | REAL, PARAMETER :: Cice=1.634e13, DBZmin=-20., RD=287.04, & 68 | ONEPS=1.-18.015/28.964 69 | 70 | !BSF: adjust following parameters based on whats in phys/module_mp_etanew.F: 71 | real, parameter :: NLImin=1.E3, NLImax=5.E3 72 | 73 | real,dimension(IM,JM),intent(in) :: P1D,T1D,Q1D,C1D,FI1D,FR1D, & 74 | FS1D,CUREFL 75 | real,dimension(IM,JM),intent(inout) :: QW1,QI1,QR1,QS1,DBZ1,DBZR1,& 76 | DBZI1,DBZC1,NLICE1 77 | 78 | REAL N0r,Ztot,Zrain,Zice,Zconv,Zmin 79 | integer I,J 80 | real TC, Frain,Fice,Flimass,Flarge, & 81 | Fsmall,RimeF,Xsimass,Qice,Qsat,ESAT,WV,RHO,RRHO,RQR, & 82 | DRmm,Qsigrd,WVQW,Dum,XLi,Qlice,WC,DLI,xlimass 83 | !BSF: skip real,external :: fpvs 84 | !************************************************************************ 85 | !--- Determine composition of condensate in the form of cloud water, 86 | ! total ice (cloud ice & snow), & rain following GSMDRIVE in NMM model 87 | ! 88 | Zmin=10.**(0.1*DBZmin) 89 | DO J=JSTA,JEND 90 | DO I=1,IM 91 | QW1(I,J)=0. 92 | QI1(I,J)=0. 93 | QR1(I,J)=0. 94 | QS1(I,J)=0. 95 | NLICE1(I,J)=0. 96 | DBZ1(I,J)=DBZmin 97 | DBZR1(I,J)=DBZmin 98 | DBZI1(I,J)=DBZmin 99 | DBZC1(I,J)=DBZmin 100 | ENDDO 101 | ENDDO 102 | DO J=JSTA,JEND 103 | DO I=1,IM 104 | Zrain=0. !--- Radar reflectivity from rain 105 | Zice=0. !--- Radar reflectivity from ice 106 | Zconv=CUREFL(I,J) !--- Radar reflectivity from convection 107 | IF (C1D(I,J) .LE. EPSQ) THEN 108 | ! 109 | !--- Skip rest of calculatiions if no condensate is present 110 | ! 111 | GO TO 10 112 | ELSE 113 | WC=C1D(I,J) 114 | ENDIF 115 | ! 116 | !--- Code below is from GSMDRIVE for determining: 117 | ! QI1 - total ice (cloud ice & snow) mixing ratio 118 | ! QW1 - cloud water mixing ratio 119 | ! QR1 - rain mixing ratio 120 | ! 121 | TC=T1D(I,J)-TFRZ 122 | Fice=FI1D(I,J) 123 | Frain=FR1D(I,J) 124 | IF (TC.LE.T_ICE .OR. Fice.GE.1.) THEN 125 | ! IF (Fice.GE.1.) THEN 126 | QI1(I,J)=WC 127 | ELSE IF (Fice .LE. 0.) THEN 128 | QW1(I,J)=WC 129 | ELSE 130 | QI1(I,J)=Fice*WC 131 | QW1(I,J)=WC-QI1(I,J) 132 | ENDIF 133 | IF (QW1(I,J).GT.0. .AND. Frain.GT.0.) THEN 134 | IF (Frain .GE. 1.) THEN 135 | QR1(I,J)=QW1(I,J) 136 | QW1(I,J)=0. 137 | ELSE 138 | QR1(I,J)=Frain*QW1(I,J) 139 | QW1(I,J)=QW1(I,J)-QR1(I,J) 140 | ENDIF 141 | ENDIF 142 | !BSF: If you're running the ARW and it has as output arrays qw, qr, qi, then 143 | ! start here. 144 | !-- array QW is the same as the array 'qc' from ARW output 145 | !-- array QR is the same as the array 'qr' from ARW output 146 | !-- array QI is the same as the array 'qs' from ARW output 147 | ! => Here QI includes the total ice, large ice (snow) & small cloud ice 148 | ! This is separated out down below in the code starting with defining 149 | ! the constant 'FLARGE'. 150 | ! 151 | !BSF: skip WV=Q1D(I,J)/(1.-Q1D(I,J)) 152 | ! 153 | !--- Saturation vapor pressure w/r/t water ( >=0C ) or ice ( <0C ) 154 | ! 155 | !BSF: skip ESAT=1000.*FPVS(T1D(I,J)) 156 | !BSF: skip QSAT=EPS*ESAT/(P1D(I,J)-ESAT) 157 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+D608*Q1D(I,J))) 158 | RRHO=1./RHO 159 | ! 160 | !--- Based on code from GSMCOLUMN in model to determine reflectivity from rain 161 | ! 162 | IF (QR1(I,J) .GT. EPSQ) THEN 163 | RQR=RHO*QR1(I,J) 164 | IF (RQR .LE. RQR_DRmin) THEN 165 | N0r=MAX(N0rmin, CN0r_DMRmin*RQR) 166 | INDEXR=MDRmin 167 | ELSE IF (RQR .GE. RQR_DRmax) THEN 168 | N0r=CN0r_DMRmax*RQR 169 | INDEXR=MDRmax 170 | ELSE 171 | N0r=N0r0 172 | INDEXR=MAX( XMRmin, MIN(CN0r0*RQR**.25, XMRmax) ) 173 | ENDIF 174 | ! 175 | !--- INDEXR is the mean drop size in microns; convert to mm 176 | ! 177 | DRmm=1.e-3*REAL(INDEXR) 178 | Zrain=0.72*N0r*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm 179 | ENDIF !--- End IF (QR1(I,J) .GT. EPSQ) block 180 | ! 181 | !--- Based on code from GSMCOLUMN in model to determine partition of 182 | ! total ice into cloud ice & snow (precipitation ice) 183 | ! 184 | IF (QI1(I,J) .GT. EPSQ) THEN 185 | QICE=QI1(I,J) 186 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+ONEPS*Q1D(I,J))) 187 | RRHO=1./RHO 188 | !BSF: skip QSIgrd=RHgrd*QSAT 189 | !BSF: skip WVQW=WV+QW1(I,J) 190 | ! 191 | ! * FLARGE - ratio of number of large ice to total (large & small) ice 192 | ! * FSMALL - ratio of number of small ice crystals to large ice particles 193 | ! -> Small ice particles are assumed to have a mean diameter of 50 microns. 194 | ! * XSIMASS - used for calculating small ice mixing ratio 195 | ! * XLIMASS - used for calculating large ice mixing ratio 196 | ! * INDEXS - mean size of snow to the nearest micron (units of microns) 197 | ! * RimeF - Rime Factor, which is the mass ratio of total (unrimed & 198 | ! rimed) ice mass to the unrimed ice mass (>=1) 199 | ! * FLIMASS - mass fraction of large ice 200 | ! * QTICE - time-averaged mixing ratio of total ice 201 | ! * QLICE - time-averaged mixing ratio of large ice 202 | ! * NLICE1 - time-averaged number concentration of large ice 203 | ! 204 | IF (TC.GE.0.) THEN !-- BSF: skip .OR. WVQW.LT.QSIgrd) THEN 205 | FLARGE=1. 206 | ELSE 207 | FLARGE=.1 208 | IF (TC.GE.-8. .AND. TC.LE.-3.) FLARGE=.5*FLARGE 209 | ENDIF 210 | FSMALL=(1.-FLARGE)/FLARGE 211 | XSIMASS=RRHO*MASSI(MDImin)*FSMALL 212 | DUM=XMImax*EXP(.0536*TC) 213 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DUM) ) ) 214 | RimeF=AMAX1(1., FS1D(I,J) ) 215 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 216 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 217 | QLICE=FLIMASS*QICE 218 | NLICE1(I,J)=QLICE/XLIMASS 219 | IF (NLICE1(I,J).LT.NLImin .OR. NLICE1(I,J).GT.NLImax) THEN 220 | ! 221 | !--- Force NLICE1 to be between NLImin and NLImax 222 | ! 223 | DUM=MAX(NLImin, MIN(NLImax, NLICE1(I,J)) ) 224 | XLI=RHO*(QICE/DUM-XSIMASS)/RimeF 225 | IF (XLI .LE. MASSI(MDImin) ) THEN 226 | INDEXS=MDImin 227 | ELSE IF (XLI .LE. MASSI(450) ) THEN 228 | DLI=9.5885E5*XLI**.42066 ! DLI in microns 229 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 230 | ELSE IF (XLI .LE. MASSI(MDImax) ) THEN 231 | DLI=3.9751E6*XLI**.49870 ! DLI in microns 232 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 233 | ELSE 234 | INDEXS=MDImax 235 | ! 236 | !--- 8/22/01: Increase density of large ice if maximum limits 237 | ! are reached for number concentration (NLImax) and mean size 238 | ! (MDImax). Done to increase fall out of ice. 239 | ! 240 | IF (DUM .GE. NLImax) & 241 | RimeF=RHO*(QICE/NLImax-XSIMASS)/MASSI(INDEXS) 242 | ENDIF ! End IF (XLI .LE. MASSI(MDImin) ) 243 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 244 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 245 | QLICE=FLIMASS*QICE 246 | NLICE1(I,J)=QLICE/XLIMASS 247 | ENDIF ! End IF (NLICE.LT.NLImin ... 248 | QS1(I,J)=AMIN1(QI1(I,J), QLICE) 249 | QI1(I,J)=AMAX1(0., QI1(I,J)-QS1(I,J)) 250 | ! 251 | !--- Equation (C.8) in Ferrier (1994, JAS, p. 272), which when 252 | ! converted from cgs units to mks units results in the same 253 | ! value for Cice, which is equal to the {} term below: 254 | ! 255 | ! Zi={.224*720*(10**18)/[(PI*RHOL)**2]}*(RHO*QLICE)**2/NLICE1(I,J), 256 | ! where RHOL=1000 kg/m**3 is the density of liquid water 257 | ! 258 | !--- Valid only for exponential ice distributions 259 | ! 260 | Zice=Cice*RHO*RHO*QLICE*QLICE/NLICE1(I,J) 261 | ENDIF ! End IF (QI1(I,J) .GT. 0.) THEN 262 | ! 263 | !--- Calculate total (convective + grid-scale) radar reflectivity 264 | 10 Ztot=Zrain+Zice+Zconv 265 | IF (Ztot .GT. Zmin) DBZ1(I,J)= 10.*ALOG10(Ztot) 266 | IF (Zrain .GT. Zmin) DBZR1(I,J)=10.*ALOG10(Zrain) 267 | IF (Zice .GT. Zmin) DBZI1(I,J)=10.*ALOG10(Zice) 268 | IF (Zconv .GT. Zmin) DBZC1(I,J)=10.*ALOG10(Zconv) 269 | ENDDO 270 | ENDDO 271 | ! 272 | RETURN 273 | END 274 | -------------------------------------------------------------------------------- /sample/Ferrier/CALMICT.f90: -------------------------------------------------------------------------------- 1 | SUBROUTINE CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL, & 2 | QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1,NLICE1) 3 | !$$$ SUBPROGRAM DOCUMENTATION BLOCK 4 | ! . . . 5 | ! SUBPROGRAM: CALMIC COMPUTES HYDROMETEORS 6 | ! PRGRMMR: JIN ORG: W/NP2 DATE: 01-08-14 7 | ! 8 | ! ABSTRACT: 9 | ! THIS ROUTINE COMPUTES THE MIXING RATIOS OF CLOUD WATER, 10 | ! CLOUD ICE, RAIN, AND SNOW. THE CODE IS BASED ON SUBROUTINES 11 | ! GSMDRIVE & GSMCOLUMN IN THE NMM MODEL. 12 | ! 13 | ! PROGRAM HISTORY LOG: 14 | ! 01-08-14 YI JIN 15 | ! 02-02-11 Brad Ferrier - Minor changes for consistency w/ NMM model 16 | ! 04-11-10 Brad Ferrier - Removed cloud fraction algorithm 17 | ! 04-11-17 H CHUANG - WRF VERSION 18 | ! USAGE: CALL CALMICT(P1D,T1D,Q1D,C1D,FI1D,FR1D,FS1D,CUREFL 19 | ! &, QW1,QI1,QR1,QS1,DBZ1,DBZR1,DBZI1,DBZC1) 20 | ! INPUT ARGUMENT LIST: 21 | ! P1D - PRESSURE (PA) 22 | ! T1D - TEMPERATURE (K) 23 | ! Q1D - SPECIFIC HUMIDITY (KG/KG) 24 | ! C1D - TOTAL CONDENSATE (CWM, KG/KG) 25 | ! FI1D - F_ice (fraction of condensate in form of ice) 26 | ! FR1D - F_rain (fraction of liquid water in form of rain) 27 | ! FS1D - F_RimeF ("Rime Factor", ratio of total ice growth 28 | ! to deposition growth) 29 | ! CUREFL - Radar reflectivity contribution from convection (mm**6/m**3) 30 | ! 31 | ! OUTPUT ARGUMENT LIST: 32 | ! QW1 - CLOUD WATER MIXING RATIO (KG/KG) 33 | ! QI1 - CLOUD ICE MIXING RATIO (KG/KG) 34 | ! QR1 - RAIN MIXING RATIO (KG/KG) 35 | ! QS1 - "SNOW" (precipitation ice) MIXING RATIO (KG/KG) 36 | ! DBZ1 - Equivalent radar reflectivity factor in dBZ; i.e., 10*LOG10(Z) 37 | ! DBZR - Equivalent radar reflectivity factor from rain in dBZ 38 | ! DBZI - Equivalent radar reflectivity factor from ice (all forms) in dBZ 39 | ! DBZC - Equivalent radar reflectivity factor from parameterized convection in dBZ 40 | ! 41 | ! OUTPUT FILES: 42 | ! NONE 43 | ! 44 | ! SUBPROGRAMS CALLED: 45 | ! FUNCTIONS: 46 | ! FPVS 47 | ! UTILITIES: 48 | ! LIBRARY: 49 | ! NONE 50 | ! 51 | ! ATTRIBUTES: 52 | ! LANGUAGE: FORTRAN 53 | ! MACHINE : IBM SP 54 | !$$$ 55 | ! 56 | !BSF: skip use params_mod 57 | 58 | !use cmassi_mod 59 | ! start CMASSI hardcoded 60 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 61 | implicit none 62 | ! 63 | !----------------------------------------------------------------------- 64 | REAL, PARAMETER :: DMImin=.05e-3, DMImax=1.e-3, & 65 | & XMImin=1.e6*DMImin, XMImax=1.e6*DMImax 66 | INTEGER, PARAMETER :: MDImin=XMImin, MDImax=XMImax 67 | !----------------------------------------------------------------------- 68 | !--- Mean mass of precpitation ice particles as functions of their mean 69 | ! size (in microns) 70 | ! 71 | REAL MASSI(MDImin:MDImax) 72 | ! 73 | !--- Mean rain drop diameters vary from 50 microns to 450 microns 74 | ! 75 | REAL, PARAMETER :: DMRmin=.05E-3, DMRmax=.45E-3, DelDMR=1.E-6 & 76 | &, XMRmin=1.E6*DMRmin, XMRmax=1.E6*DMRmax, N0r0=8.E6, N0rmin=1.e4 77 | INTEGER, PARAMETER :: MDRmin=XMRmin, MDRmax=XMRmax 78 | ! 79 | !--- Various rain lookup tables 80 | ! 81 | REAL MASSR(MDRmin:MDRmax),RQR_DRmin,RQR_DRmax, & 82 | CN0r0,CN0r_DMRmin,CN0r_DMRmax 83 | !end CMASSI hardcoded 84 | 85 | ! hardcode in from params.f 86 | real, parameter :: D608=0.608 87 | real, parameter :: TFRZ=273.15 88 | real, parameter :: EPSQ=1.E-12 89 | real, parameter :: T_ICE=-30. 90 | 91 | 92 | !BSF: need to define array limits for im, jm 93 | ! 94 | ! implicit none 95 | integer, parameter :: im=100, jm=100 96 | 97 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 98 | ! 99 | INTEGER INDEXS, INDEXR 100 | REAL, PARAMETER :: Cice=1.634e13, DBZmin=-20., RD=287.04, & 101 | ONEPS=1.-18.015/28.964 102 | 103 | !BSF: adjust following parameters based on whats in phys/module_mp_etanew.F: 104 | real, parameter :: NLImin=1.E3, NLImax=5.E3 105 | 106 | real,dimension(IM,JM),intent(in) :: P1D,T1D,Q1D,C1D,FI1D,FR1D, & 107 | FS1D,CUREFL 108 | real,dimension(IM,JM),intent(inout) :: QW1,QI1,QR1,QS1,DBZ1,DBZR1,& 109 | DBZI1,DBZC1,NLICE1 110 | 111 | REAL N0r,Ztot,Zrain,Zice,Zconv,Zmin 112 | integer I,J,JSTA,JEND 113 | real TC, Frain,Fice,Flimass,Flarge, & 114 | Fsmall,RimeF,Xsimass,Qice,Qsat,ESAT,WV,RHO,RRHO,RQR, & 115 | DRmm,Qsigrd,WVQW,Dum,XLi,Qlice,WC,DLI,xlimass 116 | !BSF: skip real,external :: fpvs 117 | !************************************************************************ 118 | !--- Determine composition of condensate in the form of cloud water, 119 | ! total ice (cloud ice & snow), & rain following GSMDRIVE in NMM model 120 | ! 121 | 122 | JSTA=1 123 | JEND=100 124 | 125 | Zmin=10.**(0.1*DBZmin) 126 | DO J=JSTA,JEND 127 | DO I=1,IM 128 | QW1(I,J)=0. 129 | QI1(I,J)=0. 130 | QR1(I,J)=0. 131 | QS1(I,J)=0. 132 | NLICE1(I,J)=0. 133 | DBZ1(I,J)=DBZmin 134 | DBZR1(I,J)=DBZmin 135 | DBZI1(I,J)=DBZmin 136 | DBZC1(I,J)=DBZmin 137 | ENDDO 138 | ENDDO 139 | DO J=JSTA,JEND 140 | DO I=1,IM 141 | Zrain=0. !--- Radar reflectivity from rain 142 | Zice=0. !--- Radar reflectivity from ice 143 | Zconv=CUREFL(I,J) !--- Radar reflectivity from convection 144 | IF (C1D(I,J) .LE. EPSQ) THEN 145 | ! 146 | !--- Skip rest of calculatiions if no condensate is present 147 | ! 148 | GO TO 10 149 | ELSE 150 | WC=C1D(I,J) 151 | ENDIF 152 | ! 153 | !--- Code below is from GSMDRIVE for determining: 154 | ! QI1 - total ice (cloud ice & snow) mixing ratio 155 | ! QW1 - cloud water mixing ratio 156 | ! QR1 - rain mixing ratio 157 | ! 158 | TC=T1D(I,J)-TFRZ 159 | Fice=FI1D(I,J) 160 | Frain=FR1D(I,J) 161 | IF (TC.LE.T_ICE .OR. Fice.GE.1.) THEN 162 | ! IF (Fice.GE.1.) THEN 163 | QI1(I,J)=WC 164 | ELSE IF (Fice .LE. 0.) THEN 165 | QW1(I,J)=WC 166 | ELSE 167 | QI1(I,J)=Fice*WC 168 | QW1(I,J)=WC-QI1(I,J) 169 | ENDIF 170 | IF (QW1(I,J).GT.0. .AND. Frain.GT.0.) THEN 171 | IF (Frain .GE. 1.) THEN 172 | QR1(I,J)=QW1(I,J) 173 | QW1(I,J)=0. 174 | ELSE 175 | QR1(I,J)=Frain*QW1(I,J) 176 | QW1(I,J)=QW1(I,J)-QR1(I,J) 177 | ENDIF 178 | ENDIF 179 | !BSF: If you're running the ARW and it has as output arrays qw, qr, qi, then 180 | ! start here. 181 | !-- array QW is the same as the array 'qc' from ARW output 182 | !-- array QR is the same as the array 'qr' from ARW output 183 | !-- array QI is the same as the array 'qs' from ARW output 184 | ! => Here QI includes the total ice, large ice (snow) & small cloud ice 185 | ! This is separated out down below in the code starting with defining 186 | ! the constant 'FLARGE'. 187 | ! 188 | !BSF: skip WV=Q1D(I,J)/(1.-Q1D(I,J)) 189 | ! 190 | !--- Saturation vapor pressure w/r/t water ( >=0C ) or ice ( <0C ) 191 | ! 192 | !BSF: skip ESAT=1000.*FPVS(T1D(I,J)) 193 | !BSF: skip QSAT=EPS*ESAT/(P1D(I,J)-ESAT) 194 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+D608*Q1D(I,J))) 195 | RRHO=1./RHO 196 | ! 197 | !--- Based on code from GSMCOLUMN in model to determine reflectivity from rain 198 | ! 199 | IF (QR1(I,J) .GT. EPSQ) THEN 200 | RQR=RHO*QR1(I,J) 201 | IF (RQR .LE. RQR_DRmin) THEN 202 | N0r=MAX(N0rmin, CN0r_DMRmin*RQR) 203 | INDEXR=MDRmin 204 | ELSE IF (RQR .GE. RQR_DRmax) THEN 205 | N0r=CN0r_DMRmax*RQR 206 | INDEXR=MDRmax 207 | ELSE 208 | N0r=N0r0 209 | INDEXR=MAX( XMRmin, MIN(CN0r0*RQR**.25, XMRmax) ) 210 | ENDIF 211 | ! 212 | !--- INDEXR is the mean drop size in microns; convert to mm 213 | ! 214 | DRmm=1.e-3*REAL(INDEXR) 215 | Zrain=0.72*N0r*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm*DRmm 216 | ENDIF !--- End IF (QR1(I,J) .GT. EPSQ) block 217 | ! 218 | !--- Based on code from GSMCOLUMN in model to determine partition of 219 | ! total ice into cloud ice & snow (precipitation ice) 220 | ! 221 | IF (QI1(I,J) .GT. EPSQ) THEN 222 | QICE=QI1(I,J) 223 | RHO=P1D(I,J)/(RD*T1D(I,J)*(1.+ONEPS*Q1D(I,J))) 224 | RRHO=1./RHO 225 | !BSF: skip QSIgrd=RHgrd*QSAT 226 | !BSF: skip WVQW=WV+QW1(I,J) 227 | ! 228 | ! * FLARGE - ratio of number of large ice to total (large & small) ice 229 | ! * FSMALL - ratio of number of small ice crystals to large ice particles 230 | ! -> Small ice particles are assumed to have a mean diameter of 50 microns. 231 | ! * XSIMASS - used for calculating small ice mixing ratio 232 | ! * XLIMASS - used for calculating large ice mixing ratio 233 | ! * INDEXS - mean size of snow to the nearest micron (units of microns) 234 | ! * RimeF - Rime Factor, which is the mass ratio of total (unrimed & 235 | ! rimed) ice mass to the unrimed ice mass (>=1) 236 | ! * FLIMASS - mass fraction of large ice 237 | ! * QTICE - time-averaged mixing ratio of total ice 238 | ! * QLICE - time-averaged mixing ratio of large ice 239 | ! * NLICE1 - time-averaged number concentration of large ice 240 | ! 241 | IF (TC.GE.0.) THEN !-- BSF: skip .OR. WVQW.LT.QSIgrd) THEN 242 | FLARGE=1. 243 | ELSE 244 | FLARGE=.1 245 | IF (TC.GE.-8. .AND. TC.LE.-3.) FLARGE=.5*FLARGE 246 | ENDIF 247 | FSMALL=(1.-FLARGE)/FLARGE 248 | XSIMASS=RRHO*MASSI(MDImin)*FSMALL 249 | DUM=XMImax*EXP(.0536*TC) 250 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DUM) ) ) 251 | RimeF=AMAX1(1., FS1D(I,J) ) 252 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 253 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 254 | QLICE=FLIMASS*QICE 255 | NLICE1(I,J)=QLICE/XLIMASS 256 | IF (NLICE1(I,J).LT.NLImin .OR. NLICE1(I,J).GT.NLImax) THEN 257 | ! 258 | !--- Force NLICE1 to be between NLImin and NLImax 259 | ! 260 | DUM=MAX(NLImin, MIN(NLImax, NLICE1(I,J)) ) 261 | XLI=RHO*(QICE/DUM-XSIMASS)/RimeF 262 | IF (XLI .LE. MASSI(MDImin) ) THEN 263 | INDEXS=MDImin 264 | ELSE IF (XLI .LE. MASSI(450) ) THEN 265 | DLI=9.5885E5*XLI**.42066 ! DLI in microns 266 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 267 | ELSE IF (XLI .LE. MASSI(MDImax) ) THEN 268 | DLI=3.9751E6*XLI**.49870 ! DLI in microns 269 | INDEXS=MIN(MDImax, MAX(MDImin, INT(DLI) ) ) 270 | ELSE 271 | INDEXS=MDImax 272 | ! 273 | !--- 8/22/01: Increase density of large ice if maximum limits 274 | ! are reached for number concentration (NLImax) and mean size 275 | ! (MDImax). Done to increase fall out of ice. 276 | ! 277 | IF (DUM .GE. NLImax) & 278 | RimeF=RHO*(QICE/NLImax-XSIMASS)/MASSI(INDEXS) 279 | ENDIF ! End IF (XLI .LE. MASSI(MDImin) ) 280 | XLIMASS=RRHO*RimeF*MASSI(INDEXS) 281 | FLIMASS=XLIMASS/(XLIMASS+XSIMASS) 282 | QLICE=FLIMASS*QICE 283 | NLICE1(I,J)=QLICE/XLIMASS 284 | ENDIF ! End IF (NLICE.LT.NLImin ... 285 | QS1(I,J)=AMIN1(QI1(I,J), QLICE) 286 | QI1(I,J)=AMAX1(0., QI1(I,J)-QS1(I,J)) 287 | ! 288 | !--- Equation (C.8) in Ferrier (1994, JAS, p. 272), which when 289 | ! converted from cgs units to mks units results in the same 290 | ! value for Cice, which is equal to the {} term below: 291 | ! 292 | ! Zi={.224*720*(10**18)/[(PI*RHOL)**2]}*(RHO*QLICE)**2/NLICE1(I,J), 293 | ! where RHOL=1000 kg/m**3 is the density of liquid water 294 | ! 295 | !--- Valid only for exponential ice distributions 296 | ! 297 | Zice=Cice*RHO*RHO*QLICE*QLICE/NLICE1(I,J) 298 | ENDIF ! End IF (QI1(I,J) .GT. 0.) THEN 299 | ! 300 | !--- Calculate total (convective + grid-scale) radar reflectivity 301 | 10 Ztot=Zrain+Zice+Zconv 302 | IF (Ztot .GT. Zmin) DBZ1(I,J)= 10.*ALOG10(Ztot) 303 | IF (Zrain .GT. Zmin) DBZR1(I,J)=10.*ALOG10(Zrain) 304 | IF (Zice .GT. Zmin) DBZI1(I,J)=10.*ALOG10(Zice) 305 | IF (Zconv .GT. Zmin) DBZC1(I,J)=10.*ALOG10(Zconv) 306 | ENDDO 307 | ENDDO 308 | ! 309 | RETURN 310 | END 311 | -------------------------------------------------------------------------------- /sample/Ferrier/CALMICT.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaine1/pyWRF/3f5724c446b036f5cf252cb18df0b42b74eb0552/sample/Ferrier/CALMICT.so -------------------------------------------------------------------------------- /sample/Ferrier/CMASSI.f: -------------------------------------------------------------------------------- 1 | module CMASSI_mod 2 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 | implicit none 4 | ! 5 | !----------------------------------------------------------------------- 6 | REAL, PARAMETER :: DMImin=.05e-3, DMImax=1.e-3, & 7 | & XMImin=1.e6*DMImin, XMImax=1.e6*DMImax 8 | INTEGER, PARAMETER :: MDImin=XMImin, MDImax=XMImax 9 | !----------------------------------------------------------------------- 10 | !--- Mean mass of precpitation ice particles as functions of their mean 11 | ! size (in microns) 12 | ! 13 | REAL MASSI(MDImin:MDImax) 14 | ! 15 | !--- Mean rain drop diameters vary from 50 microns to 450 microns 16 | ! 17 | REAL, PARAMETER :: DMRmin=.05E-3, DMRmax=.45E-3, DelDMR=1.E-6 & 18 | &, XMRmin=1.E6*DMRmin, XMRmax=1.E6*DMRmax, N0r0=8.E6, N0rmin=1.e4 19 | INTEGER, PARAMETER :: MDRmin=XMRmin, MDRmax=XMRmax 20 | ! 21 | !--- Various rain lookup tables 22 | ! 23 | REAL MASSR(MDRmin:MDRmax),RQR_DRmin,RQR_DRmax, & 24 | CN0r0,CN0r_DMRmin,CN0r_DMRmax 25 | ! 26 | end module CMASSI_mod 27 | -------------------------------------------------------------------------------- /sample/Ferrier/CMASSI.f90: -------------------------------------------------------------------------------- 1 | module CMASSI_mod 2 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 | implicit none 4 | ! 5 | !----------------------------------------------------------------------- 6 | REAL, PARAMETER :: DMImin=.05e-3, DMImax=1.e-3, & 7 | & XMImin=1.e6*DMImin, XMImax=1.e6*DMImax 8 | INTEGER, PARAMETER :: MDImin=XMImin, MDImax=XMImax 9 | !----------------------------------------------------------------------- 10 | !--- Mean mass of precpitation ice particles as functions of their mean 11 | ! size (in microns) 12 | ! 13 | REAL MASSI(MDImin:MDImax) 14 | ! 15 | !--- Mean rain drop diameters vary from 50 microns to 450 microns 16 | ! 17 | REAL, PARAMETER :: DMRmin=.05E-3, DMRmax=.45E-3, DelDMR=1.E-6 & 18 | &, XMRmin=1.E6*DMRmin, XMRmax=1.E6*DMRmax, N0r0=8.E6, N0rmin=1.e4 19 | INTEGER, PARAMETER :: MDRmin=XMRmin, MDRmax=XMRmax 20 | ! 21 | !--- Various rain lookup tables 22 | ! 23 | REAL MASSR(MDRmin:MDRmax),RQR_DRmin,RQR_DRmax, & 24 | CN0r0,CN0r_DMRmin,CN0r_DMRmax 25 | ! 26 | end module CMASSI_mod 27 | -------------------------------------------------------------------------------- /sample/Ferrier/MICROINIT.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE MICROINIT 2 | ! 3 | !-- ABSTRACT: 4 | ! Initializes arrays for new cloud microphysics 5 | ! 6 | !-- Program History Log: 7 | ! 02-02-08 B. Ferrier 8 | ! 04-11-19 H CHUANG - WRF VERSION 9 | ! 10 | !-- Input argument list: 11 | ! None 12 | ! 13 | !-- Output argument list: 14 | ! None 15 | ! 16 | !-- Subprograms called: 17 | ! Function FPVS 18 | ! 19 | !-- Common blocks: 20 | ! CMASSI 21 | ! RMASS_TABLES 22 | ! MAPOT 23 | ! CRHgrd 24 | ! 25 | !-- Attributes: 26 | ! Language: FORTRAN 90 27 | ! Machine : IBM SP 28 | ! 29 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 30 | use cmassi_mod 31 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32 | implicit none 33 | ! 34 | REAL, PARAMETER :: RHOL=1000. 35 | real ax,C_N0r0 36 | integer i 37 | ! 38 | !------------------------ START EXECUTION ------------------------ 39 | ! 40 | !--- READ IN MASSI FROM LOOKUP TABLES 41 | ! 42 | OPEN (UNIT=1,FILE="eta_micro_lookup.dat",FORM="UNFORMATTED") 43 | DO I=1,3 44 | READ(1) 45 | ENDDO 46 | READ(1) MASSR 47 | DO I=1,5 48 | READ(1) 49 | ENDDO 50 | READ(1) MASSI 51 | CLOSE(1) 52 | RQR_DRmin=N0r0*MASSR(MDRmin) ! Rain content for mean drop diameter of .05 mm 53 | RQR_DRmax=N0r0*MASSR(MDRmax) ! Rain content for mean drop diameter of .45 mm 54 | PI=ACOS(-1.) 55 | C_N0r0=PI*RHOL*N0r0 56 | CN0r0=1.E6/C_N0r0**.25 57 | CN0r_DMRmin=1./(PI*RHOL*DMRmin**4) 58 | CN0r_DMRmax=1./(PI*RHOL*DMRmax**4) 59 | print *,'MICROINIT: MDRmin, MASSR(MDRmin)=',MDRmin,MASSR(MDRmin) 60 | print *,'MICROINIT: MDRmax, MASSR(MDRmax)=',MDRmax,MASSR(MDRmax) 61 | ! print *, 'ETA2P:MASSI(50)= ', MASSI(50) 62 | ! print *, 'ETA2P:MASSI(450)= ', MASSI(450) 63 | ! print *, 'ETA2P:MASSI(1000)= ', MASSI(1000) 64 | ! 65 | !--- Initialize saturation vapor pressure lookup tables (functions FPVS, FPVS0) 66 | ! 67 | !BSF: skip CALL GPVS 68 | ! 69 | !--- Initialize RHgrd, grid-scale RH for onset of condensation. 70 | ! See GSMCONST in Eta model for algorithm with grid-size dependence. 71 | ! 72 | ! AX=111.*(DPHD**2+DLMD**2)**.5 73 | ! AX=111.*(DYVAL/1000.**2+DXVAL/1000.**2)**.5 74 | ! AX=MIN(100., MAX(5., AX) ) 75 | ! RHgrd=0.90+.08*((100.-AX)/95.)**.5 76 | !BSF skip: RHgrd=1. 77 | !--- 78 | RETURN 79 | END 80 | -------------------------------------------------------------------------------- /sample/Ferrier/eta_micro_lookup.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaine1/pyWRF/3f5724c446b036f5cf252cb18df0b42b74eb0552/sample/Ferrier/eta_micro_lookup.dat -------------------------------------------------------------------------------- /sample/Ferrier/params.f: -------------------------------------------------------------------------------- 1 | module params_mod 2 | 3 | !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4 | implicit none 5 | ! 6 | ! file: params.f 7 | ! defines physical constants and smoothing coefficients 8 | ! last update: 09/06/2006 9 | ! 10 | ! SMOOTHING PARAMETERS. 11 | integer, parameter :: KSMUD=4 12 | integer, parameter :: KSLPD=1 13 | integer, parameter :: KSSLP=2 14 | integer, parameter :: KSFI=2 15 | integer, parameter :: KST=2 16 | integer, parameter :: KSUV=2 17 | integer, parameter :: KSRH=2 18 | integer, parameter :: KSAV=2 19 | integer, parameter :: KSLI=2 20 | integer, parameter :: KSLP=2 21 | integer, parameter :: NSUMD=1 22 | 23 | real, parameter :: SMTHA=-1.8E-4 24 | real, parameter :: SMTHB=16.0 25 | ! 26 | ! CONSTANTS. 27 | real, parameter :: CM1=2937.4 28 | real, parameter :: CM2=4.9283 29 | real, parameter :: CM3=23.5518 30 | real, parameter :: D00=0.0 31 | real, parameter :: D1=0.1 32 | real, parameter :: D01=0.01 33 | real, parameter :: D001=0.001 34 | real, parameter :: D50=0.50 35 | real, parameter :: H999=999. 36 | real, parameter :: H1=1.0 37 | real, parameter :: H2=2.0 38 | real, parameter :: H4=4.0 39 | real, parameter :: H99999=99999. 40 | real, parameter :: H1M12=1.E-12 41 | real, parameter :: H1000=1000. 42 | real, parameter :: H1M5=1.E-5 43 | real, parameter :: D125=.125 44 | real, parameter :: D25=0.25 45 | real, parameter :: H100=100. 46 | real, parameter :: H10000=10000. 47 | real, parameter :: H10E5=1.E5 48 | real, parameter :: CAPA=0.28589641E0 49 | real, parameter :: D115=0.115 50 | real, parameter :: D608=0.608 51 | real, parameter :: D05=0.05 52 | real, parameter :: D0065=0.0065 53 | real, parameter :: H1E2=100. 54 | real, parameter :: H1E4=1.E4 55 | real, parameter :: H1M2=1.E-2 56 | real, parameter :: G=9.81 57 | real, parameter :: RD=287.04 58 | real, parameter :: ROG=RD/G 59 | real, parameter :: GI=1./G 60 | real, parameter :: OVERRC=1.10 61 | real, parameter :: AD05=OVERRC*D05 62 | real, parameter :: CFT0=OVERRC-H1 63 | real, parameter :: PI=3.141592653589793 64 | real, parameter :: DTR=3.1415926/180. 65 | real, parameter :: RTD=1./DTR 66 | real, parameter :: ERAD=6.370E6 67 | real, parameter :: CP=1004.6 68 | real, parameter :: RCAPA=1./CAPA 69 | real, parameter :: P1000=1000.E2,DP10M=110 70 | real, parameter :: ELWV=2.50E6 71 | real, parameter :: CPDR=CP/RD 72 | real, parameter :: RG=1./GI 73 | real, parameter :: ELDR=ELWV/RD 74 | real, parameter :: BETA=.00367 75 | real, parameter :: BTG=BETA*G 76 | real, parameter :: FMW=18.015 77 | real, parameter :: FMD=28.964 78 | real, parameter :: EPS=FMW/FMD 79 | real, parameter :: ONEPS=1.-EPS 80 | real, parameter :: TFRZ=273.15 81 | real, parameter :: RDOCP=RD/CP 82 | real, parameter :: LHEAT=2.5E6 83 | real, parameter :: LHTOCP=LHEAT/CP 84 | real, parameter :: EPSQ2=0.02 85 | real, parameter :: PQ0=379.90516 86 | real, parameter :: A2=17.2693882 87 | real, parameter :: A3=273.16 88 | real, parameter :: A4=35.86 89 | real, parameter :: EPSQ=1.E-12 90 | real, parameter :: QCLDmin=1.E-6 91 | real, parameter :: CLFRmin=D1 92 | real, parameter :: NLImin=1.E3 93 | real, parameter :: NLImax=5.E3 94 | real, parameter :: T_ICE=-30. 95 | real, parameter :: TRAD_ice=0.5*T_ICE+TFRZ 96 | real, parameter :: Qconv=0.1E-3 97 | ! 98 | real, parameter :: STBOL=1./5.67E-8 99 | real, parameter :: DBZmin=-20. 100 | real, parameter :: abscoef=8.0 101 | real, parameter :: abscoefi=5.0 102 | real, parameter :: XLAI=4.0 ! Leaf area index 103 | real, parameter :: RHmin=1.0E-6 ! minimal RH bound 104 | real, parameter :: SMALL=1.E-6 105 | real, parameter :: PTHRESH=0.000000 106 | real, parameter :: ELIVW=2.72E6 107 | real, parameter :: ELOCP=ELIVW/CP 108 | ! 109 | real, parameter :: GAMMA=6.5E-3 110 | real, parameter :: RGAMOG=RD*GAMMA/G 111 | 112 | end module params_mod 113 | --------------------------------------------------------------------------------