planetarypy / pvl

Python implementation of PVL (Parameter Value Language)
BSD 3-Clause "New" or "Revised" License
19 stars 19 forks source link

Attached labels not supported or parsing issue? #33

Closed michaelaye closed 4 years ago

michaelaye commented 6 years ago

I get an error when trying to get to the attached labels (a supported PDS3 way of combining the label with the data) of the data from the OSIRIS camera of the ROSETTA mission.

However, the error sounds more like a parsing issue itself?

Using this file:

https://pdssbn.astro.umd.edu/holdings/ro-c-osinac-3-prl-67pchuryumov-m06-v2.0/data/2014_09/n20140901t004253571id30f22.img

import pvl

fname = "./n20140901t004253571id30f22.img"
pvl.load(fname)

ParseError: Invalid \escape: b'R': line 152 column 41 (char 6795)

Running pvl version 0.2.0 on Python 3.6 via conda-forge.

wtolson commented 6 years ago

Looks like there are some file paths with with backslashes. Do you know if I'm interpreting that right @michaelaye @godber? Not sure if this is an error in their generator or if the expected behavior is to treat invalid escape sequences as a literal.

Relevant section of the label:

SPICE_FILE_NAME               = ("sclk\ROS_160929_STEP.TSC", 
    "lsk\NAIF0011.TLS", "fk\ROS_V26.TF", "ik\ROS_OSIRIS_V13.TI", 
    "spk\RORB_DV_145_01_______00216.BSP", "ck\RATT_DV_145_01_01____00216.BC", 
    "pck\PCK00010.TPC", "spk\DE405.BSP", "pck\ROS_CGS_RSOC_V03.TPC", 
    "fk\ROS_CHURYUMOV_V01.TF", "spk\CORB_DV_145_01_______00216.BSP", 
    "ck\CATT_DV_145_01_______00216.BC")
godber commented 6 years ago

It looks that way to me. Those look like windows relative paths to spice files inside "". Does the PVL spec forbid this?

michaelaye commented 6 years ago

Hm, good question. If type(SPICE_FILE_NAME) is a STRING, then it's allowed, but need's to be escaped (\\), if the type is a PATH, then I don't think it is allowed. Here's the relevant section in the PDS3 standard

The PDS standard for path names is based on Level 2 of the ISO 9660 international standard. A pathname may consist of up to eight directory levels. Each directory name is limited to 31 characters; the forward-slash character (“/”) is used as the separator in path names. The total length of the directory path and file name must not exceed 255 characters. Path names typically appear on PDS volumes as data in index tables for locating specific files on an archive volume. They may also appear as values in a limited number of keywords (e.g., FILE_SPECIFICATION_NAME, PATH_NAME, and LOGICAL_VOLUME_PATH_NAME). The following are examples of valid values for the keywords listed above: TG15NXXX/TG15N1XX/TG15N12X/ identifies the location of the directory TG15N12X at the third level below the top level of an archive volume. DOCUMENT/ identifies a DOCUMENT directory within the root directory. Note: The leading slash is omitted because these are relative paths. The trailing slash is included so that concatenation of PATH_NAME and FILE_NAME will yield the full file specification. See the File Specification and Naming chapter of this document for more information. Previous PDS standards allowed the use of the DEC VMS syntax for path names. While PDS support for this format continues to exist, it is recommended that all future volumes use the UNIX syntax instead.

michaelaye commented 6 years ago

I don't think that ISO 9660 (the good old CDROM standard) forbade backslashes specifically, did it? I mean, the CDROMs were working fine with Windows, right?

rbeyer commented 4 years ago

This has been addressed by #38 and can be closed.

michaelaye commented 4 years ago

is there a test that specifically confirms that backslashes in file paths are correctly parsed now?

rbeyer commented 4 years ago

Yes, there is now a tests/data/pds3/backslashes.lbl in the test file set, and a test_sequence_backslashes() test in tests/test_pvl.py