PDS Utils
pds
sub-package.
IndexLabel
IndexLabel (labelpath:Union[str,pathlib.Path])
Support working with label files of PDS Index tables.
Type | Details | |
---|---|---|
labelpath | Union | Path to the labelfile for a PDS Indexfile. The actual table should reside in the same folder to be automatically parsed when calling the read_index_data method. |
index_to_df
index_to_df (indexpath:Union[str,pathlib.Path], label:__main__.IndexLabel, convert_times=True)
*The main reader function for PDS Indexfiles.
In conjunction with an IndexLabel object that figures out the column widths, this reader should work for all PDS TAB files.*
Type | Default | Details | |
---|---|---|---|
indexpath | Union | Path to the index TAB file | |
label | IndexLabel | Label object that has both the column names and the columns widths as attributes ‘colnames’ and ‘colspecs’ |
|
convert_times | bool | True | Switch to control if to convert columns with “TIME” in name (unless COUNT is as well in name) to datetime |
PVLColumn
PVLColumn (pvlobj)
Manages just one of the columns in a table that is described via PVL.
decode_line
decode_line (linedata:str, labelpath:Union[str,pathlib.Path])
Decode one line of tabbed data with the appropriate label file.
Type | Details | |
---|---|---|
linedata | str | One line of a .tab data file |
labelpath | Union | Path to the appropriate label that describes the data. |
find_mixed_type_cols
find_mixed_type_cols (df:pandas.core.frame.DataFrame, fix:bool=True)
*For a given dataframe, find the columns that are of mixed type.
Tool to help with the performance warning when trying to save a pandas DataFrame as a HDF. When a column changes datatype somewhere, pickling occurs, slowing down the reading process of the HDF file.*
Type | Default | Details | |
---|---|---|---|
df | DataFrame | Dataframe to be searched for mixed data-types | |
fix | bool | True | Switch to control if NaN values in these problem columns should be replaced by the string ‘UNKNOWN’ |
Returns | list | List of column names that have data type changes within themselves. |
fix_hirise_edrcumindex
fix_hirise_edrcumindex (infname:Union[str,pathlib.Path], outfname:Union[str,pathlib.Path])
*Fix HiRISE EDRCUMINDEX.
The HiRISE EDRCUMINDEX has some broken lines where the SCAN_EXPOSURE_DURATION is of format F10.4 instead of the defined F9.4. This function simply replaces those incidences with one less decimal fraction, so 20000.0000 becomes 20000.000.*
Type | Details | |
---|---|---|
infname | Union | Path to broken EDRCUMINDEX.TAB |
outfname | Union | Path where to store the fixed TAB file |