def makeBulkLCS(itnum, nrt): if itnum < 1993001: print('Error: LCS is only available after 1993.') return df_bw_adt = matToDF(nrt=nrt, forward=False, sla=False, itnum=itnum) df_fw_adt = matToDF(nrt=nrt, forward=True, sla=False, itnum=itnum) df_bw_sla = matToDF(nrt=nrt, forward=False, sla=True, itnum=itnum) df_fw_sla = matToDF(nrt=nrt, forward=True, sla=True, itnum=itnum) prefix = 'LCS_' df = pd.DataFrame() df['lat'] = df_bw_adt['lat'] df['lon'] = df_bw_adt['lon'] df['time'] = df_bw_adt['time'] df['ftle_bw_adt'] = df_bw_adt['ftle'] df['disp_bw_adt'] = df_bw_adt['disp'] df['ftle_fw_adt'] = df_fw_adt['ftle'] df['disp_fw_adt'] = df_fw_adt['disp'] df['ftle_bw_sla'] = df_bw_sla['ftle'] df['disp_bw_sla'] = df_bw_sla['disp'] df['ftle_fw_sla'] = df_fw_sla['ftle'] df['disp_fw_sla'] = df_fw_sla['disp'] df['ID'] = None exportBase = cfgv.opedia_proj + 'db/dbInsert/export/' export_path = '%s%s%d.csv' % (exportBase, prefix, itnum) df.to_csv(export_path, index=False) ip.mapTo180180(export_path, 'lon') # only use if necessary ip.sortByLatLon(df, export_path, 'lon', 'lat') return export_path
def makeBulkCHL(itnum, nrt): if itnum < 1998001: print('Error: CHL data is only availabe after 1998.') return if nrt: path = cfgv.nrt_chl_raw + cfgv.nrt_chl_prefix + '%7.7d.nc' % itnum else: path = cfgv.rep_chl_raw + cfgv.rep_chl_prefix + '%7.7d.nc' % itnum prefix = 'chl_oi_' df = nc.ncToDF(path) df = ip.removeColumn(['CHL_error'], df) #df = ip.removeMissings(['CHL'], df) # remove land df['ID'] = None exportBase = cfgv.opedia_proj + 'db/dbInsert/export/' export_path = '%s%s%d.csv' % (exportBase, prefix, itnum) df.to_csv(export_path) ## seems like the code below is only needed for the NRT product ## longitude range in NRT products: 0 - 360 if nrt: ip.mapTo180180(export_path, 'lon') # only use if necessary ###df = downsampleCHL(export_path) ip.sortByLatLon(df, export_path, 'lon', 'lat') return export_path
def makeFlombaum(rawFilePath, rawFileName, tableName): path = rawFilePath + rawFileName prefix = tableName exportBase = cfgv.opedia_proj + 'db/dbInsert/export/' export_path = '%s%s.csv' % (exportBase, prefix) df = pd.read_excel(path, sep=',', sheet_name='data') df = ip.removeMissings(['time', 'lat', 'lon', 'depth'], df) df = ip.NaNtoNone(df) df = ip.colDatatypes(df) df = ip.convertYYYYMMDD(df) df = ip.addIDcol(df) df = ip.removeDuplicates(df) df['lon'] = df['lon'].abs() df.to_csv(export_path, index=False) ip.mapTo180180(export_path, 'lon') ip.sortByTimeLatLonDepth(df, export_path, 'time', 'lat', 'lon', 'depth') print('export path: ', export_path) return export_path
def makeBulkALT(itnum, nrt): if itnum < 1993001: print('Error: Altimetry data is only available after 1993.') return if nrt: path = cfgv.nrt_alt_raw + cfgv.nrt_alt_prefix + '%7.7d.nc' % itnum else: path = cfgv.rep_alt_raw + cfgv.rep_alt_prefix + '%7.7d.nc' % itnum prefix = 'alt_' df = nc.ncToDF(path) df = ip.removeColumn(['err'], df) #df = ip.removeMissings(['sla'], df) # remove land df['ID'] = None exportBase = cfgv.opedia_proj + 'db/dbInsert/export/' export_path = '%s%s%d.csv' % (exportBase, prefix, itnum) df.to_csv(export_path) ip.mapTo180180(export_path, 'longitude') # only use if necessary ip.sortByLatLon(df, export_path, 'longitude', 'latitude') return export_path
def makeBulkVort(itnum, nrt): if itnum < 1993001: print('Error: Relative Vorticity is only available after 1993.') return if nrt: path = cfgv.nrt_vort_sla_raw + cfgv.nrt_vort_sla_prefix + '%10.10d.mat' % itnum else: path = cfgv.rep_vort_sla_raw + cfgv.rep_vort_sla_prefix + '%10.10d.mat' % itnum prefix = 'vort_sla_' df = matToDF(path, itnum) #df = ip.removeColumn(['err'], df) #df = ip.removeMissings(['vort'], df) # remove land df['ID'] = None exportBase = cfgv.opedia_proj + 'db/dbInsert/export/' export_path = '%s%s%d.csv' % (exportBase, prefix, itnum) df.to_csv(export_path, index=False) ip.mapTo180180(export_path, 'lon') # only use if necessary ip.sortByLatLon(df, export_path, 'lon', 'lat') return export_path
def makeBulkALT(itnum, nrt): if itnum < 1993001: print('Error: Altimetry data is only available after 1993.') return if nrt: path = cfgv.nrt_alt_raw + cfgv.nrt_alt_prefix + '%7.7d.nc' % itnum else: path = cfgv.rep_alt_raw + cfgv.rep_alt_prefix + '%7.7d.nc' % itnum prefix = 'alt_' df = nc.ncToDF(path) df = ip.removeColumn(['err'], df) #df = ip.removeMissings(['sla'], df) # remove land ## arrange the columns: making sure that the columns are arranged in the correct (consistent with the undelying table) order df = ip.arrangeColumns(['vgosa', 'vgos', 'sla', 'adt', 'ugosa', 'ugos'], df) # df['ID'] = None exportBase = cfgv.opedia_proj + 'db/dbInsert/export/' export_path = '%s%s%d.csv' % (exportBase, prefix, itnum) df.to_csv(export_path) ip.mapTo180180(export_path, 'longitude') # only use if necessary ip.sortByLatLon(df, export_path, 'longitude', 'latitude') return export_path