Closed msbentley closed 3 months ago
We don't prefer attached labels by default because there are many data files that have attached PVL headers that aren't their "real" labels, but rather ancillary metadata or legacy labels etc., and it is more common for a detached label to be the right pick. The diversity of file naming conventions means that pdr
's automatic label file/data file association is not guaranteed to work 100% of the time.
Fortunately, there are a couple of easy mechanisms for cases like this:
pdr.fastread(data_fn)
. label_fn
argument to pdr.read()
-- in this case pdr.read(data_fn, label_fn=data_fn)
. This is also useful for cases in which a data file's filename stem does not match the filename stem of its detached label, or the label file is elsewhere on the filesystem, or there is a detached PDS4 label but you want to specify use of the detached PDS3 label, etc.Note that pdr.fastread(data_fn, **kwargs)
is just an alias for pdr.read(data_fn, label_fn=data_fn, skip_existence_check=True, **kwargs)
. In addition to your use case, it is helpful if a file has attached and detached labels that are both valid, but in different formats, and you want PDR to interpret it using its attached label. This includes FITS files; it causes PDR to interpret them using only their FITS headers. Finally, it improves performance when you are running a program that reads a large number of products, particularly on a slow filesystem (hence the name).
Great, many thanks @m-stclair we'll go ahead using those hints!
Mars Express HRSC images (unfortunately) comes with two versions in the data directory:
.IMG
(PDS3 image, attached label).LBL
+.JP2
(JPG2000, detached label)They share the same name, so that we have in one folder
see for example: http://archives.esac.esa.int/psa/ftp/MARS-EXPRESS/HRSC/MEX-M-HRSC-5-REFDR-MAPPROJECTED-V3.0/DATA/J592/
Currently if you point pdr to the
.IMG
file, it seems to pick up the.LBL
with the same filename before checking for an attached label, so explitly trying to open e.g.HJ592_0000_S23.IMG
actually opensHJ592_0000_S23.LBL
.I understand the situation here is a bit messy ;-) but it would be great if a future version could check first for the attached label, or similar?