Repository: corteva/geocube

Issue:
Setting a name for the value column in vectorize
When using vectorize, the resulting GDF has None as column name, creating issues when trying to save to a file. 

It would be nice to set a defaul value. VALUES, for instance, or whatever that is not None. 


I could do it.

Discussion:
snowman2: Running this should help address linting issues:
```
python -m pip install pre-commit
cd ./geocube
pre-commit install
pre-commit run -a
```
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/corteva/geocube/pull/166?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 96.28%. Comparing base [(`a69f63d`)](https://app.codecov.io/gh/corteva/geocube/commit/a69f63dfdeb9dad6c4a5ac23606bc7832f3ad3a8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva) to head [(`c06e32b`)](https://app.codecov.io/gh/corteva/geocube/pull/166?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva).
> Report is 2 commits behind head on master.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master     #166      +/-   ##
==========================================
+ Coverage   96.23%   96.28%   +0.04%     
==========================================
  Files          14       14              
  Lines         452      457       +5     
==========================================
+ Hits          435      440       +5     
  Misses         17       17              
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/corteva/geocube/pull/166?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=corteva).


Patch:
diff --git a/geocube/vector.py b/geocube/vector.py
index 113f22c..e873c0c 100644
--- a/geocube/vector.py
+++ b/geocube/vector.py
@@ -1,6 +1,8 @@
 """
 Module for vector methods
 """
+import warnings
+
 import geopandas
 import numpy
 import rasterio.features
@@ -53,8 +55,15 @@ def vectorize(data_array: xarray.DataArray) -> geopandas.GeoDataFrame:
             mask=mask,
         )
     )
+
+    if data_array.name:
+        name = data_array.name
+    else:
+        warnings.warn("The array has no name. Column name defaults to _data")
+        name = "_data"
+
     return geopandas.GeoDataFrame(
         vectorized_data,
-        columns=[data_array.name, "geometry"],
+        columns=[name, "geometry"],
         crs=data_array.rio.crs,
     )


Test patch:
diff --git a/test/integration/test_vector.py b/test/integration/test_vector.py
index 4df2cc4..111a812 100644
--- a/test/integration/test_vector.py
+++ b/test/integration/test_vector.py
@@ -43,3 +43,18 @@ def test_vectorize__missing_nodata():
     assert not gdf.geometry.isnull().any()
     assert not gdf.om_r.isnull().any()
     assert len(gdf.index) == 8
+
+
+def test_vectorize__no_name():
+    xds = xarray.open_dataset(
+        TEST_COMPARE_DATA_DIR / "soil_grid_flat.nc",
+        decode_coords="all",
+        mask_and_scale=False,
+    )
+
+    test_array = xarray.DataArray(xds.om_r.data)
+
+    with pytest.warns(UserWarning):
+        gdf = vectorize(test_array)
+
+    assert "_data" in gdf.columns