Catalog of Custom Functions
These functions encapsulate complex python code, allowing you to implement sophisticated data manipulations and calculations with ease.
GeoPard offers a comprehensive Catalog of Custom Functions designed to enhance the readability and functionality of Equation-based Analytics. These functions encapsulate complex python code, allowing you to implement sophisticated data manipulations and calculations with ease.
Enter Equation

The list of available pre-built functions to create more intuitive and maintainable Equations within the GeoPard platform is incorporated in the geopard package:
fill_gaps_with_k_neighbors
This function restores data gaps or zeros in a dataset using the K-Neighbors algorithm. By specifying the input_data variable (as Dataset with the selected attribute) and the number of neighbors k, you can seamlessly fill in missing values, ensuring data continuity and integrity.
This function works well when data gaps are distributed across the field and not allocated to any particular part of the field boundary.
determine_data_similarity
Use this function to calculate the per-pixel similarity between two Datasets. The variables data_layer_1 and data_layer_2 should represent the same measurement in the same units to ensure meaningful comparison. By providing variables data_layer_1 and data_layer_2 associated with Datasets, you can generate a similarity map with values ranging from 0 to 1, facilitating comparative studies and pattern recognition.
determine_data_similarity_from_normalized
Use this function to calculate the per-pixel similarity between two normalized datasets. Normalization is recommended when the original data_layer_1 and data_layer_2 have different scales or units. By providing these datasets as input, the function generates a similarity map with values ranging from 0 to 1, making it suitable for comparative studies, pattern recognition, and spatial consistency analysis.
determine_low_high_similarity
This function assesses the low-high similarity between two Datasets. By inputting variables data_layer_1 and data_layer_2 associated with Datasets, you receive a categorized similarity map indicating combinations such as low-low, low-high, high-low, and high-high, which is useful for nuanced data classification.
get_value_for_zone
Use this function to extract all values from a Dataset attribute within a single zone. Provide data_layer (the attribute layer), zones_layer (the zones map), and zone_id (the zone number) to isolate values for analysis, such as yield, application rate, or seed rate, inside that zone.
drop_value
This function allows you to remove specific values from a Dataset attribute. By specifying data_layer associated with a Dataset attribute and value_to_drop as a number, you can cleanse the Dataset attribute data by eliminating them from the result (technically replacing unwanted values with NaN).
normalize_data
Normalize your Dataset attribute efficiently with this function. By inputting data_layer associated with the Dataset attribute, you can scale the data to a standardized range from 0 to 1, facilitating comparison and integration across different Datasets.
calculate_total_applied_fertilizer
Calculate the Total Applied Fertilizer in units per area (for example, in kg/ha, l/ha, gal/ac, etc). By providing application_list Datasets with AppliedRate attributes and corresponding active_ingredient_coefficient_list with fertilizer products to get the actual total applied fertilizer in units (for example, in kg, l, gal, etc).
calculate_total_applied_nitrogen
Calculate the Total Applied Nitrogen in kg/ha using this function. By providing application_list Datasets with AppliedRate attributes and corresponding active_ingredient_coefficient_list with nitrogen products to convert actual nitrogen to kg/ha, you can accurately compute Total Applied Nitrogen, essential for agricultural planning and sustainability assessments. The output is used as N_total_applied ingeopard.calculate_nitrogen_use_efficiency.
calculate_nitrogen_uptake
Determine Nitrogen Uptake in kg/ha with this function. By supplying yield_wet_tha, moisture_pct, protein_pct from the Yield Dataset and protein_crop_correction_coefficient representing the linkage protein to the uptake of nitrogen, you can assess the Nitrogen Use Efficiency in crop production. The output is used as N_uptake ingeopard.calculate_nitrogen_use_efficiency .
calculate_nitrogen_use_efficiency
Evaluate Nitrogen Use Efficiency as a percentage using this function. By inputting N_total_applied and N_uptake variables (from previous functions), you can measure the effectiveness of nitrogen application, aiding in optimizing fertilizer usage.
calculate_costs
Compute Total Costs based on application rates and prices with this function. By providing a application_rate_list of Datasets with the AppliedRate attributes and a corresponding price_per_unit_list, you can aggregate expenses related to various agricultural activities, supporting budget management and financial planning. The output is used as costs ingeopard.calculate_profit.
calculate_revenue
Calculate Revenue from the Yield Dataset using this function. By inputting yield_as_mass associated with the Yield Dataset attribute and the yield_price_per_unit, you can estimate income generated from crop production, facilitating economic evaluations. The output is used as costs ingeopard.calculate_profit .
calculate_profit
Determine Profit by subtracting Costs from Revenue using this function. By providing the revenue and costs variables (from previous functions), you can easily compute the financial gain from their agricultural operations, supporting profitability analysis and strategic decision-making.
fill_value_for_range
This function filters values within a specified range in the input array. By providing the input array, along with optional min_value and optional max_value thresholds, you can isolate values that fall within the desired range. The value_to_fill parameter allows for replacing out-of-range values with a specified value, enhancing data filtering and normalization processes.
calculate_per_pixel_mae
Use this function to compute the Mean Absolute Error (MAE) per pixel between two datasets. It provides a spatial map of absolute differences. The "absolute difference" is simply the size of the gap between corresponding pixel values, ignoring whether one is higher or lower.
The function helps to identify areas with larger discrepancies.
calculate_per_pixel_relative_deviation
This function computes the relative deviation for each pixel between two datasets, expressing the difference as a percentage of the value in dataset_1. Essentially, it shows how much one pixel's value deviates from the corresponding value in dataset_1 in proportional terms.
This approach is particularly valuable when analyzing variations in soil properties, crop yield, or remote sensing data, allowing quickly spotting areas with significant proportional differences.
calculate_difference
This function subtracts one dataset from another to create a difference map. It highlights areas where the values in one dataset are higher or lower compared to the other, making it easier to spot trends and changes over time.
This tool is especially useful for visualizing variations in soil properties, crop yield, or remote sensing data, helping quickly identify key areas that may require further analysis or intervention.
calculate_relative_difference
This function computes the relative difference for each pixel by normalizing the difference between the datasets using the values from dataset_2. This means it shows how significant the change is in relation to the magnitude of dataset_2.
Such a proportional comparison is especially useful when dealing with datasets of varying scales, helping to reveal relative shifts in soil properties, crop yields, or sensor outputs. This approach enables to pinpointing of areas with notable variations.
calculate_normalized_difference
This function computes the normalized difference for each pixel by scaling both datasets against their global maximum value. This process makes the datasets directly comparable even if they originally have different ranges.
The resulting map provides a clear view of variations in soil properties, crop yield, and remote sensing data, allowing quickly identify and assess key differences.
build_zones_by_intervals
This function creates a management zone map by classifying a continuous raster layer into discrete zones based on user-defined value intervals.
Each interval defines a zone, and every pixel is assigned to the zone whose value range it falls into. Pixels that do not match any interval are marked as -1.
This zoning approach is commonly used to transform yield maps, soil properties, or remote sensing indices into actionable management zones for variable-rate applications.
Typical use cases
Creating management zones from yield, NDVI, or soil layers
Preparing zone maps for nutrient or seeding rate calculations
Segmenting fields into homogeneous zones for decision-making
calculate_nutrient_rate_as_active_ingredients_per_zone
This function calculates the required nutrient application rate (active ingredient) for each management zone.
The calculation is based on:
a target nutrient level,
plant-available nutrient supply from soil,
nutrients already applied through previous operations (manure, fertilizers, digestate, etc.).
Applied nutrient operations can be provided as constants, per-zone values, raster layers, or any combination of these. All inputs are automatically resolved and aggregated per zone.
By default, the required rate is calculated as the difference between the target nutrient level and the sum of soil supply and applied nutrients. The result is returned as a raster map where each zone contains a uniform nutrient rate.
convert_active_ingredient_and_product
This function converts a raster layer between active ingredient rates and product rates using a correction coefficient.
The corrected_coefficient can be a single float (applied to all pixels) or a coefficient matrix (per-pixel conversion). It is typically used to translate calculated nutrient requirements (active ingredient) into actual product application rates, or vice versa, based on fertilizer composition or nutrient concentration.
The conversion is applied pixel-wise, preserving the spatial structure of the original layer.
Typical use cases
Converting nutrient rates to fertilizer product rates
Adjusting application maps based on nutrient concentration
Preparing final prescription maps for machinery
estimate_texture_class_based_on_usda
This function estimates USDA soil texture for each pixel using sand, silt, and clay percentages.
Provide three raster layers in percent (0-100) that represent the particle-size fractions. The output is USDA class names such as sand, loamy_sand, sandy_loam, loam, silt_loam, sandy_clay_loam, clay_loam, silty_clay_loam, silty_clay, or undefined when inputs are invalid.
estimate_texture_class_based_on_fao_wrb
This function estimates the FAO/WRB (ISO 11277) soil texture class for each pixel based on sand, silt, and clay percentages.
Provide three raster layers in percent (0-100) that represent the particle-size fractions. The output is FAO/WRB class codes such as S, LS, SL, L, SiL, Si, SCL, CL, SiCL, SC, SiC, C, HC, or undefined when inputs are invalid.
calculate_soil_bulk_density
This function calculates soil bulk density (g/cm³) based on texture class and optional soil organic matter (SOM).
The texture_class_layer should contain class names or codes produced by the USDA texture function or the FAO/WRB texture function mentioned above.
If som_pct_layer is provided (percent), the function adjusts bulk density using SOM. Otherwise, it returns soil bulk density (g/cm³) values associated with texture classes according to the USDA or FAO/WRB lookup.
Last updated
Was this helpful?