def generate_drizzle(categorize_file: str, output_file: str, keep_uuid: bool = False, uuid: Union[str, None] = None) -> str: """Generates Cloudnet drizzle product. This function calculates different drizzle properties from cloud radar and lidar measurements. The results are written in a netCDF file. Args: categorize_file (str): Categorize file name. output_file (str): Output file name. keep_uuid (bool, optional): If True, keeps the UUID of the old file, if that exists. Default is False when new UUID is generated. uuid (str, optional): Set specific UUID for the file. Returns: str: UUID of the generated file. Examples: >>> from cloudnetpy.products import generate_drizzle >>> generate_drizzle('categorize.nc', 'drizzle.nc') References: O’Connor, E.J., R.J. Hogan, and A.J. Illingworth, 2005: Retrieving Stratocumulus Drizzle Parameters Using Doppler Radar and Lidar. J. Appl. Meteor., 44, 14–27, https://doi.org/10.1175/JAM-2181.1 """ drizzle_source = DrizzleSource(categorize_file) drizzle_class = DrizzleClassification(categorize_file) spectral_width = SpectralWidth(categorize_file) drizzle_solver = DrizzleSolver(drizzle_source, drizzle_class, spectral_width) derived_products = DrizzleProducts(drizzle_source, drizzle_solver) errors = get_drizzle_error(drizzle_source, drizzle_solver) retrieval_status = RetrievalStatus(drizzle_class) results = { **drizzle_solver.params, **derived_products.derived_products, **errors } results = _screen_rain(results, drizzle_class) results['drizzle_retrieval_status'] = retrieval_status.retrieval_status _append_data(drizzle_source, results) date = drizzle_source.get_date() attributes = output.add_time_attribute(DRIZZLE_ATTRIBUTES, date) output.update_attributes(drizzle_source.data, attributes) uuid = output.save_product_file('drizzle', drizzle_source, output_file, keep_uuid, uuid) drizzle_source.close() return uuid
def generate_drizzle(categorize_file, output_file): """Generates Cloudnet drizzle product. This function calculates different drizzle properties from cloud radar and lidar measurements. The results are written in a netCDF file. Args: categorize_file (str): Categorize file name. output_file (str): Output file name. Examples: >>> from cloudnetpy.products import generate_drizzle >>> generate_drizzle('categorize.nc', 'drizzle.nc') References: O’Connor, E.J., R.J. Hogan, and A.J. Illingworth, 2005: Retrieving Stratocumulus Drizzle Parameters Using Doppler Radar and Lidar. J. Appl. Meteor., 44, 14–27, https://doi.org/10.1175/JAM-2181.1 """ drizzle_data = DrizzleSource(categorize_file) drizzle_class = DrizzleClassification(categorize_file) spectral_width = CorrectSpectralWidth(categorize_file) drizzle_parameters = DrizzleSolving(drizzle_data, drizzle_class, spectral_width) derived_products = CalculateProducts(drizzle_data, drizzle_parameters) errors = get_drizzle_error(drizzle_data, drizzle_parameters) retrieval_status = RetrievalStatus(drizzle_class) results = { **drizzle_parameters.params, **derived_products.derived_products, **errors } results = _screen_rain(results, drizzle_class) results['drizzle_retrieval_status'] = retrieval_status.retrieval_status _append_data(drizzle_data, results) output.update_attributes(drizzle_data.data, DRIZZLE_ATTRIBUTES) output.save_product_file('drizzle', drizzle_data, output_file) drizzle_data.close()
def result(class_objects, params_objects): d_source, d_class, s_width = class_objects errors = get_drizzle_error(d_source, params_objects) cal_products = drizzle.DrizzleProducts(d_source, params_objects) return {**params_objects.params, **cal_products.derived_products, **errors}