RDCEP / psims

GNU Affero General Public License v3.0
30 stars 23 forks source link

An error in pysims/translators/dssat46/jsons2dssat.py line 1330 #15

Closed sunqingmeteo closed 6 years ago

sunqingmeteo commented 6 years ago

In line 1330 if isMaskedArray(vl): vl[vl.mask] = -99 When I run psims, there is an error. vl is When I try to print 'mask', mask print 'vl.mask',vl.mask there is an error: masl [jsons2dssat.pyc] (60/59): Traceback (most recent call last): File "/mnt/e/GGCM/psims/pysims/translators/dssat/jsons2dssat.py", line 1600, in run sfileoutput = SOLFileOutput(sfile, efile, use_ptransfer = pfcn) File "/mnt/e/GGCM/psims/pysims/translators/dssat/jsons2dssat.py", line 1332, in init print 'mask', mask NameError: global name 'mask' is not defined

I guess that the 'mask' did not have an attribute? May I ask how to fix it? Thanks,

DavidKelly-Praedictus commented 6 years ago

Hello,

Thank you for the report. I suspect this particular issue may be related to differences in numpy versions. Could you please try running with numpy 1.10 and see if that resolves the issue? In the next upgrade of our software (psims 3) we will be using a newer version of numpy.

sunqingmeteo commented 6 years ago

Thanks for your response, I tried to convert numpy to 1.10, but failed..... And can not find why. Maybe have another version of numpy, but can not located where is it.

I just delete two lines in pysims/translators/dssat/jsons2dssat.py, then it works fine. if isMaskedArray(vl): vl[vl.mask] = -99 if isMaskedArray(vp): vp[vp.mask] = -99

Then I found that some variable read as '--', so I add one line in 24, after 'elif vtype == 'r':' if vstr == '--': vstr = '-99'

The result are as follows: 0015/0015, StageInputsSharedFS, run_tile, 0.720964, True 0057/0057, SimpleChecker, run, 2.286488, True 0057/0057, StageInputsSharedFS, run, 0.059751, True 0057/0057, SoilTileTranslator, run, 1.746460, True 0057/0057, TileTranslator, run, 5.521260, True 0057/0057, Noop, run, 0.000023, True 0057/0057, Camp2Json, run, 0.202409, True 0057/0057, Noop, run, 0.000004, True 0057/0057, Psims2Wth, run, 1.091123, True 0057/0057, Jsons2Dssat, run, 0.234614, True STOP 99 0057/0057, Dssat, run, 0.482648, False 0057/0057, NoOutput2Psims, run, 0.090880, True

May I ask which commit version of DSSAT v4.6 or v4.5 you used to run? I only can compile DSSAT V4.7 in my computer and could not find previous compile method. Now in DSSAT web, they updated newest compile method. Not the old method.

And could you tell me how to debug the DSSAT False error?

Thanks so much!

DavidKelly-Praedictus commented 6 years ago

Hello,

For the numpy issue, I think you'd probably be better off using a supported numpy version than making changes to the source code since there may be other unexpected issues that arise. Are you using a virtual environment? That will help isolate your python environment and avoid any numpy conflicts you might be seeing. The basic setup is something like:

$ easy_install pip $ pip install virtualenv $ virtualenv venv

Then to start the virtual environment: $ source venv/bin/activate

This will get you into a clean python environment where no modules are installed. From there you can use pip to install everything you need. There's a file called pysims/requirements.txt that contains a list of required modules and their versions. You can install everything there with:

$ pip install -r /path/to/pysims/requirements.txt

This should install the correct version of numpy for you. If that works, please revert jsons2dssat.py back to the original version and try running again within the virtual environment. If dssat is still an issue at that point, let me know and we can take a closer look.