Closed alemran042 closed 3 years ago
The walrus operator didn't exist in Python 3.7. Try it with Python 3.8+. I suggest using a conda environment to do this.
@alemran042 Just curious if this ended up working for you.
@cmillion Unfortunately, it didn't end up working. I can import pdr but had another issue in reading the image. Here the code and error it shows. Also, copied the link of data (https://pds-smallbodies.astro.umd.edu/holdings/nh-p_psa-leisa_mvic-5-comp-v1.0/data/color/)
############## code ######## In [1]: import pdr
In [2]: data = pdr.read_image('mvic_0299178092_0x536_sci_pl.img')
AttributeError Traceback (most recent call last)
@cmillion Update I was able to read the image using a different approach. Here is how it ended up working:
In [1]: import pdr In [2]: img = pdr.rasterio.open('mvic_0299178092_0x536_sci_pl.lbl') In [3]: data = img.read() In [4]: data.shape Out[4]: (4, 4754, 4754)
Thank you, Emran
Thanks. What made you decide to use pdr.read_image
instead of pdr.read
?
What happens if you try data = pdr.read('mvic_0299178092_0x536_sci_pl.img')
?
Thanks.
@cmillion I think pdr has no module as read( ), at least in the version I am using. If I try data = pdr.read('mvic_0299178092_0x536_sci_pl.img'), it shows following error:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' AttributeError Traceback (most recent call last)
Ok. That shouldn't happen. Weird. Thank you.
Oh. When import pdr
are you importing pdr.py
from, like, within the git directory named pdr
? Or are you importing the library pdr
(like from within the directory that contains the directory named pdr
)?
Or did you pip install pdr
with something like pip install git+https://github.com/MillionConcepts/pdr.git
?
@cmillion yes, I install pdr with pip install git+https://github.com/MillionConcepts/pdr.git Then, I import the library as "import pdr"
@cmillion ah, I got it. Unconsciously, I had the pdr.py file in the working directory. After deleting the pdr.py file, now pdr.read( ) works. Apology for the confusion. Now, it works as it is supposed to be. Thank you, Emran
Great! Glad it's working right. Please let me know if you encounter other issues. Thank you.
I have installed the pdr and "pip list" shows pdr is installed. However, when import pdr, its shows the following error:
import pdr
Traceback (most recent call last): File "", line 1, in
File "/home/emran/anaconda3/lib/python3.7/site-packages/pdr/init.py", line 3, in
from pdr.pdr import Data
File "/home/emran/anaconda3/lib/python3.7/site-packages/pdr/pdr.py", line 264
if Path(fmtpath:= self.filename.replace(
^
SyntaxError: invalid syntax