def get_pik(orbit): """Extract surface echo values (convert in linear amplitude) Arguments --------- orbit : string orbit number Keywords -------- amplitude : bool output as linear amplitude abs_calib : float calibration value """ pik = raw.read_pik(orbit) rpb = raw.read_rpb(orbit) z = np.round(pik.delay_pixel) - 1 x = pik.frame - 1 x = x.values.tolist() echo = np.zeros(np.size(x)) for i, val in enumerate(x): try: echo[i] = rpb[z[i] - 2:z[i] + 2, val].max() except: echo[i] = np.nan out = np.empty(rpb.shape[1]) out[x] = echo return out
def get_pik(orbit): """Extract surface echo values (convert in linear amplitude) Arguments --------- orbit : string orbit number Keywords -------- amplitude : bool output as linear amplitude abs_calib : float calibration value """ pik = raw.read_pik(orbit) rpb = raw.read_rpb(orbit) z = np.round(pik.delay_pixel)-1 x = pik.frame-1 x = x.values.tolist() echo = np.zeros(np.size(x)) for i, val in enumerate(x): try: echo[i] = rpb[z[i]-2:z[i]+2, val].max() except: echo[i] = np.nan out = np.empty(rpb.shape[1]) out[x] = echo return out
def get_aux(orbit): """Interpolate auxilliary values to echo sampling Arguments --------- orbit : string orbit number """ aux = raw.read_aux(orbit) rpb = raw.read_rpb(orbit) xnew = np.arange(rpb.shape[1]) x = np.linspace(0, rpb.shape[1]-1, aux.UTC.size) tck = splrep(x, aux.lon, s=0) lon = splev(xnew, tck, der=0) tck = splrep(x, aux.lat, s=0) lat = splev(xnew, tck, der=0) tck = splrep(x, aux.radius, s=0) radius = splev(xnew, tck, der=0) tck = splrep(x, aux.vtan, s=0) vtan = splev(xnew, tck, der=0) tck = splrep(x, aux.vrad, s=0) vrad = splev(xnew, tck, der=0) tck = splrep(x, aux.SZA, s=0) sza = splev(xnew, tck, der=0) tck = splrep(x, aux.pitch, s=0) pitch = splev(xnew, tck, der=0) tck = splrep(x, aux.yaw, s=0) yaw = splev(xnew, tck, der=0) tck = splrep(x, aux.roll, s=0) roll = splev(xnew, tck, der=0) tck = splrep(x, aux.Mag_field, s=0) mag = splev(xnew, tck, der=0) tck = splrep(x, aux.HGAout, s=0) HGAout = splev(xnew, tck, der=0) tck = splrep(x, aux.HGAin, s=0) HGAin = splev(xnew, tck, der=0) tck = splrep(x, aux.Sun_dist, s=0) sun_dist = splev(xnew, tck, der=0) rng = radius*1e3 - ellipsoid.lonlat2rad(lon, lat, mars.radius['val']) out = {'lat':lat, 'lon':lon, 'radius':radius, 'vtan':vtan, 'vrad':vrad, 'sza':sza, 'pitch':pitch, 'yaw':yaw, 'roll':roll, 'mag':mag, 'HGAout':HGAout, 'HGAin':HGAin, 'sun_dist':sun_dist, 'rng':rng} return pd.DataFrame(out)
def get_aux(orbit): """Interpolate auxilliary values to echo sampling Arguments --------- orbit : string orbit number """ aux = raw.read_aux(orbit) rpb = raw.read_rpb(orbit) xnew = np.arange(rpb.shape[1]) x = np.linspace(0, rpb.shape[1] - 1, aux.UTC.size) tck = splrep(x, aux.lon, s=0) lon = splev(xnew, tck, der=0) tck = splrep(x, aux.lat, s=0) lat = splev(xnew, tck, der=0) tck = splrep(x, aux.radius, s=0) radius = splev(xnew, tck, der=0) tck = splrep(x, aux.vtan, s=0) vtan = splev(xnew, tck, der=0) tck = splrep(x, aux.vrad, s=0) vrad = splev(xnew, tck, der=0) tck = splrep(x, aux.SZA, s=0) sza = splev(xnew, tck, der=0) tck = splrep(x, aux.pitch, s=0) pitch = splev(xnew, tck, der=0) tck = splrep(x, aux.yaw, s=0) yaw = splev(xnew, tck, der=0) tck = splrep(x, aux.roll, s=0) roll = splev(xnew, tck, der=0) tck = splrep(x, aux.Mag_field, s=0) mag = splev(xnew, tck, der=0) tck = splrep(x, aux.HGAout, s=0) HGAout = splev(xnew, tck, der=0) tck = splrep(x, aux.HGAin, s=0) HGAin = splev(xnew, tck, der=0) tck = splrep(x, aux.Sun_dist, s=0) sun_dist = splev(xnew, tck, der=0) rng = radius * 1e3 - ellipsoid.lonlat2rad(lon, lat, mars.radius['val']) out = { 'lat': lat, 'lon': lon, 'radius': radius, 'vtan': vtan, 'vrad': vrad, 'sza': sza, 'pitch': pitch, 'yaw': yaw, 'roll': roll, 'mag': mag, 'HGAout': HGAout, 'HGAin': HGAin, 'sun_dist': sun_dist, 'rng': rng } return pd.DataFrame(out)