This forum is shutting down! Please post new discussions at community.naturalcapitalproject.org

"line contains NULL byte" error in the carbon model

Hello, it is the first time to use the carbon model and I got the problem.
Please let me know what it means and how to fix?
The log is pasted below.
Thank you!


02/06/2019 16:57:04  natcap.invest.carbon INFO     Building file registry
02/06/2019 16:57:04  natcap.invest.ui.model ERROR    Exception while executing <function execute at 0x113FD2F0>
Traceback (most recent call last):
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\ui\model.py", line 1541, in _logged_target
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\carbon.py", line 122, in execute
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\utils.py", line 432, in build_lookup_from_csv
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\pandas\io\parsers.py", line 678, in parser_f
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\pandas\io\parsers.py", line 440, in _read
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\pandas\io\parsers.py", line 787, in __init__
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\pandas\io\parsers.py", line 1024, in _make_engine
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\pandas\io\parsers.py", line 2082, in __init__
  File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\pandas\io\parsers.py", line 2212, in _make_reader
Error: line contains NULL byte
02/06/2019 16:57:04  natcap.invest.ui.model INFO     Execution finished
02/06/2019 16:57:04  natcap.invest.utils INFO     Elapsed time: 0.06s
Tagged:

Comments

  • swolnyswolny Member, NatCap Staff
    Hi @urgendalai -

    It would be helpful if you post the entire log file (.txt) that the model produces in your Workspace - that gives us more information to work with.

    Until then, I wonder if your carbon pool table has a blank line at the end of the rows - that sometimes causes problems. You can really only see those if you look at the .csv in a text editor. If there is a blank line, delete it in the text editor and try running again. If you still get the error, please post the whole log file - thanks.

    ~ Stacie
  • @swolny

    I checked roughly the carbon pool file but did not find the blank line.
    The whole log file is attached, please let me know if you found any thing.
    Thank you!
  • @swolny

    Hi, I just found the carbon pool table was saved the wrong format, so I saved it again as .csv. 
    But there is a new problem in the table, please see the new attached file, Thank you.
  • swolnyswolny Member, NatCap Staff
    Hi @urgendalai -

    Does your carbon pool table have a field named "c_below"? If not, check out the User Guide for the Carbon model - it lists the fields that are required. Even if you do not have data for all carbon pools, the field must be there and you can give a value of zero.

    ~ Stacie
  • @swolny

    I do have this column for sure, this is why I can't figure the problem out.
  • swolnyswolny Member, NatCap Staff
    Interesting. Can you send your data to swolny at stanford.edu? I'll check it out.

    ~ Stacie
  • swolnyswolny Member, NatCap Staff
    Thanks for sending your data. The error was caused by there being a space in front of two of your field names. If you look at the .csv in a text editor, it's easier to see than in Excel, but the column "c_below" was entered as " c_below" (with a space before the c), same thing for c_soil. When I removed those spaces, the model ran fine.

    ~ Stacie

  • @swolny

    Thank you for helping me correct it! Now I see the problem. No space allowed in .csv.

Sign In or Register to comment.