@@ -773,10 +773,7 @@ def get_IC_data_from_UFS_history(dir, i, j, lam, tile):
773773 icmr = nc_file ['icmr' ][0 ,::- 1 ,i ,j ]
774774 pressfc = nc_file ['pressfc' ][0 ,i ,j ]
775775 tmp = nc_file ['tmp' ][0 ,::- 1 ,i ,j ]
776- #mz
777- w_ls = nc_file ['dzdt' ][0 ,::- 1 ,i ,j ]
778- omga = nc_file ['omga' ][0 ,::- 1 ,i ,j ]
779-
776+
780777 delz = np .asarray (delz )
781778 zh = np .zeros (nlevs )
782779 zh [0 ] = 0.5 * delz [0 ]
@@ -793,8 +790,6 @@ def get_IC_data_from_UFS_history(dir, i, j, lam, tile):
793790 "dz" : dz ,
794791 "ua" : np .asarray (ugrd ),
795792 "va" : np .asarray (vgrd ),
796- 'wa' : np .asarray (w_ls ),
797- 'wap' : np .asarray (omga ),
798793 "qv" : np .asarray (spfh ),
799794 "o3" : np .asarray (o3mr ),
800795 "ql" : np .asarray (clwmr ),
@@ -2400,9 +2395,6 @@ def get_UFS_forcing_data(nlevs, state_IC, location, use_nearest, forcing_dir, gr
24002395 u_lay = []
24012396 v_lay = []
24022397 time_hr = []
2403- #mz
2404- w_lay = []
2405- omga_lay = []
24062398
24072399 # Get grid from UFS IC data
24082400 (ic_grid_lon , ic_grid_lat ) = get_initial_lon_lat_grid (grid_dir , tile , lam )
@@ -2444,9 +2436,6 @@ def get_UFS_forcing_data(nlevs, state_IC, location, use_nearest, forcing_dir, gr
24442436 qv_data = regridder (nc_file ['spfh' ][0 ,::- 1 ,:,:])
24452437 u_data = regridder (nc_file ['ugrd' ][0 ,::- 1 ,:,:])
24462438 v_data = regridder (nc_file ['vgrd' ][0 ,::- 1 ,:,:])
2447- #mz
2448- w_data = regridder (nc_file ['dzdt' ][0 ,::- 1 ,:,:])
2449- omga_data = regridder (nc_file ['omga' ][0 ,::- 1 ,:,:])
24502439 i_get = 0
24512440 j_get = 0
24522441 # Same grids for history file (data_grid) to IC file (ic_grid).
@@ -2456,9 +2445,6 @@ def get_UFS_forcing_data(nlevs, state_IC, location, use_nearest, forcing_dir, gr
24562445 qv_data = nc_file ['spfh' ][0 ,::- 1 ,:,:]
24572446 u_data = nc_file ['ugrd' ][0 ,::- 1 ,:,:]
24582447 v_data = nc_file ['vgrd' ][0 ,::- 1 ,:,:]
2459- #mz
2460- w_data = nc_file ['dzdt' ][0 ,::- 1 ,:,:]
2461- omga_data = nc_file ['omga' ][0 ,::- 1 ,:,:]
24622448 i_get = i
24632449 j_get = j
24642450 # end if
@@ -2469,29 +2455,10 @@ def get_UFS_forcing_data(nlevs, state_IC, location, use_nearest, forcing_dir, gr
24692455 qv_data = nc_file ['spfh' ][0 ,::- 1 ,:,:]
24702456 u_data = nc_file ['ugrd' ][0 ,::- 1 ,:,:]
24712457 v_data = nc_file ['vgrd' ][0 ,::- 1 ,:,:]
2472- #mz
2473- w_data = nc_file ['dzdt' ][0 ,::- 1 ,:,:]
2474- omga_data = nc_file ['omga' ][0 ,::- 1 ,:,:]
24752458 j_get = tile_jj
24762459 i_get = tile_ii
24772460 # end if (use-nearest)
24782461
2479- #mz placeholder to smooth
2480-
2481-
2482- def smooth (data , window_size = 5 ):
2483- return np .convolve (data .flatten (), np .ones (window_size )/ window_size , mode = 'same' ).reshape (data .shape )
2484-
2485-
2486- # Smooth the data
2487- w_data_smooth = smooth (w_data , window_size = 5 )
2488- omga_data_smooth = smooth (omga_data , window_size = 5 )
2489-
2490- w_data = w_data_smooth
2491- omga_data = omga_data_smooth
2492-
2493- #mz
2494-
24952462 # Store surface pressure.
24962463 ps .append (ps_data [j_get ,i_get ])
24972464
@@ -2521,9 +2488,6 @@ def smooth(data, window_size=5):
25212488 qv_lay .append (qv_data [:,j_get ,i_get ])
25222489 u_lay .append (u_data [:,j_get ,i_get ])
25232490 v_lay .append (v_data [:,j_get ,i_get ])
2524- #mz
2525- w_lay .append (w_data [:,j_get ,i_get ])
2526- omga_lay .append (omga_data [:,j_get ,i_get ])
25272491 time_hr .append (nc_file ['time' ][0 ])
25282492
25292493 # Close file
@@ -2538,9 +2502,6 @@ def smooth(data, window_size=5):
25382502 qv_lay = np .asarray (qv_lay )
25392503 u_lay = np .asarray (u_lay )
25402504 v_lay = np .asarray (v_lay )
2541- #mz
2542- w_lay = np .asarray (w_lay )
2543- omga_lay = np .asarray (omga_lay )
25442505 time_hr = np .asarray (time_hr )
25452506
25462507 # Compute virtual temperature.
@@ -2767,21 +2728,12 @@ def smooth(data, window_size=5):
27672728 qv_rev = np .zeros ([1 ,nlevs ])
27682729 u_rev = np .zeros ([1 ,nlevs ])
27692730 v_rev = np .zeros ([1 ,nlevs ])
2770- #mz
2771- w_rev = np .zeros ([1 ,nlevs ])
2772- omga_rev = np .zeros ([1 ,nlevs ])
2773-
27742731 tv_layr = np .zeros ([n_files + 1 ,nlevs ])
27752732 qv_layr = np .zeros ([n_files + 1 ,nlevs ])
27762733 u_layr = np .zeros ([n_files + 1 ,nlevs ])
27772734 v_layr = np .zeros ([n_files + 1 ,nlevs ])
27782735 p_layr = np .zeros ([n_files + 1 ,nlevs ])
27792736 p_levr = np .zeros ([n_files + 1 ,nlevs + 1 ])
2780- #mz
2781- w_layr = np .zeros ([n_files + 1 ,nlevs ])
2782- omga_layr = np .zeros ([n_files + 1 ,nlevs ])
2783-
2784-
27852737
27862738 #
27872739 # First timestep...
@@ -2816,18 +2768,14 @@ def smooth(data, window_size=5):
28162768 v_init_rev = state_IC ["va" ][::- 1 ]
28172769 v_rev_new = fv3_remap .map1_ppm (nlevs , from_p , v_init_rev [np .newaxis , :], 0.0 , \
28182770 nlevs , to_p , 0 , 0 , - 1 , kord_tm )
2819-
2771+
28202772 # Store
28212773 p_layr [0 ,:] = p_lay [0 ,:]
28222774 p_levr [0 ,:] = p_lev [0 ,:]
28232775 v_layr [0 ,:] = v_rev_new [0 ,::- 1 ]
28242776 u_layr [0 ,:] = u_rev_new [0 ,::- 1 ]
28252777 tv_layr [0 ,:] = tv_rev_new [0 ,::- 1 ]
28262778 qv_layr [0 ,:] = qv_rev_new [0 ,::- 1 ]
2827- #mz: not in IC
2828- w_layr [0 ,:] = 0.0
2829- omga_layr [0 ,:] = 0.0
2830-
28312779
28322780 # Subsequent timestep(s). (exact-mode only)
28332781 if exact_mode :
@@ -2855,26 +2803,13 @@ def smooth(data, window_size=5):
28552803 v_rev [0 ,:] = v_lay [t ,::- 1 ]
28562804 v_rev_new = fv3_remap .map1_ppm (nlevs , from_p , v_rev , 0.0 , nlevs , to_p , \
28572805 0 , 0 , - 1 , kord_tm )
2858- #mz
2859- # vertical wind @ time > 0
2860- w_rev [0 ,:] = w_lay [t ,::- 1 ]
2861- w_rev_new = fv3_remap .map1_ppm (nlevs , from_p , w_rev , 0.0 , nlevs , to_p , \
2862- 0 , 0 , - 1 , kord_tm )
2863- # Meridional wind @ time > 0
2864- omga_rev [0 ,:] = omga_lay [t ,::- 1 ]
2865- omga_rev_new = fv3_remap .map1_ppm (nlevs , from_p , omga_rev , 0.0 , nlevs , to_p , \
2866- 0 , 0 , - 1 , kord_tm )
2867-
28682806 # Store
28692807 p_layr [t + 1 ,:] = p_lay [t + 1 ,:]
28702808 p_levr [t + 1 ,:] = p_lev [t + 1 ,:]
28712809 tv_layr [t + 1 ,:] = tv_rev_new [0 ,::- 1 ]
28722810 qv_layr [t + 1 ,:] = qv_rev_new [0 ,::- 1 ]
28732811 u_layr [t + 1 ,:] = u_rev_new [0 ,::- 1 ]
28742812 v_layr [t + 1 ,:] = v_rev_new [0 ,::- 1 ]
2875- #mz
2876- w_layr [t + 1 ,:] = w_rev_new [0 ,::- 1 ]
2877- omga_layr [t + 1 ,:] = omga_rev_new [0 ,::- 1 ]
28782813 # end for
28792814
28802815 #
@@ -2884,9 +2819,6 @@ def smooth(data, window_size=5):
28842819 qv_layr [t + 2 ,:] = qv_layr [t + 1 ,:]
28852820 u_layr [t + 2 ,:] = u_layr [t + 1 ,:]
28862821 v_layr [t + 2 ,:] = v_layr [t + 1 ,:]
2887- #mz
2888- w_layr [t + 2 ,:] = w_layr [t + 1 ,:]
2889- omga_layr [t + 2 ,:] = omga_layr [t + 1 ,:]
28902822 # end if (exact-mode)
28912823
28922824 # Temperature
@@ -2896,8 +2828,6 @@ def smooth(data, window_size=5):
28962828 stateInit = {"p_lay" : p_lay [0 ,:], \
28972829 "t_lay" : t_lay [0 ,:], \
28982830 "qv_lay" : qv_lay [0 ,:], \
2899- "w_lay" : w_lay [0 ,:], \
2900- "omga_lay" : omga_lay [0 ,:], \
29012831 "u_lay" : u_lay [0 ,:], \
29022832 "v_lay" : v_lay [0 ,:]}
29032833
@@ -3042,10 +2972,6 @@ def smooth(data, window_size=5):
30422972 tot_advec_qv = np .zeros ((nlevs ,ntimes ),dtype = float )
30432973 tot_advec_u = np .zeros ((nlevs ,ntimes ),dtype = float )
30442974 tot_advec_v = np .zeros ((nlevs ,ntimes ),dtype = float )
3045- #mz
3046- w_ls = np .zeros ((nlevs ,ntimes ),dtype = float )
3047- omga = np .zeros ((nlevs ,ntimes ),dtype = float )
3048-
30492975
30502976 time [0 ] = 0.0
30512977 time [1 ] = sec_in_hr * time_hr [0 ] - time_setback #forcing period should extend from beginning of diagnostic period to right BEFORE the next one
@@ -3061,11 +2987,6 @@ def smooth(data, window_size=5):
30612987 tot_advec_u [:,1 ] = tot_advec_u [:,0 ]
30622988 tot_advec_v [:,0 ] = dvdt_adv [0 ,:]
30632989 tot_advec_v [:,1 ] = tot_advec_v [:,0 ]
3064- #mz
3065- w_ls [:,0 ] = w_lay [0 ,:]
3066- w_ls [:,1 ] = w_ls [:,0 ]
3067- omga [:,0 ] = omga_lay [0 ,:]
3068- omga [:,1 ] = omga [:,0 ]
30692990
30702991 for t in range (1 ,n_files ):
30712992 time [2 * t ] = sec_in_hr * time_hr [t - 1 ]
@@ -3082,12 +3003,6 @@ def smooth(data, window_size=5):
30823003 tot_advec_u [:,2 * t + 1 ] = tot_advec_u [:,2 * t ]
30833004 tot_advec_v [:,2 * t ] = dvdt_adv [t ,:]
30843005 tot_advec_v [:,2 * t + 1 ] = tot_advec_v [:,2 * t ]
3085- #mz
3086- w_ls [:,2 * t ] = w_lay [t ,:]
3087- w_ls [:,2 * t + 1 ] = w_ls [:,2 * t ]
3088- omga [:,2 * t ] = omga_lay [t ,:]
3089- omga [:,2 * t + 1 ] = omga [:,2 * t ]
3090-
30913006 # end for
30923007 elif (time_method == 'gradient' ): #this produced wonky results in the SCM; avoid until investigated more
30933008 print ('Forcing can be interpolated in time since the forcing terms are assumed to follow a constant time-gradient.' )
@@ -3140,14 +3055,14 @@ def smooth(data, window_size=5):
31403055 # end if
31413056
31423057 #
3143- #mz w_ls = np.zeros((nlevs,ntimes),dtype=float)
3144- #mz omega = np.zeros((nlevs,ntimes),dtype=float)
3058+ w_ls = np .zeros ((nlevs ,ntimes ),dtype = float )
3059+ omega = np .zeros ((nlevs ,ntimes ),dtype = float )
31453060 rad_heating = np .zeros ((nlevs ,ntimes ),dtype = float )
31463061
31473062 forcing = {
31483063 "time" : time ,
31493064 "wa" : w_ls .swapaxes (0 ,1 ),
3150- "wap" : omga .swapaxes (0 ,1 ),
3065+ "wap" : omega .swapaxes (0 ,1 ),
31513066 "tnta_rad" : rad_heating .swapaxes (0 ,1 ),
31523067 "ps_forc" : np .ones (ntimes )* ps [0 ],
31533068 "pa_forc" : pressure_forc .swapaxes (0 ,1 ),
0 commit comments