Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UCLALES-SALSA prognostic droplet simulation results #105

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"metadata": {
"tags": []
},
Expand All @@ -62,9 +62,9 @@
"# Name of the LES simulation\n",
"#exp_name = 'COMBLE_SB_FixN'\n",
"#exp_name = 'COMBLE_SB_FixN_noice'\n",
"exp_name = 'COMBLE_SB_FixN_def_z0'\n",
"#exp_name = 'COMBLE_SB_FixN_def_z0'\n",
"#exp_name = 'COMBLE_SALSA_ProgNc_noice'\n",
"#exp_name = 'COMBLE_SALSA_ProgNc'\n",
"exp_name = 'COMBLE_SALSA_ProgNc'\n",
"#exp_name = 'COMBLE_SALSA_ProgNcNi'\n",
"\n",
"# Github scratch directory where processed model output will be committed\n",
Expand Down Expand Up @@ -131,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -991,7 +991,7 @@
"73 ice nucleation source due to homogoeneous free... "
]
},
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -1022,7 +1022,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -1093,18 +1093,18 @@
" return les_ts['tau_liq'],'No gases or vapors'\n",
" elif standard_name=='precipitation_flux_at_surface':\n",
" # liquid and ice phase, all hydrometeors\n",
" # Unit conversion: W/m2/(J/kg)=kg/m2/s\n",
" # Note: cloud water precipitation ignored\n",
" # Unit conversion for prcp: W/m2/(J/kg)=kg/m2/s\n",
" # Note: cloud water precipitation ignored for SB\n",
" if sb:\n",
" return (les_ts['prcp'])/alvl+(les_ts['iprcp']+les_ts['sprcp']+les_ts['gprcp'])/alvi,''\n",
" else:\n",
" return (les_ts['prcp'])/alvl+(les_ts['sprcp'])/alvi,''\n",
" return les_ts['rmH2Ocl']+les_ts['rmH2Opr']+les_ts['rmH2Osn'],''\n",
" elif standard_name=='precipitation_flux_at_surface_in_ice_phase':\n",
" # ice phase hydrometeors only\n",
" if sb:\n",
" return (les_ts['iprcp']+les_ts['sprcp']+les_ts['gprcp'])/alvi,''\n",
" else:\n",
" return (les_ts['sprcp'])/alvi,''\n",
" return les_ts['rmH2Osn'],''\n",
" elif standard_name=='toa_outgoing_longwave_flux': \n",
" return les_ts['toa_lwu'],''\n",
" elif standard_name=='surface_downwelling_longwave_flux':\n",
Expand All @@ -1124,7 +1124,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -1331,7 +1331,7 @@
" if sb:\n",
" return tmp,'NA'\n",
" else:\n",
" return les_ps['advf_rv']+les_ps['srfc_rv'],''\n",
" return les_ps['advf_rv']+les_ps['diff_rv'],''\n",
" elif standard_name=='tendency_of_aerosol_number_due_to_warm_microphysics':\n",
" # activated and unactivated aerosol (sum over all modes); losses to liquid-liquid hydrometeor collisions\n",
" # + any other liquid-phase sources/sinks that may be accounted for (e.g., from drop breakup); \n",
Expand Down Expand Up @@ -1361,7 +1361,10 @@
" return tmp,'NA' # Switched off\n",
" elif standard_name=='tendency_of_ice_number_due_to_homogeneous_freezing':\n",
" # ice nucleation source due to homogoeneous freezing\n",
" return tmp,'NA' # Switched off\n",
" if sb:\n",
" return tmp,'NA' # Switched off\n",
" else:\n",
" return les_ps['nucm_ns'],''\n",
" #\n",
" print('Undefined ps:'+standard_name+'!')\n",
" return tmp,'NA'"
Expand All @@ -1376,7 +1379,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 8,
"metadata": {
"tags": []
},
Expand All @@ -1385,18 +1388,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
"The file ../../output_les/uclales-salsa/sandbox/UCLALES-SALSA_Lx25_dx100_FixN_def_z0.nc has been deleted successfully\n",
"The file ../../output_les/uclales-salsa/sandbox/UCLALES-SALSA_Lx25_dx100_ProgNc.nc has been deleted successfully\n",
"<class 'netCDF4._netCDF4.Dataset'>\n",
"root group (NETCDF3_CLASSIC data model, file format NETCDF3):\n",
" title: UCLALES-SALSA results for COMBLE-MIP case\n",
" reference: https://github.com/ARM-Development/comble-mip\n",
" authors: Tomi Raatikainen (tomi.raatikainen@fmi.fi)\n",
" source: COMBLE_SB_FixN_def_z0\n",
" version: 2024-06-11 06:41:20\n",
" source: COMBLE_SALSA_ProgNc\n",
" version: 2024-08-07 09:02:16\n",
" format_version: DEPHY SCM format version 1.6\n",
" script: convert_UCLALES-SALSA_output_to_dephy_format.ipynb\n",
" startDate: 2020-03-12T22:00:00Z\n",
" note: Without SALSA, i.e., using the 2M bulk microphysics by Seifert and Beheng (SB). This version has diagnostic clouds (saturation adjustment + fixed CDNC) and prognostic 2M rain, ice, snow and graupel categories.\n",
" note: UCLALES-SALSA with prognostic sectional aerosol, cloud and ice (called snow) categories.\n",
" dimensions(sizes): zf(159), ze(159), time(121)\n",
" variables(dimensions): float64 zf(zf), float64 ze(ze), float64 time(time), float64 ps(time), float64 ts(time), float64 ustar(time), float64 z0(time), float64 z0h(time), float64 z0q(time), float64 hfss(time), float64 hfls(time), float64 ol(time), float64 lwpc(time), float64 lwpr(time), float64 iwp(time), float64 clt(time), float64 od(time), float64 odlc(time), float64 pr(time), float64 pri(time), float64 rlut(time), float64 rlds(time), float64 rlus(time), float64 ssaf(time), float64 pa(time, zf), float64 ua(time, zf), float64 va(time, zf), float64 rhoa(time, zf), float64 ta(time, zf), float64 qv(time, zf), float64 hur(time, zf), float64 huri(time, zf), float64 theta(time, zf), float64 tke_res(time, zf), float64 tke_sgs(time, zf), float64 qlc(time, zf), float64 qlr(time, zf), float64 qic(time, zf), float64 qis(time, zf), float64 qig(time, zf), float64 nlc(time, zf), float64 nlr(time, zf), float64 nic(time, zf), float64 nis(time, zf), float64 nig(time, zf), float64 na1(time, zf), float64 na2(time, zf), float64 na3(time, zf), float64 nlcic(time, zf), float64 niic(time, zf), float64 eps(time, zf), float64 uw(time, zf), float64 vw(time, zf), float64 w2(time, zf), float64 wth(time, zf), float64 vf_thli(time, zf), float64 wqv(time, zf), float64 vf_qt(time, zf), float64 flc(time, zf), float64 prf(time, zf), float64 prfi(time, zf), float64 rld(time, zf), float64 rlu(time, zf), float64 dth_rad(time, zf), float64 dth_micro(time, zf), float64 dth_turb(time, zf), float64 dq_micro(time, zf), float64 dq_turb(time, zf), float64 dna_micro_warm(time, zf), float64 dna_micro_cold(time, zf), float64 dna_turb(time, zf), float64 dni_het(time, zf), float64 dni_sip(time, zf), float64 dni_hom(time, zf)\n",
" groups: \n"
Expand Down Expand Up @@ -1503,19 +1506,19 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate 2d and 3d outputs - test"
"## Generate 2D and 3D outputs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2d"
"### 2D"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {
"tags": []
},
Expand All @@ -1542,7 +1545,7 @@
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>standard_name</th>\n",
" <th>variable id</th>\n",
" <th>variable_id</th>\n",
" <th>units</th>\n",
" <th>dimensions</th>\n",
" <th>comment (10-min instantaneous)</th>\n",
Expand Down Expand Up @@ -1666,7 +1669,7 @@
"</div>"
],
"text/plain": [
" standard_name variable id units \\\n",
" standard_name variable_id units \\\n",
"0 time time s \n",
"1 x x m \n",
"2 y y m \n",
Expand Down Expand Up @@ -1699,7 +1702,7 @@
"13 time, x, y flux at top-of-atmosphere in window containing... "
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1712,7 +1715,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -1745,7 +1748,7 @@
" if sb:\n",
" return (les_cs['rprcp'])/alvl+(les_cs['iprcp']+les_cs['sprcp']+les_cs['gprcp'])/alvi,''\n",
" else:\n",
" return les_cs['rprcp']/alvl+les_cs['sprcp']/alvi,''\n",
" return (les_cs['cprcp']+les_cs['rprcp'])/alvl+les_cs['sprcp']/alvi,''\n",
" elif standard_name=='atmosphere_mass_content_of_liquid_water':\n",
" # all liquid hydrometeors\n",
" return les_cs['lwp']+les_cs['rwp'],''\n",
Expand Down Expand Up @@ -1810,7 +1813,7 @@
"les_cs = xr.open_dataset(input_filename_cs)\n",
"\n",
"# create DEPHY output file\n",
"dephy_filename = my_gitdir + my_outfile + '_2d.nc'\n",
"dephy_filename = my_gitdir + my_outfile + '_2D.nc'\n",
"if os.path.exists(dephy_filename):\n",
" try:\n",
" os.remove(dephy_filename)\n",
Expand Down Expand Up @@ -1849,15 +1852,26 @@
"y[:] = les_cs['yt'].data\n",
"\n",
"# time\n",
"nt = les_cs.sizes['time']\n",
"time = dephy_file.createDimension('time', nt)\n",
"time = dephy_file.createVariable('time', np.float64, ('time',))\n",
"time.units = 'seconds since ' + dephy_file.startDate\n",
"time.long_name = 'time'\n",
"time[:] = 5.*np.floor(les_cs['time'].data/5.) # Model time may exceed target time by 1 s\n",
"t10min=True #False\n",
"if t10min:\n",
" # 10 min resolution\n",
" nt = les_cs.sizes['time']\n",
" time = dephy_file.createDimension('time', nt)\n",
" time = dephy_file.createVariable('time', np.float64, ('time',))\n",
" time.units = 'seconds since ' + dephy_file.startDate\n",
" time.long_name = 'time'\n",
" time[:] = 5.*np.floor(les_cs['time'].data/5.) # Model time may exceed target time by 1 s\n",
"else:\n",
" # 60 min resolution\n",
" nt = (les_cs.sizes['time']-1)/6+1\n",
" time = dephy_file.createDimension('time', nt)\n",
" time = dephy_file.createVariable('time', np.float64, ('time',))\n",
" time.units = 'seconds since ' + dephy_file.startDate\n",
" time.long_name = 'time'\n",
" time[:] = 5.*np.floor(les_cs['time'][::6].data/5.) # Model time may exceed target time by 1 s\n",
"\n",
"#preci = np.float64 # Default\n",
"preci = np.float32 # To save disc space\n",
"preci = np.float64 # Default\n",
"#preci = np.float32 # To save disc space\n",
"\n",
"# create variables\n",
"for index in vars_2d_list.index[3:]:\n",
Expand All @@ -1873,7 +1887,10 @@
" if note=='NA':\n",
" print('Ignoring '+std_name+' (no data)')\n",
" else:\n",
" new[:]=dat\n",
" if t10min:\n",
" new[:]=dat # 10 min resolution\n",
" else:\n",
" new[:]=dat[::6,:,:] # 60 min resolution\n",
" if len(note)>0: new.note=note\n",
" except Exception as e:\n",
" print('Failed: '+std_name,e)\n",
Expand All @@ -1891,12 +1908,12 @@
"tags": []
},
"source": [
"#### 3d"
"### 3D"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {
"tags": []
},
Expand All @@ -1923,7 +1940,7 @@
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>standard_name</th>\n",
" <th>variable id</th>\n",
" <th>variable_id</th>\n",
" <th>units</th>\n",
" <th>dimensions</th>\n",
" <th>comment (60-min instantaneous, red=required for EMC2)</th>\n",
Expand Down Expand Up @@ -2183,7 +2200,7 @@
"</div>"
],
"text/plain": [
" standard_name variable id units \\\n",
" standard_name variable_id units \\\n",
"0 time time s \n",
"1 x x m \n",
"2 y y m \n",
Expand Down Expand Up @@ -2250,7 +2267,7 @@
"30 time, height, x, y tendency of ice mixing ratio due to riming; su... "
]
},
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -2402,7 +2419,7 @@
" if sb:\n",
" return -les_an['rimi_rc']-les_an['rimi_rr'],'Cloud and rain'\n",
" else:\n",
" return -les_an['coag_rc']-les_an['coag_rr'],'Cloud and rain'\n",
" return les_an['coag_rs'],''\n",
" #\n",
" print('Undefined an:'+standard_name+'!')\n",
" return tmp,'NA'"
Expand Down Expand Up @@ -2440,7 +2457,7 @@
"les_an = xr.open_dataset(input_filename_an)\n",
"\n",
"# create DEPHY output file\n",
"dephy_filename = my_gitdir + my_outfile + '_3d.nc'\n",
"dephy_filename = my_gitdir + my_outfile + '_3D.nc'\n",
"if os.path.exists(dephy_filename):\n",
" try:\n",
" os.remove(dephy_filename)\n",
Expand Down Expand Up @@ -2496,8 +2513,8 @@
"time.long_name = 'time'\n",
"time[:] = 5*np.floor(les_an['time'].data/5.) # Model time may exceed target time by 1 s\n",
"\n",
"#preci = np.float64 # Default\n",
"preci = np.float32 # To save disc space\n",
"preci = np.float64 # Default\n",
"#preci = np.float32 # To save disc space\n",
"\n",
"# create variables\n",
"for index in vars_3d_list.index[4:]:\n",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading