RASTER LAYER INSERTION

Dear all, I have a problem inserting the raster layer and would like some guidance to resolve it.

Every time I insert the raster layer in tiff format the information “Dataset must be projected in linear units” appears.

How do I resolve this issue?

Hello @yata, and welcome!

That error message indicates that the raster’s coordinate system is not a projected coordinate system, with units of meters. It likely has a geographic coordinate system, where the units are in degrees. So you will need to reproject the raster (and all of your other geospatial layers) to a projected coordinate system that is appropriate for your study area.

You don’t say which model you’re using, but many of them have a note at the beginning of the Data Needs section of the User Guide saying “All spatial inputs must be in the same projected coordinate system and in linear meter units.”

You can also consult the Getting Started section of the User Guide, specifically Formatting Your Data, which talks more about projections.

~ Stacie

Thank you for your contribution.

As informed, I performed the reprojection to UTM WGS 84 23S. Previously, I was performing the reprojection to UTM SIRGAS 2000 23S and INVEST was not accepting it. I believe that this issue has been overcome, however, when executing the processing, another error appeared that I would like support for.

The error that appeared is shown below.

08/12/2024 10:20:15 natcap.invest.utils Level 100 Writing log messages to [C:\Users\Secap ProMunic�pos\Desktop\ARTIGOS\SEQUESTRO DE CARBONO\C_CARBONO_RELATORIOS\Nova pasta\RESEX\ARAPIRANGA\INVEST\InVEST-natcap.invest.carbon-log-2024-08-12–10_20_15.txt]
08/12/2024 10:20:15 main Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.carbon 3.14.0:
calc_sequestration False
carbon_pools_path C:\Users\Secap ProMunic�pos\Desktop\ARTIGOS\SEQUESTRO DE CARBONO\C_CARBONO_RELATORIOS\Nova pasta\RESEX\ARAPIRANGA\ARAPIRANGA_85.csv
discount_rate
do_redd False
do_valuation False
lulc_cur_path C:\Users\Secap ProMunic�pos\Desktop\TESTE\ARAPIRANGA_FINAL_85.tif
lulc_cur_year
lulc_fut_path
lulc_fut_year
lulc_redd_path
n_workers -1
price_per_metric_ton_of_c
rate_change
results_suffix
workspace_dir C:\Users\Secap ProMunic�pos\Desktop\ARTIGOS\SEQUESTRO DE CARBONO\C_CARBONO_RELATORIOS\Nova pasta\RESEX\ARAPIRANGA\INVEST

08/12/2024 10:20:15 natcap.invest.carbon INFO Building file registry
08/12/2024 10:20:15 natcap.invest.utils ERROR Exception while executing natcap.invest.carbon
Traceback (most recent call last):
File “natcap\invest\utils.py”, line 697, in read_csv_to_dataframe
File “pandas\core\generic.py”, line 6532, in astype
File “pandas\core\internals\managers.py”, line 414, in astype
File “pandas\core\internals\managers.py”, line 354, in apply
File “pandas\core\internals\blocks.py”, line 616, in astype
File “pandas\core\dtypes\astype.py”, line 238, in astype_array_safe
File “pandas\core\dtypes\astype.py”, line 183, in astype_array
File “pandas\core\dtypes\astype.py”, line 134, in _astype_nansafe
ValueError: could not convert string to float: ‘37,.4’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “natcap\invest\utils.py”, line 164, in prepare_workspace
File “invest\cli.py”, line 470, in main
File “natcap\invest\carbon.py”, line 370, in execute
File “natcap\invest\utils.py”, line 703, in read_csv_to_dataframe
ValueError: Value(s) in the “c_below” column of the table C:\Users\Secap ProMunic�pos\Desktop\ARTIGOS\SEQUESTRO DE CARBONO\C_CARBONO_RELATORIOS\Nova pasta\RESEX\ARAPIRANGA\ARAPIRANGA_85.csv could not be interpreted as numbers. Original error: could not convert string to float: ‘37,.4’
08/12/2024 10:20:15 natcap.invest.utils INFO Elapsed time: 0.0s
08/12/2024 10:20:15 natcap.invest.utils INFO Execution finished

Glad to hear that you figured out the projection issue. The current error says this:

ValueError: Value(s) in the “c_below” column of the table C:\Users\Secap ProMunic�pos\Desktop\ARTIGOS\SEQUESTRO DE CARBONO\C_CARBONO_RELATORIOS\Nova pasta\RESEX\ARAPIRANGA\ARAPIRANGA_85.csv could not be interpreted as numbers. Original error: could not convert string to float: ‘37,.4’

I’m wondering if you are using a comma as a decimal delineator for your carbon pool values. For example, does this value appear as “37,4” in the carbon pool table or “37.4”? If it’s “37,4”, try changing all of the values to use a period instead of a comma and see if that helps. The individual column values should be separated by a comma, so the model can get confused if the number decimals are also separated by a comma.

~ Stacie

I removed all the commas, however, the execution error remains.

08/12/2024 15:16:09 natcap.invest.utils ERROR Exception while executing natcap.invest.carbon UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xed in position 64: invalid continuation byte The above exception was the direct cause of the following exception: Traceback (most recent call last): File “natcap\invest\utils.py”, line 72, in _log_gdal_errors SystemError: returned a result with an exception set The above exception was the direct cause of the following exception: Traceback (most recent call last): File “natcap\invest\utils.py”, line 72, in _log_gdal_errors SystemError: returned a result with an exception set exception: Traceback (most recent call last) with an exception Sep 08/12/2024 15:16:09 natcap.invest.utils INFO Elapsed time: 0.04s

Dear,

Error persists. Any solution?

08/13/2024 14:59:33 natcap.invest.utils ERROR Exception while executing natcap.invest.carbon
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xed in position 64: invalid continuation byte

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “natcap\invest\utils.py”, line 72, in _log_gdal_errors
SystemError: returned a result with an exception set

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “natcap\invest\utils.py”, line 72, in _log_gdal_errors
SystemError: returned a result with an exception set

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “natcap\invest\utils.py”, line 164, in prepare_workspace
File “invest\cli.py”, line 470, in main
File “natcap\invest\carbon.py”, line 392, in execute
File “pygeoprocessing\geoprocessing.py”, line 1874, in get_raster_info
SystemError: _PyEval_EvalFrameDefault returned a result with an exception set

Hi @yata -

It would be helpful to look at your carbon pool CSV, can you upload it here?

~ Stacie

As requested.

Thank you in advance

ARAPIRANGA_85.csv (307 Bytes)

Thanks @yata. The values in this table are separated by semicolons, not commas, as is usually the case for CSVs, which are “comma-separated value” tables. I think that InVEST can theoretically handle CSVs where the values are separated by semicolons, but can you try changing the field delimeter to commas instead of semicolons and see if that helps?

~ Stacie

Semicolons should work fine. The error is a UnicodeDecodeError meaning that your file is not correctly encoded. All CSVs must be encoded in UTF-8. You must modify the file to use the correct encoding. This option is usually available in your spreadsheet software.

Previously, I had saved the file with comma delimiters and UTF-8, as a file that I share with you, however the error remains.

ARQUIVO.pdf (217.9 KB)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.