planetarypy / planetaryimage

Python PDS and Isis Cube file parser.
BSD 3-Clause "New" or "Revised" License
39 stars 20 forks source link

Add support for saving the PDS file when `dtype` is changed. #58

Open bvnayak opened 8 years ago

bvnayak commented 8 years ago

While calibrating the image, we decompand it first. During this operation, input data is of 8 bits which is then changed to 12 bits. So, our storage dtype changes to uint16 from uint8.

Now, Line 139 saves data with the dtype of the input data, there we need to check dtype for the data which is to be written.

bvnayak commented 8 years ago

a = PDS3Image.open('EDR.IMG') b = PDS3Image.open('Float_RAD.IMG')

Now, if we print a.dtype and a.data.dtype we get uint8 (>i2). Similarly b.dtype and b.data.dtype is float32 (>f4).

Now, we modify a. a.data = b.data

Now, if we print a.dtype it is uint8 (>i2) and a.data.dtype we get float32 (>f4). This suggests us that we need to save our image with a.data.dtype instead of a.dtype.