UMEP-dev / UMEP

Urban Multi-scale Environmental Predictor
https://umep-docs.readthedocs.io/
62 stars 15 forks source link

SUEWS ANALYSER ERROR #372

Closed phemiobe closed 2 years ago

phemiobe commented 2 years ago

Hello, In visualising the spatial model output using the SUEWS analyser, the error pasted below comes up. the python programme is searching for a particular file which I dont have. I have 336 grid points and 336 output files. the program is searching for Suews_output2000//337_2000_SUEWS_60.txt. when my last output file is Suews_output2000//336_2000_SUEWS_60.txt. I even tried to copy and rename the sile 336 as 337; it the searches for another missing file 338...

Kindly help. I am however able to plot the time series and scatter plots of variables

2022-02-15T00:38:05 WARNING Traceback (most recent call last): File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSAnalyzer\suewsanalyzer.py", line 476, in spatial datawhole = np.genfromtxt(self.fileoutputpath + '/' + self.fileCode + gid + '' File "C:\PROGRA~1\QGIS32~1.3\apps\Python39\lib\site-packages\numpy\lib\npyio.py", line 1791, in genfromtxt fid = np.lib._datasource.open(fname, 'rt', encoding=encoding) File "C:\PROGRA~1\QGIS32~1.3\apps\Python39\lib\site-packages\numpy\lib_datasource.py", line 194, in open return ds.open(path, mode, encoding=encoding, newline=newline) File "C:\PROGRA~1\QGIS32~1.3\apps\Python39\lib\site-packages\numpy\lib_datasource.py", line 531, in open raise IOError("%s not found." % path) OSError: C:/Users/User/Desktop/LCZ_FOLDER/Suews_output2000//337_2000_SUEWS_60.txt not found

here is the section of the python script copied from (_datasource.py)

NOTE: _findfile will fail on a new file opened for writing.

    found = self._findfile(path)
    if found:
        _fname, ext = self._splitzipext(found)
        if ext == 'bz2':
            mode.replace("+", "")
        return _file_openers[ext](found, mode=mode,
                                  encoding=encoding, newline=newline)
    else:
        raise IOError("%s not found." % path)
biglimp commented 2 years ago

The ID from the vector grid is used as counter here. Make sure that you use the same grid as you used to prepare your input files. How many grids does your polygon layer consistof?

phemiobe commented 2 years ago

I have always used thesame grid as used in the input files. My polygon Layer consist of 336 grid points.

biglimp commented 2 years ago

And your ID attribute starts from 1?

phemiobe commented 2 years ago

yes, starts from 1 to 336

biglimp commented 2 years ago

Ok, can you attach the input files, output files and your vector grid in a zipped file for me to have a look at.

phemiobe commented 2 years ago

Unfortunately, I find it difficult to attach zip file here. I however rerun the model and I got this error when I tried to visualise the output

File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSAnalyzer\suews_analyzer.py", line 575, in spatial self.rasterize(str(polygonpath), str(self.plugin_dir + '/tempgrid.tif'), str(poly_field), resx, crs, extent) File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SUEWSAnalyzer\suews_analyzer.py", line 813, in rasterize layer = src_data.GetLayer() AttributeError: 'NoneType' object has no attribute 'GetLayer'

biglimp commented 2 years ago

This is progress. Now the code has come to a point where all grids have been analysed without error. I think your new error is related to a bug in the path to the vector grid. I have pushed an update so try to install the development release and see if it works. Alternatively, you can try out the SUEWS Analyser in UMEP for processing instead.