Skip to content

While running the SPHY hydrological model in Python, I encountered some issues with the format of the meteorological data. #16

Description

@685009

Recently, while running the SPHY hydrological model in Python, I encountered some issues with the format of the meteorological data. My study period is relatively long. When using the meteorological data for the first time, the format was similar to prec0000.001 and prec0007.671. However, the following error occurred:

.24-9-2002  t = 998
Table rows: 1618, Array size: 1618
.25-9-2002  t = 999
Table rows: 1618, Array size: 1618
.26-9-2002  t = 1000
Table rows: 1618, Array size: 1618
.27-9-2002  t = 1001
Table rows: 1618, Array size: 1618
.28-9-2002  t = 1002
Table rows: 1618, Array size: 1618
.29-9-2002  t = 1003
Table rows: 1618, Array size: 1618
.30-9-2002  t = 1004
Table rows: 1618, Array size: 1618
Traceback (most recent call last):
  File "E:\test_tth\SPHY-master\sphy.py", line 1279, in <module>
    RunSPHY.run()
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\dynamicFramework.py", line 65, in run
    self._runDynamic()
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\frameworkBase.py", line 371, in _runDynamic
    self._userModel().dynamic()
  File "E:\test_tth\SPHY-master\sphy.py", line 874, in dynamic
    self.reporting.reporting(self, pcr, "TotGlacRF", self.GlacR)
  File "E:\test_tth\SPHY-master\utilities\reporting.py", line 113, in reporting
    setattr(self, tot + '_'+outops, REPM(self, pcr, eval('self.'+tot+'_'+outops), var, eval('self.'+tot+'_fname'), outops, TSS, MAP, AVG))
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\test_tth\SPHY-master\utilities\reporting.py", line 47, in REPM
    self.report(tot, self.outpath + fname + 'M')
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\dynamicPCRasterBase.py", line 64, in report
    self._reportNew(variable, name)
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\frameworkBase.py", line 37, in __call__
    result = attr(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\frameworkBase.py", line 525, in _reportNew
    newName = generateNameT(name, self._userModel().currentTimeStep())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\frameworkBase.py", line 97, in generateNameT
    assert space >= 0
           ^^^^^^^^^^
AssertionError

After modifying the meteorological data format to prec0000.0001 and prec0000.7671, the following error occurred:

.1-1-2000  t = 1
Traceback (most recent call last):
  File "E:\test_tth\SPHY-master\sphy.py", line 1279, in <module>
    RunSPHY.run()
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\dynamicFramework.py", line 65, in run
    self._runDynamic()
  File "D:\miniforge3\Lib\site-packages\pcraster\framework\frameworkBase.py", line 371, in _runDynamic
    self._userModel().dynamic()
  File "E:\test_tth\SPHY-master\sphy.py", line 764, in dynamic
    pcr.readmap(pcrm.generateNameT(self.Prec, self.counter))
RuntimeError: Raster E:/test_tth/input/forcing/prec\prec0000.001: can not be opened. Note: only the PCRaster file format is supported as input argument.

What should I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions