Skip to content

ChrisMarsden833/revalue-match

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Revalue-match

A spatial embeddings control group allocator for measuring de/reforestation using Clay.

Installation & Running

See requirements.txt for full requirements. The 'quick version' follows.

Clay should be installed with:

pip install git+https://github.com/Clay-foundation/model.git

You will also need to get the huggingface weights (~5GB):

wget https://huggingface.co/made-with-clay/Clay/resolve/main/v1.5/clay-v1.5.ckpt

This must have the configs/ folder in the same directory as the checkpoint, so it's safest to just put this in the root directory.

You will also need rasterio:

pip install rasterio

To reproduce the examples, you will also need to create folders data/ and serialised_tables/.

Basic use is shown below, but see example.ipynb for an example using the task materials. To run this, copy the folders donor_pool/ and project_area/ from the task materials into data/

from src.rmatch import RMatch

matcher = RMatch()

matcher.get_donor_embeddings("donor_shapefile.shp",
                            "donor_rasters/*.tif",
                            "donor_forest_rasters/*.tif")

matcher.get_project_embeddings("project_shapefile.shp",
                               "project_rasters/*.tif",
                               "project_forest_rasters/*.tif")

output = matcher.evaluate(k = 3) # Get 3 nearest matches

print(output)

To run the test framework, simply run python src/tests.py.

About

A spatial embeddings control group allocator for measuring de/reforestation using Clay.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors