From 99895310a01e533aee829d3eecd7a950b41eaa00 Mon Sep 17 00:00:00 2001 From: Shastri Paturi Date: Wed, 10 Jan 2024 21:23:15 +0000 Subject: [PATCH] Fixed coding norms --- .../bufr2ioda/bufr2ioda_altkob_surface.py | 56 ++++++------------- .../bufr2ioda_bathythermal_profiles.py | 20 ++++--- .../bufr2ioda_subpfl_argo_profiles.py | 24 ++++---- .../bufr2ioda_subpfl_glider_profiles.py | 22 ++++---- .../bufr2ioda_tesac_mammals_profiles.py | 24 ++++---- .../bufr2ioda/bufr2ioda_tesac_profiles.py | 23 ++++---- .../bufr2ioda/bufr2ioda_trackob_surface.py | 19 ++++--- .../bufr2ioda/bufr2ioda_xbtctd_profiles.py | 18 +++--- 8 files changed, 100 insertions(+), 106 deletions(-) diff --git a/ush/ioda/bufr2ioda/bufr2ioda_altkob_surface.py b/ush/ioda/bufr2ioda/bufr2ioda_altkob_surface.py index 62c7fb80f..cc6e1210d 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_altkob_surface.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_altkob_surface.py @@ -5,10 +5,6 @@ # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. import sys -sys.path.append('/work2/noaa/da/spaturi/sandbox/CDA_testbed/global-workflow/sorc/gdas.cd/build/lib/python3.7/') -sys.path.append('/work2/noaa/da/spaturi/sandbox/CDA_testbed/global-workflow/sorc/gdas.cd/build/lib/python3.7/pyiodaconv/') -sys.path.append('/work2/noaa/da/spaturi/sandbox/CDA_testbed/global-workflow/sorc/gdas.cd/build/lib/python3.7/pyioda/') - import numpy as np import numpy.ma as ma import os @@ -24,13 +20,16 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): + lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) logger.debug(f"Len of Sequence Number: {len(seqNum)}") return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -50,7 +49,7 @@ def bufr_to_ioda(config, logger): yyyymmdd = cycle[0:8] hh = cycle[8:10] - + # General Information converter = 'BUFR to IODA Converter' platform_description = 'Surface obs from ALTKOB: temperature and salinity' @@ -59,15 +58,14 @@ def bufr_to_ioda(config, logger): DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #print(platform_description) - #=========================================== + # =========================================== # Make the QuerySet for all the data we want - #=========================================== + # =========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") - q = bufr.QuerySet() #(subsets) + q = bufr.QuerySet() # MetaData q.add('year', '*/YEAR') @@ -91,10 +89,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # =============================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data # ============================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: @@ -115,7 +114,7 @@ def bufr_to_ioda(config, logger): temp -= 273.15 saln = r.get('saln',group_by='depth') - # print ("masking temp & saln ...") + # Add mask based on min, max values mask = ((temp > -10.0) & (temp <= 50.0)) & ((saln >= 0.0) & (saln <= 45.0)) lat = lat[mask] lon = lon[mask] @@ -137,10 +136,9 @@ def bufr_to_ioda(config, logger): logger.debug(f" ... Executing QuerySet: Check BUFR variable generic \ dimension and type ...") -# #================================ -# # Check values of BUFR variables, dimension and type -# #================================ - + # ================================================== + # Check values of BUFR variables, dimension and type + # ================================================== logger.debug(f" temp min, max, length, dtype = {temp.min()}, {temp.max()}, {len(temp)}, {temp.dtype}") logger.debug(f" saln min, max, length, dtype = {saln.min()}, {saln.max()}, {len(saln)}, {saln.dtype}") logger.debug(f" lon min, max, length, dtype = {lon.min()}, {lon.max()}, {len(lon)}, {lon.dtype}") @@ -153,7 +151,6 @@ def bufr_to_ioda(config, logger): logger.debug(f" stationID shape, dtype = {stationID.shape}, {stationID.astype(str).dtype}") logger.debug(f" dateTime shape, dtype = {dateTime.shape}, {dateTime.dtype}") logger.debug(f" rcptdateTime shape, dytpe = {rcptdateTime.shape}, {rcptdateTime.dtype}") -# logger.debug(f" sequence Num shape, dtype = {seqNum.shape}, {seqNum.dtype}") # ===================================== # Create IODA ObsSpace @@ -171,7 +168,6 @@ def bufr_to_ioda(config, logger): if path and not os.path.exists(path): os.makedirs(path) -# logger.debug(f" ... ... Create output file ...', OUTPUT_PATH) obsspace = ioda_ospace.ObsSpace(OUTPUT_PATH, mode='w', dim_dict=dims) # Create Global attributes @@ -181,16 +177,10 @@ def bufr_to_ioda(config, logger): obsspace.write_attr('sourceFiles', bufrfile) obsspace.write_attr('dataProviderOrigin', data_provider) obsspace.write_attr('description', data_description) - #obsspace.write_attr('datetimeReference', reference_time) - obsspace.write_attr('datetimeRange', [str(dateTime.min()), - str(dateTime.max())]) + obsspace.write_attr('datetimeRange', [str(dateTime.min()), str(dateTime.max())]) obsspace.write_attr('platformLongDescription', platform_description) -# obsspace.write_attr('platforms', PLATFORM + ': temperature and salinity') -# obsspace.write_attr('datetimeReference', date) -# obsspace.write_attr('dataProviderOrigin', 'GTS/NCEP data tank') -# obsspace.write_attr('description', '24-hrly from 6-hourly dumps') -# - # Create IODA variables + + # Create IODA variables logger.debug(f" ... ... Create variables: name, type, units, and attributes") # Datetime @@ -224,17 +214,6 @@ def bufr_to_ioda(config, logger): .write_attr('long_name', 'Station Identification') \ .write_data(stationID) -# # Depth -# obsspace.create_var('MetaData/depth', dtype=depth.dtype, fillval=depth.fill_value) \ -# .write_attr('units', 'm') \ -# .write_attr('long_name', 'Water depth') \ -# .write_data(depth) - - # # Sequence Number - # obsspace.create_var('MetaData/sequenceNumber', dtype=PreQC.dtype, fillval=PreQC.fill_value) \ - # .write_attr('long_name', 'Sequence Number') \ - # .write_data(seqNum) - # PreQC obsspace.create_var('PreQC/seaSurfaceTemperature', dtype=PreQC.dtype, fillval=PreQC.fill_value) \ .write_attr('long_name', 'PreQC') \ @@ -275,6 +254,7 @@ def bufr_to_ioda(config, logger): logger.debug(f"All Done!") + if __name__ == '__main__': start_time = time.time() @@ -284,7 +264,7 @@ def bufr_to_ioda(config, logger): logger = Logger('bufr2ioda_trackob_surface.py', level=log_level, colored_log=True) - with open(config, "r") as json_file: + with open(args.config, "r") as json_file: config = json.load(json_file) bufr_to_ioda(config, logger) diff --git a/ush/ioda/bufr2ioda/bufr2ioda_bathythermal_profiles.py b/ush/ioda/bufr2ioda/bufr2ioda_bathythermal_profiles.py index ffdac429e..17076daf7 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_bathythermal_profiles.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_bathythermal_profiles.py @@ -20,6 +20,7 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) @@ -27,6 +28,7 @@ def Compute_sequenceNumber(lon): return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -52,17 +54,16 @@ def bufr_to_ioda(config, logger): platform_description = 'Profiles from BATHYthermal: temperature' bufrfile = f"{cycle_type}.t{hh}z.{data_format}.tm{hh}.bufr_d" - DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos", - bufrfile) + DATA_PATH = os.path.join(dump_dir, f"{cycle_type}.{yyyymmdd}", str(hh), f"atmos",bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #=========================================== + # ========================================== # Make the QuerySet for all the data we want - #=========================================== + # ========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") - q = bufr.QuerySet() #(subsets) + q = bufr.QuerySet() # MetaData q.add('year', '*/YEAR') @@ -87,10 +88,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # ========================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data - # ============================================================== + # ========================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: @@ -181,8 +183,8 @@ def bufr_to_ioda(config, logger): obsspace.write_attr('description', data_description) obsspace.write_attr('datetimeRange', [str(dateTime.min()), str(dateTime.max())]) obsspace.write_attr('platformLongDescription', platform_description) -# - # Create IODA variables + + # Create IODA variables logger.debug(f" ... ... Create variables: name, type, units, and attributes") # Datetime diff --git a/ush/ioda/bufr2ioda/bufr2ioda_subpfl_argo_profiles.py b/ush/ioda/bufr2ioda/bufr2ioda_subpfl_argo_profiles.py index 773115c5a..9d152e6fb 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_subpfl_argo_profiles.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_subpfl_argo_profiles.py @@ -20,13 +20,16 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): + lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) logger.debug(f"Len of Sequence Number: {len(seqNum)}") return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -56,9 +59,9 @@ def bufr_to_ioda(config, logger): bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #=========================================== + # ========================================== # Make the QuerySet for all the data we want - #=========================================== + # ========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") @@ -88,11 +91,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # ========================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data - # ============================================================== - + # ========================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: r = f.execute(q) @@ -128,9 +131,9 @@ def bufr_to_ioda(config, logger): seqNum = Compute_sequenceNumber(lon) - #================================================= + # ======================================= # Separate ARGO profiles from subpfl tank - #================================================= + # ======================================= logger.debug(f"Finding index for ARGO floats where the second number of the stationID=9...") index_list=[] for index, number in enumerate(stationID): @@ -166,10 +169,10 @@ def bufr_to_ioda(config, logger): logger.debug(f" ... Executing QuerySet: Check BUFR variable generic \ dimension and type ...") - #================================ - # Check values of BUFR variables, dimension and type - #================================ + # ================================================== + # Check values of BUFR variables, dimension and type + # ================================================== logger.debug(f" temp min, max, length, dtype = {temp.min()}, {temp.max()}, {len(temp)}, {temp.dtype}") logger.debug(f" saln min, max, length, dtype = {saln.min()}, {saln.max()}, {len(saln)}, {saln.dtype}") logger.debug(f" lon min, max, length, dtype = {lon.min()}, {lon.max()}, {len(lon)}, {lon.dtype}") @@ -200,7 +203,6 @@ def bufr_to_ioda(config, logger): if path and not os.path.exists(path): os.makedirs(path) -# logger.debug(f" ... ... Create output file ...', OUTPUT_PATH) obsspace = ioda_ospace.ObsSpace(OUTPUT_PATH, mode='w', dim_dict=dims) # Create Global attributes diff --git a/ush/ioda/bufr2ioda/bufr2ioda_subpfl_glider_profiles.py b/ush/ioda/bufr2ioda/bufr2ioda_subpfl_glider_profiles.py index b68d86807..a9e8e768b 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_subpfl_glider_profiles.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_subpfl_glider_profiles.py @@ -20,13 +20,16 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): + lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) logger.debug(f"Len of Sequence Number: {len(seqNum)}") return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -56,9 +59,9 @@ def bufr_to_ioda(config, logger): bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #=========================================== + # ========================================== # Make the QuerySet for all the data we want - #=========================================== + # ========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") @@ -88,11 +91,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # ========================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data - # ============================================================== - + # ========================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: r = f.execute(q) @@ -130,9 +133,9 @@ def bufr_to_ioda(config, logger): logger.debug(f"Get sequenceNumber based on unique longitude...") seqNum = Compute_sequenceNumber(lon) - #================================================= + # ========================================= # Separate GLIDER profiles from subpfl tank - #================================================= + # ========================================= logger.debug(f"Creating the mask for GLIDER floats based on station ID numbers ...") mask_gldr = (stationID >= 68900) & (stationID <= 68999) | (stationID >= 1800000) & (stationID <= 1809999) \ @@ -167,10 +170,9 @@ def bufr_to_ioda(config, logger): logger.debug(f" ... Executing QuerySet: Check BUFR variable generic \ dimension and type ...") - #================================ + # ================================================== # Check values of BUFR variables, dimension and type - #================================ - + # ================================================== logger.debug(f" temp min, max, length, dtype = {temp.min()}, {temp.max()}, {len(temp)}, {temp.dtype}") logger.debug(f" saln min, max, length, dtype = {saln.min()}, {saln.max()}, {len(saln)}, {saln.dtype}") logger.debug(f" lon min, max, length, dtype = {lon.min()}, {lon.max()}, {len(lon)}, {lon.dtype}") diff --git a/ush/ioda/bufr2ioda/bufr2ioda_tesac_mammals_profiles.py b/ush/ioda/bufr2ioda/bufr2ioda_tesac_mammals_profiles.py index 1b824e968..c714a5fbe 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_tesac_mammals_profiles.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_tesac_mammals_profiles.py @@ -20,13 +20,16 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): + lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) logger.debug(f"Len of Sequence Number: {len(seqNum)}") return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -56,9 +59,9 @@ def bufr_to_ioda(config, logger): bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #=========================================== + # ========================================== # Make the QuerySet for all the data we want - #=========================================== + # ========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") @@ -88,11 +91,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # ========================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data - # ============================================================== - + # ========================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: r = f.execute(q) @@ -128,9 +131,9 @@ def bufr_to_ioda(config, logger): logger.debug(f"Get sequenceNumber based on unique longitude...") seqNum = Compute_sequenceNumber(lon) - #================================================= + # ======================================= # Separate marine mammals from TESAC tank - #================================================= + # ======================================= logger.debug(f"Creating the mask for marine mammals from TESAC floats based on station ID ...") alpha_mask = [item.isalpha() for item in stationID] @@ -160,10 +163,9 @@ def bufr_to_ioda(config, logger): logger.debug(f" ... Executing QuerySet: Check BUFR variable generic \ dimension and type ...") -# #================================ -# # Check values of BUFR variables, dimension and type -# #================================ - + # ================================================== + # Check values of BUFR variables, dimension and type + # ================================================== logger.debug(f" temp min, max, length, dtype = {temp.min()}, {temp.max()}, {len(temp)}, {temp.dtype}") logger.debug(f" saln min, max, length, dtype = {saln.min()}, {saln.max()}, {len(saln)}, {saln.dtype}") logger.debug(f" lon min, max, length, dtype = {lon.min()}, {lon.max()}, {len(lon)}, {lon.dtype}") diff --git a/ush/ioda/bufr2ioda/bufr2ioda_tesac_profiles.py b/ush/ioda/bufr2ioda/bufr2ioda_tesac_profiles.py index febda281a..4755edf90 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_tesac_profiles.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_tesac_profiles.py @@ -20,13 +20,16 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): + lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) logger.debug(f"Len of Sequence Number: {len(seqNum)}") return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -56,9 +59,9 @@ def bufr_to_ioda(config, logger): bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #=========================================== + # ========================================== # Make the QuerySet for all the data we want - #=========================================== + # ========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") @@ -88,11 +91,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # ========================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data - # ============================================================== - + # ========================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: r = f.execute(q) @@ -128,10 +131,9 @@ def bufr_to_ioda(config, logger): logger.debug(f"Get sequenceNumber based on unique longitude...") seqNum = Compute_sequenceNumber(lon) - - #================================================= + # ================================== # Separate TESAC profiles tesac tank - #================================================= + # ================================== logger.debug(f"Creating the mask for TESAC floats based on station ID ...") digit_mask = [item.isdigit() for item in stationID] @@ -162,10 +164,9 @@ def bufr_to_ioda(config, logger): logger.debug(f" ... Executing QuerySet: Check BUFR variable generic \ dimension and type ...") - #================================ + # ================================================== # Check values of BUFR variables, dimension and type - #================================ - + # ================================================== logger.debug(f" temp min, max, length, dtype = {temp.min()}, {temp.max()}, {len(temp)}, {temp.dtype}") logger.debug(f" saln min, max, length, dtype = {saln.min()}, {saln.max()}, {len(saln)}, {saln.dtype}") logger.debug(f" lon min, max, length, dtype = {lon.min()}, {lon.max()}, {len(lon)}, {lon.dtype}") diff --git a/ush/ioda/bufr2ioda/bufr2ioda_trackob_surface.py b/ush/ioda/bufr2ioda/bufr2ioda_trackob_surface.py index 99281c180..5d4834c59 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_trackob_surface.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_trackob_surface.py @@ -20,13 +20,16 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): + lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) logger.debug(f"Len of Sequence Number: {len(seqNum)}") return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -56,9 +59,9 @@ def bufr_to_ioda(config, logger): bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #=========================================== + # ========================================== # Make the QuerySet for all the data we want - #=========================================== + # ========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") @@ -87,11 +90,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # ========================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data - # ============================================================== - + # ========================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: r = f.execute(q) @@ -135,10 +138,10 @@ def bufr_to_ioda(config, logger): logger.debug(f" ... Executing QuerySet: Check BUFR variable generic \ dimension and type ...") - #================================ + + # ================================================== # Check values of BUFR variables, dimension and type - #================================ - + # ================================================== logger.debug(f" temp min, max, length, dtype = {temp.min()}, {temp.max()}, {len(temp)}, {temp.dtype}") logger.debug(f" saln min, max, length, dtype = {saln.min()}, {saln.max()}, {len(saln)}, {saln.dtype}") logger.debug(f" lon min, max, length, dtype = {lon.min()}, {lon.max()}, {len(lon)}, {lon.dtype}") diff --git a/ush/ioda/bufr2ioda/bufr2ioda_xbtctd_profiles.py b/ush/ioda/bufr2ioda/bufr2ioda_xbtctd_profiles.py index 9f319b008..a8e154899 100755 --- a/ush/ioda/bufr2ioda/bufr2ioda_xbtctd_profiles.py +++ b/ush/ioda/bufr2ioda/bufr2ioda_xbtctd_profiles.py @@ -20,13 +20,16 @@ from pyioda import ioda_obs_space as ioda_ospace from wxflow import Logger + def Compute_sequenceNumber(lon): + lon_u, seqNum = np.unique(lon, return_inverse=True) seqNum = seqNum.astype(np.int64) logger.debug(f"Len of Sequence Number: {len(seqNum)}") return seqNum + def bufr_to_ioda(config, logger): subsets = config["subsets"] @@ -56,9 +59,9 @@ def bufr_to_ioda(config, logger): bufrfile) logger.debug(f"{bufrfile}, {DATA_PATH}") - #=========================================== + # ========================================== # Make the QuerySet for all the data we want - #=========================================== + # ========================================== start_time = time.time() logger.debug(f"Making QuerySet ...") @@ -88,11 +91,11 @@ def bufr_to_ioda(config, logger): running_time = end_time - start_time logger.debug(f"Running time for making QuerySet: {running_time} seconds") - #=============================================================== + # ========================================================== # Open the BUFR file and execute the QuerySet # Use the ResultSet returned to get numpy arrays of the data - # ============================================================== - + # ========================================================== + start_time = time.time() logger.debug(f"Executing QuerySet to get ResultSet ...") with bufr.File(DATA_PATH) as f: r = f.execute(q) @@ -142,10 +145,9 @@ def bufr_to_ioda(config, logger): logger.debug(f" ... Executing QuerySet: Check BUFR variable generic \ dimension and type ...") - #================================ + # ================================================== # Check values of BUFR variables, dimension and type - #================================ - + #=================================================== logger.debug(f" temp min, max, length, dtype = {temp.min()}, {temp.max()}, {len(temp)}, {temp.dtype}") logger.debug(f" saln min, max, length, dtype = {saln.min()}, {saln.max()}, {len(saln)}, {saln.dtype}") logger.debug(f" lon min, max, length, dtype = {lon.min()}, {lon.max()}, {len(lon)}, {lon.dtype}")