PESTools / pestools

PESTools
12 stars 10 forks source link

Empty assertion error #55

Closed pkpatkel closed 9 years ago

pkpatkel commented 9 years ago

When I try to import a .res file, I get the following error:

AssertionError Traceback (most recent call last)

in () 5 6 get_ipython().magic(u'matplotlib inline') ----> 7 res = pestools.Res('lrg_pest_20150917.res', obs_info_file='obs_info.csv') 8 9 # Set options to allow for better display in the iPython notebook C:\Anaconda\lib\site-packages\pesttools-0.0.1-py2.7.egg\pestools\res.pyc in **init**(self, res_file, obs_info_file, name_col, x_col, y_col, type_col, basename_col, datetime_col, group_cols, obs_info_kwds, **kwds) 70 self.obsinfo = self._Pest.obsinfo 71 ---> 72 self.obs_groups = self._Pest.obs_groups 73 self._obstypes = pd.DataFrame({'Type': ['observation'] \* len(self.obs_groups)}, index=self.obs_groups) 74 C:\Anaconda\lib\site-packages\pesttools-0.0.1-py2.7.egg\pestools\pest.pyc in obs_groups(self) 149 List of observation groups 150 ''' --> 151 obs_groups = self.pst.obs_groups 152 return obs_groups 153 C:\Anaconda\lib\site-packages\pesttools-0.0.1-py2.7.egg\pestools\pest.pyc in pst(self) 88 Pst Class 89 ''' ---> 90 pst = Pst(self.pstfile) 91 return pst 92 C:\Anaconda\lib\site-packages\pesttools-0.0.1-py2.7.egg\pestools\pst_handler.pyc in **init**(self, filename, load, resfile) 53 54 if load: ---> 55 assert os.path.exists(filename) 56 self.load(filename) 57 AssertionError:
aleaf commented 9 years ago

It looks like this may be due to the path to the .res file being incorrect. I can reproduce the error by calling Res() with a .res filename that doesn't exist. Did you check the path?

pkpatkel commented 9 years ago

When I run: os.path.exists('lrg_pest_20150917.res')

returns: True

On Wed, Sep 23, 2015 at 12:04 PM, aleaf notifications@github.com wrote:

It looks like this may be due to the path to the .res file being incorrect. I can reproduce the error by calling Res() with a .res filename that doesn't exist. Did you check the path?

— Reply to this email directly or view it on GitHub https://github.com/PESTools/pestools/issues/55#issuecomment-142682093.

echristi commented 9 years ago

Does it work if you set obs_info_file=None?

pkpatkel commented 9 years ago

No, and fwiw checking the path on the obs_info file returns True as well.

On Wed, Sep 23, 2015 at 12:08 PM, echristi notifications@github.com wrote:

Does it work if you set obs_info_file=None?

— Reply to this email directly or view it on GitHub https://github.com/PESTools/pestools/issues/55#issuecomment-142683704.

echristi commented 9 years ago

Is the pest control file (.pst) in the path and with same basename?

aleaf commented 9 years ago

It looks like that assert statement is actually checking for a pest control file (which makes sense, because it is in Jeremy's pst_handler class). The way we have it set up now, it expects a pest control file of the same basename to be collocated with the .res file.

pkpatkel commented 9 years ago

That was it! moving the .pst file to the same directory solved my .res import problem. Thank you.

On Wed, Sep 23, 2015 at 12:27 PM, aleaf notifications@github.com wrote:

It looks like that assert statement is actually checking for a pest control file (which makes sense, because it is in Jeremy's pst_handler class). The way we have it set up now, it expects a pest control file of the same basename to be collocated with the .res file.

— Reply to this email directly or view it on GitHub https://github.com/PESTools/pestools/issues/55#issuecomment-142689377.

aleaf commented 9 years ago

Good, I will add that to the instructions.