import misc_functions as misc import radar_functions as rf import custom_vars as cv import pydda_functions as pdf # - Reading data radar_1 = pdf.read_uf(cv.filenames_uf[0]) # SR radar_2 = pdf.read_uf(cv.filenames_uf[1]) # FCTH radar_3 = pdf.read_uf(cv.filenames_uf[2]) # XPOL # - Gridding based on radar_2 (FCTH) print('-- Gridding radars --') grid_1 = rf.grid_radar(radar_1, fields=['DT', 'VT'], for_multidop=False, origin=(radar_2.latitude['data'][0], radar_2.longitude['data'][0]), xlim=cv.grid_xlim, ylim=cv.grid_ylim, grid_shape=cv.grid_shape) grid_2 = rf.grid_radar(radar_2, fields=['DT', 'VT'], for_multidop=False, origin=(radar_2.latitude['data'][0], radar_2.longitude['data'][0]), xlim=cv.grid_xlim, ylim=cv.grid_ylim, grid_shape=cv.grid_shape) grid_3 = rf.grid_radar(radar_3, fields=['DT', 'VT'], for_multidop=False, origin=(radar_2.latitude['data'][0],
@author: Camila Lopes ([email protected]) """ import radar_functions as rf import custom_vars as cv import custom_cbars radar = rf.read_radar(cv.filename) # radar = pyart.io.read_uf(cv.filename) radar = rf.calculate_radar_hid(radar, cv.sounding_name, "S") grid = rf.grid_radar(radar, fields=[ 'corrected_reflectivity', 'FH', 'MW', 'MI', 'cross_correlation_ratio', 'differential_reflectivity', 'specific_differential_phase' ], origin=(radar.latitude['data'][0], radar.longitude['data'][0]), xlim=cv.grid_xlim, ylim=cv.grid_ylim, grid_shape=cv.grid_shape) grid.fields['specific_differential_phase']['units'] = r'$\degree\ km^{-1}$' grid.fields['differential_reflectivity']['units'] = 'dB' if cv.pt_br: grid.fields['cross_correlation_ratio']['units'] = 'adimensional' grid.fields['corrected_reflectivity']['standard_name'] = ( "Refletividade Corrigida") grid.fields['FH']['standard_name'] = ("IDs de Hidrometeoros") grid.fields['MW']['standard_name'] = ("Massa de Água Líquida") grid.fields['MI']['standard_name'] = ("Massa de Gelo") grid.fields['cross_correlation_ratio']['standard_name'] = (
): """ """ # Reading merged radar + converting to xarray grid = misc.open_object(filepath_m) xgrid = grid.to_xarray().squeeze() del grid # Reading radar + gridding + calculating mass + converting to xarray radar = rf.read_radar(filepath_r) radar = rf.calculate_radar_hid(radar, sounding) gradar = rf.grid_radar( radar, xlim=cv.grid_xlim, ylim=cv.grid_ylim, fields=["MI"], grid_shape=cv.grid_shape, ) xgradar = gradar.to_xarray().squeeze() del radar, gradar # Merging files xgrid = xgrid.assign({"MI": xgradar.MI}) xgrid = xgrid.swap_dims({"x": "lon", "y": "lat"}) del xgradar # Selecting: # - Area of interest # - Z >= 40 dBZ xgrid = xgrid.where((xgrid.lat > ylim_aoi[0])
return im def open_select_im( filepath_r, xlim_aoi, ylim_aoi, case, zero_height=4, forty_height=6, ): """ """ # Reading radar + gridding + calculating mass + converting to xarray radar = rf.read_radar(filepath_r) radar = rf.calculate_radar_mw_mi(radar) gradar = rf.grid_radar( radar, xlim=(-200000.0, 10000.0), ylim=(-10000.0, 200000.0), fields=["corrected_reflectivity", "MI"], grid_shape=(20, 211, 211), ) xgrid = gradar.to_xarray().squeeze() del radar, gradar # Selecting: # - Area of interest # - Z >= 40 dBZ xgrid = xgrid.where( (xgrid.lat > ylim_aoi[0]) & (xgrid.lat < ylim_aoi[1]) & (xgrid.lon > xlim_aoi[0]) & (xgrid.lon < xlim_aoi[1]) & (xgrid.corrected_reflectivity >= 35)