From 807c49efbb94ff3424438d9c985f5683c969c3ac Mon Sep 17 00:00:00 2001 From: Daniel Adriaansen Date: Mon, 23 Dec 2024 22:24:35 +0000 Subject: [PATCH] Removes erroneous code from script that this script was copied from. --- .../create_raob_mask_file.py | 87 ------------------- 1 file changed, 87 deletions(-) diff --git a/parm/use_cases/model_applications/land_surface/PointStat_fcstUFS_obsGDAS_CTP_HI/create_raob_mask_file.py b/parm/use_cases/model_applications/land_surface/PointStat_fcstUFS_obsGDAS_CTP_HI/create_raob_mask_file.py index 4eeb6c6f4..0d2f17597 100644 --- a/parm/use_cases/model_applications/land_surface/PointStat_fcstUFS_obsGDAS_CTP_HI/create_raob_mask_file.py +++ b/parm/use_cases/model_applications/land_surface/PointStat_fcstUFS_obsGDAS_CTP_HI/create_raob_mask_file.py @@ -46,90 +46,3 @@ # Write out the text file that GenVxMask needs point_data['latlon'].astype('object').to_csv(outfile,index=False,sep=' ',header=['RAOB_SITES'],quoting=3,escapechar=' ') -exit() - -# Array to hold the CTP values for each station -ctp = np.array([]) - -# Process each group, which is defined as a single site -# Each site will have the MET 11-column data. -for name,group in groups: - - print("") - print("PROCESSING SITE: %s" % (name)) - - # First, make sure there is only one valid time - timegrp = group.groupby('vld') - if timegrp.ngroups>1: - print("INFO: FOUND MULTIPLE SOUNDINGS FOR THIS SITE.") - print("USING THE FIRST") - timegrp_name = [sg_name for sg_name,sg_df in timegrp] - prof = timegrp.get_group(timegrp_name[0]) - else: - prof = group - - # Filter out stations that we don't want to process - if name not in point_data['sid'].values.tolist(): - continue - - # In each group here, there are rows for each variable at each pressure level. - # Thus, we can subset based on TMP and just use the pressure data for TMP. - sub = prof[prof['var']=='TMP'] - - # Ensure the temperature subset has data - if len(sub)==0: - print("ERROR! NO TMP DATA.") - print("UNABLE TO COMPUTE CTP FOR SID: %s" % (name)) - ctp = np.append(ctp,-9999.) - continue - - # Subset out the data for this site into individual arrays - # and add units using MetPy - tmpsub = sub['obs'].astype('float').values*units('degK') - prssub = sub['lvl'].astype('float').values*units('hPa') - qcsub = sub['qc'].astype('int').values - - # The pressures must exceed 300 hPa above the lowest in the sounding - if max(prssub.m)<= min(prssub.m+300.0): - print("ERROR! SOUNDING TOP PRESSURE DOES NOT EXCEED 300 hPa ABOVE THE LOWEST PRESSURE.") - print("UNABLE TO COMPUTE CTP FOR SID: %s" % (name)) - ctp = np.append(ctp,-9999.) - else: - # Append the CTP value - thisctp = land_surface.calc_ctp(prssub,tmpsub) - ctp = np.append(ctp,thisctp.m) - -# After each station is processed, add in the missing 11-column data -# lvl --> set to 1000.0 -# hgt --> set to 0 -# qc --> set to 'NA' for now -# var --> set to "CTP" -# typ --> reset from ADPUPA to ADPSFC -point_data['obs'] = ctp -point_data['lvl'] = [1000.0]*len(point_data) -point_data['hgt'] = [0]*len(point_data) -point_data['qc'] = ['NA']*len(point_data) -point_data['var'] = ['CTP']*len(point_data) -point_data['typ'] = ['ADPSFC']*len(point_data) - -# Assign proper dtypes -met_col_dtypes = {'typ':'string', - 'sid':'string', - 'vld':'string', - 'lat':'float64', - 'lon':'float64', - 'elv':'float64', - 'var':'string', - 'lvl':'float64', - 'hgt':'float64', - 'qc':'string', - 'obs':'float64'} -point_data = point_data.astype(met_col_dtypes) - -# Reorder the columns to be correct -point_data = point_data[['typ','sid','vld','lat','lon','elv','var','lvl','hgt','qc','obs']] - -print(point_data) - -# Convert to MET object -point_data = point_data.values.tolist()