diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/benb_utils.iml b/.idea/benb_utils.iml
new file mode 100644
index 0000000000000000000000000000000000000000..2f84cbc5b768b402d6f6f54ecdbb834b38f62a3a
--- /dev/null
+++ b/.idea/benb_utils.iml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="jdk" jdkName="Python 3.7 (py37) (2)" jdkType="Python SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000000000000000000000000000000000000..162114ef8e83f8744f45975c91f1e66ff18e86a6
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,20 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
+      <option name="ignoredErrors">
+        <list>
+          <option value="W605" />
+        </list>
+      </option>
+    </inspection_tool>
+    <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="ignoredIdentifiers">
+        <list>
+          <option value="int.*" />
+          <option value="tuple.*" />
+        </list>
+      </option>
+    </inspection_tool>
+  </profile>
+</component>
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+<component name="InspectionProjectProfileManager">
+  <settings>
+    <option name="USE_PROJECT_PROFILE" value="false" />
+    <version value="1.0" />
+  </settings>
+</component>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a57d9d7a8f021e898f2d1e71a0f0b970fbee9e2a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (py37) (2)" project-jdk-type="Python SDK" />
+</project>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9f1e93b6c02e63584a171b761471dff6732f4193
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/benb_utils.iml" filepath="$PROJECT_DIR$/.idea/benb_utils.iml" />
+    </modules>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/benb.py b/benb.py
index cc0dbfad27430c5a7c8165acddc2caee6677ed8a..d2e0c57c74a41c12193c0c97b7274d78eeb1ae47 100644
--- a/benb.py
+++ b/benb.py
@@ -148,7 +148,6 @@ def colrow2xy(colrow, rio_object=None, affine_in=None):
     return x, y
 
 
-
 def progress_bar(iterable, prefix='', suffix='', decimals=1, length=100, fill='#', printEnd="\r"):
     """
     Call in a loop to create terminal progress bar
@@ -230,4 +229,3 @@ def file_of_type(x, ext):
         raise argparse.ArgumentTypeError('{} is not a file'.format(x))
     if not ext_match:
         raise argparse.ArgumentTypeError('{} is not a correct file'.format(x))
-
diff --git a/buffer_raster.py b/buffer_raster.py
new file mode 100644
index 0000000000000000000000000000000000000000..964144b5633c8eab5cf96f81812fc8fff5758887
--- /dev/null
+++ b/buffer_raster.py
@@ -0,0 +1,47 @@
+import rasterio as rio
+import numpy as np
+import os
+
+
+def buffer_raster(raster_path: str, crs, padding: int = 100):
+    """
+
+    Parameters
+    ----------
+    raster_path : str
+        filepath for raster to buffer
+    crs
+        crs specification
+    padding : int
+        amount of cells to buffer around raster
+
+    Returns
+    -------
+    buffered raster : rasterio.io.DatasetReader
+
+
+    """
+    raster = rio.open(raster_path)
+    raster_buffered = raster.read(1)
+    for i in range(padding):
+        raster_buffered = np.insert(raster_buffered, [0], -9999, axis=1)
+        raster_buffered = np.insert(raster_buffered, [0], -9999, axis=0)
+        raster_buffered = np.insert(raster_buffered, [-1], -9999, axis=1)
+        raster_buffered = np.insert(raster_buffered, [-1], -9999, axis=0)
+    raster_buffered = np.where(raster_buffered == -9999, np.nan, raster_buffered)
+    origin_x, origin_y = raster.xy(-padding, -padding)
+
+    outputpath = os.path.splitext(raster_path)[0] + ".tif"
+    with rio.open(
+            outputpath,
+            "w",
+            driver="GTiff",
+            height=raster_buffered.shape[0],
+            width=raster_buffered.shape[1],
+            count=1,
+            dtype=raster_buffered.dtype,
+            crs=crs,
+            transform=rio.transform.from_origin(origin_x - 12.5, origin_y + 12.5, 25, 25),
+    ) as outputraster:
+        outputraster.write(raster_buffered, 1)
+    return rio.open(outputpath)
diff --git a/mnp_hokaggregation.py b/mnp_hokaggregation.py
index 7e450ad3e104d69e3b5def70978d747326b74f1e..c2b1c9bdf87c3baee56f2e8d211ca165c5549392 100644
--- a/mnp_hokaggregation.py
+++ b/mnp_hokaggregation.py
@@ -9,7 +9,7 @@ from mpl_toolkits.axes_grid1 import make_axes_locatable
 import os
 
 
-def mnp_hokaggregation(hok_csv, hokken_polygon_path, background_raster_path, outputdir):
+def mnp_hokaggregation(hok_csv, hokken_polygon_path, background_raster_path, outputdir, gridcell_count=False):
     """
     make aggregationplots for use in manual validation of mnp runs. can both aggregate validation data and species
     model gridcells per hok.
@@ -39,12 +39,12 @@ def mnp_hokaggregation(hok_csv, hokken_polygon_path, background_raster_path, out
     counts.columns = colnames
     counthokken = pd.merge(hokken, counts, on="ID")
 
-    if "COUNT_KEY_VALUE" in colnames:
-        bounds = np.array([1, 10, 100, 1000, 10000, 40000])
+    if "MEAN" in colnames:
+        bounds = np.round(np.arange(1,counts.MEAN.max(),counts.MEAN.max()/6),1)
         explabel = "_"
-        valuecolumn = "COUNT_KEY_VALUE"
-        extend = "neither"
-        ylabel_text = "Number of gridcells in Hok"
+        valuecolumn = "MEAN"
+        extend = "max"
+        ylabel_text = "Number of observations in SOVON"
 
     elif "OPS_COUNT" in colnames:
         bounds = np.array([1, 10, 50, 100, 500, 1000])
@@ -53,6 +53,20 @@ def mnp_hokaggregation(hok_csv, hokken_polygon_path, background_raster_path, out
         extend = "max"
         ylabel_text = "number of observations in NDFF"
 
+    elif gridcell_count:
+        bounds = np.array([1, 10, 100, 1000, 10000, 40000])
+        explabel = "_"
+        valuecolumn = "COUNT_KEY_VALUE"
+        extend = "neither"
+        ylabel_text = "Number of gridcells in Hok"
+
+    elif "MAX_KEY_VALUE" in colnames:
+        bounds = np.array([0, 0.1, 0.5, 1, 1.5, 2])
+        explabel = "_"
+        valuecolumn = "MAX_KEY_VALUE"
+        extend = "max"
+        ylabel_text = "Largest key population in cell"
+
     else:
         raise Exception("no value column in columns")