# Crop Production Percentile Model

**URL:** <https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537>\
**Category:** Software Support\
**Tags:** crop-production\
**Created:** [March 2, 2022, 3:47pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537 "2022-03-02T15:47:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 2, 2022, 3:47pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/1 "2022-03-02T15:47:26Z")

</div>

Hi,  
I downloaded the ESRI 2020 land cover map for my area of interest and am attempting to construct the other input, the landcover to crop table csv, but I have no idea how to do so.

Any assistance would be greatly appreciated.

Thanks,  
Anitha

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 2, 2022, 4:18pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/2 "2022-03-02T16:18:27Z")

</div>

Hi @aneetainvestvina, and welcome to the forum.

Have you looked at the sample data that comes with InVEST? Each model has sample data so you can see what it looks like, how it’s formatted, and you can use it as a template for your own data. By default, sample data is installed when you install InVEST (on Windows at least), else you can download it from the [InVEST web page](https://naturalcapitalproject.stanford.edu/software/invest) under “Individual Sample Datasets for InVEST”.

~ Stacie

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 2, 2022, 6:52pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/3 "2022-03-02T18:52:30Z")

</div>

Hi Stacie,  
Thank you for your response. I have the sample data, but I’m still curious about how the table was created. According to my understanding, the table must be built using the landcover map, but I have no idea how to accomplish it.

---

<div class="post-metadata">

**Author:** ![jesseG](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/jesseg/32/1068_2.png) [@jesseG](https://community.naturalcapitalalliance.org/u/jesseG)\
**Post date:** [March 2, 2022, 9:31pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/4 "2022-03-02T21:31:26Z")

</div>

Hi @aneetainvestvina ,

The [table can be built in Microsoft Excel, Google Sheets, or any spreadsheet program](http://releases.naturalcapitalproject.org/invest-userguide/latest/input_types.html?highlight=utf#csv). When it’s ready, save it as a .CSV file. Our [User Guide points out](http://releases.naturalcapitalproject.org/invest-userguide/latest/getting_started.html?highlight=utf#formatting-your-data) that “_When saving the CSV file, be sure to save the file using one of the following encodings: ASCII, UTF-8 or Signed UTF-8. Using any other encoding (such as Latin-1) will result in incorrect text rendering in output files and could cause models to fail with an error._”

The landcover map only needs to be used as a guide to properly pair each `Value` from its attribute table with its respective `lucode` (and associated `crop_name`) in [the table](http://releases.naturalcapitalproject.org/invest-userguide/latest/crop_production.html#additional-percentile-data-needs).

Does that make sense? Please refer to the `lucode`s in the sample table to see how they each match their respective `Value`s in the sample landcover map’s attribute table.

-Jesse

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 3, 2022, 3:39pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/5 "2022-03-03T15:39:10Z")

</div>

> [@jesseG](#):
>
> Does that make sense? Please refer to the `lucode` s in the sample table to see how they each match their respective `Value` s in the sample landcover map’s attribute table.

Hi Jesse,  
Thanks for your response.  
This is the part I am unable to decode" Please refer to the `lucode` s in the sample table to see how they each match their respective `Value` s in the sample landcover map’s attribute table.".  
Is there a guide or video you would recommend? I have an ESRI Land cover map and I am unable to obtain the crop lucode.

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 3, 2022, 4:39pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/6 "2022-03-03T16:39:29Z")

</div>

Hi @aneetainvestvina -

If your land cover map is a raster, it probably already has integer values assigned to each land cover class, so you need to look at these in a GIS, and/or the map’s documentation, to find out those lucode values. If the land cover map is vector, then you’ll either need to assign integer lucodes yourself, or the GIS will probably assign integer values automatically when you convert it to raster.

We have a couple of video tutorials for working with biophysical tables in InVEST, which you can check out on our [GIS for InVEST web page](https://naturalcapitalproject.stanford.edu/virtual-training/gis-invest-tutorials). They use the sediment model as an example, but a similar process applies for the Crop model.

~ Stacie

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 4, 2022, 7:19pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/7 "2022-03-04T19:19:21Z")

</div>

Thank you for the detailed response, Stacie.  
One more question about Monfreda datasets: will this be the same for my ESRI 2020 land cover input as well?

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 7, 2022, 4:11pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/8 "2022-03-07T16:11:25Z")

</div>

Hi @aneetainvestvina -

I don’t have experience using the Crop model, but [the User Guide says](https://storage.googleapis.com/releases.naturalcapitalproject.org/invest-userguide/latest/crop_production.html#additional-percentile-data-needs) that the Percentile model requires a mapping between your land cover map and the crops supported in the Monfreda dataset (parameter **LULC To Crop Table** ). The land cover map can be from any source, and the lucodes themselves don’t matter, but each lucode must be mapped to one of the supported crop names.

~ Stacie

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 8, 2022, 7:24pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/9 "2022-03-08T19:24:57Z")

</div>

Thank you, Stacie.  
I downloaded the 2020 land cover (.tiff) for Vietnam from ESRI and Mekong delta area shape file from another data source ,which is the subject of my research. I retrieved land cover for the Mekong area using QGIS’ extract by mask feature. And when I try to import this Mekong (.tiff) LULC file into my crop model, it refuses to accept.

Any assistance would be really helpful.

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 9, 2022, 2:25am UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/10 "2022-03-09T02:25:42Z")

</div>

Hi @aneetainvestvina -

What happens when the crop model refuses to accept your LULC raster? Does it give an error? Please take a screenshot of the model window with the error message - thanks!

~ Stacie

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 10, 2022, 8:08pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/11 "2022-03-10T20:08:09Z")

</div>

Thank you, Stacie.  
Please find attached the error screenshot and input land cover data.  
[MekongDelta.tif](https://community.naturalcapitalalliance.org/uploads/short-url/Au16w9VLqhzQV17X1Y0TVNZT4ku.tif) (89.1 KB)

 ![Cropmodel_error](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/f/f0292e1b923dfaa302ecfe5abd2561566687a1fd.jpeg)

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 10, 2022, 9:00pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/12 "2022-03-10T21:00:27Z")

</div>

When you click on the red X next to Land use/land cover map (or in the Run button), what does the error message say? That’s the important part.

~ Stacie

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 10, 2022, 10:06pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/13 "2022-03-10T22:06:20Z")

</div>

![image](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/c/c39640d8c562333930ed576757afd7782f2cf8e6.jpeg)

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 11, 2022, 12:54am UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/14 "2022-03-11T00:54:15Z")

</div>

Ok. And [the User Guide for this model](https://storage.googleapis.com/releases.naturalcapitalproject.org/invest-userguide/latest/crop_production.html#data-needs) says this:

_Note that all GIS inputs must be in the same projected coordinate system and in linear meter units._

So you’ll need to check the coordinate system of the LULC layer, and if it does not have a projected (not geographic) coordinate system, you’ll need to reproject/warp it to have one that’s appropriate for your study area.

~ Stacie

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 17, 2022, 6:32pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/15 "2022-03-17T18:32:43Z")

</div>

Thank you very much, Stacie. I was able to fix the.tiff file, but the result table contains 0 values for the crops.

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [March 22, 2022, 4:26pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/16 "2022-03-22T16:26:29Z")

</div>

Some people have reported this problem before and it has come down to mismatches between the codes the in the crop table and the codes in the landcover raster. For example:

> [@Zero value for crop production percentile](https://community.naturalcapitalalliance.org/t/zero-value-for-crop-production-percentile/2014/8):
>
> @youmna.hammoud Great, there’s your explanation. Banana is listed with code 0 in that table, but if MLK\_Michele1.tif is your landcover raster, there are no 0s in the raster, only values 1 -12. It’s probably worth double-checking all the codes in that table to make sure they are correct for your landcover raster.

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 22, 2022, 7:11pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/17 "2022-03-22T19:11:29Z")

</div>

Dave, thank you for the information. I’ve attached my input raster, which I downloaded from ESRI Landcover 2020 and tried to extract the Mekong Delta (Vietnam) area land cover raster using ArcGIS Clip/ExtractbyMask. Then, together with the attached table, they utilized this raster as an input to Invest. I tried 1 to 11 values for the rice crop, but they all resulted in a 0 in the results.  
[MekongDelta3.tif](https://community.naturalcapitalalliance.org/uploads/short-url/sX8itRQUPOvkrODa41WkwhrTlTN.tif) (251.8 KB)  
[landcover\_to\_crop\_table.csv](https://community.naturalcapitalalliance.org/uploads/short-url/x0vOrjXMJBkrHmZrd02OdX2FoM3.csv) (26 Bytes)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [March 23, 2022, 1:22pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/18 "2022-03-23T13:22:25Z")

</div>

Hi @aneetainvestvina , please compare your landcover raster to the one provided by the sample data. The model expects a raster with a single band, where the pixel values are integers that match the codes in the “lucode” column of the CSV file.

This Mekong raster has three bands that appear to be Red-Green-Blue bands. And the first band, which is the one used by the model has these values, none of which appear in the CSV:

 ![Capture](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/f/ffc5e5c15396f86a91f9da8a757da1bc98342dab.png)

If one of these numbers does truly represent rice landcover, then try changing the “lucode” value in your CSV to match that number.

---

<div class="post-metadata">

**Author:** ![aneetainvestvina](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aneetainvestvina](https://community.naturalcapitalalliance.org/u/aneetainvestvina)\
**Post date:** [March 23, 2022, 2:02pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/19 "2022-03-23T14:02:23Z")

</div>

Hi Dave, thank you so much. I’m new to ArcGIS, thus I missed some important details. I’ll look at your suggestion and consult you if necessary.

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 23, 2022, 2:45pm UTC](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537/20 "2022-03-23T14:45:24Z")

</div>

Hi @aneetainvestvina -

Just a note that it is necessary to have some solid GIS skills in order to work with the inputs and outputs of InVEST. If you’re new to GIS, I strongly encourage you to take a class or tutorials, so you feel comfortable with the basics of rasters, vectors, attribute tables, coordinate systems, symbology, etc, before working with the models. We do have [a few technical tutorials available](https://naturalcapitalproject.stanford.edu/virtual-training/gis-invest-tutorials) that are specifically related to InVEST topics, which also may help.

~ Stacie

[Next page](https://community.naturalcapitalalliance.org/t/crop-production-percentile-model/2537.md?page=2)
