This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Convert a linked taxonomy csv file to a flattened taxonomy csv file. | |
""" | |
import pandas as pd | |
def get_flattened_taxonomy(linked_taxonomy, parent_col="id_parent", rank_names_or_prefix="rank", include_rank=True, drop_parent_col=True): | |
""" | |
Converts a linked taxonomy DataFrame (i.e. where nodes in the taxonomic tree are only linked through their parent) to a flattened |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Convert a flattened taxonomy csv file to a linked taxonomy csv file. | |
""" | |
import pandas as pd | |
def get_linked_taxonomy(flat_taxonomy, rank_cols, parent_id_col="id_parent", drop_rank_cols=True): | |
""" | |
Converts a flat taxonomy DataFrame (i.e. where every taxonomic rank from the root parent of each taxa is explicitly stored) to a linked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.chocosolver.solver.Model; | |
import org.chocosolver.solver.Solver; | |
import org.chocosolver.solver.variables.IntVar; | |
import java.util.stream.IntStream; | |
/** | |
* CP Model for enumerating paths in a graph from start_node to end_node, with a cost constraint. | |
* Costs are on the arcs. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.chocosolver.graphsolver.cstrs.connectivity; | |
import org.chocosolver.graphsolver.util.ConnectivityFinder; | |
import org.chocosolver.graphsolver.variables.GraphEventType; | |
import org.chocosolver.graphsolver.variables.UndirectedGraphVar; | |
import org.chocosolver.solver.constraints.Propagator; | |
import org.chocosolver.solver.constraints.PropagatorPriority; | |
import org.chocosolver.solver.exception.ContradictionException; | |
import org.chocosolver.solver.variables.Variable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
import math | |
import geopandas as gpd | |
import rasterio | |
import rasterio.features | |
from affine import Affine |