# कस्टम फ़ंक्शनों की सूची

GeoPard कस्टम फ़ंक्शनों की एक व्यापक सूची प्रदान करता है, जो equation-based analytics की पढ़ने-समझने की क्षमता और उपयोगिता को बेहतर बनाने के लिए बनाई गई है। ये फ़ंक्शन जटिल `python` कोड को समेट लेते हैं, जिससे आप उन्नत डेटा हेरफेर और गणनाएँ आसानी से लागू कर सकते हैं।

### Equation दर्ज करें

<figure><img src="https://docs.geopard.tech/~gitbook/image?url=https%3A%2F%2F3272281156-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FYICBELdyAXXebKAzfLOR%252Fuploads%252FdHTdBE1CN2gSJbE7Bfo0%252Fimage.png%3Falt%3Dmedia%26token%3Dd8e3544f-feca-43a6-b6a1-f1305068de88&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=508ec9e0&#x26;sv=2" alt=""><figcaption><p>एक Equation दर्ज करें</p></figcaption></figure>

GeoPard में अधिक सहज और आसानी से संभाली जा सकने वाली equations बनाने के लिए उपलब्ध pre-built functions की सूची `geopard` package में शामिल है:

### fill\_gaps\_with\_k\_neighbors

```python
# input_data एक Dataset attribute layer है (जैसे, Yield, NDVI)
filled_layer = geopard.fill_gaps_with_k_neighbors(yield_layer, k=5)
```

यह फ़ंक्शन K-Neighbors algorithm का उपयोग करके dataset में मौजूद data gaps या zeros को बहाल करता है। `input_data` variable (चयनित attribute वाले Dataset के रूप में) और पड़ोसी बिंदुओं की संख्या `k`देकर, आप missing values को आसानी से भर सकते हैं, जिससे डेटा की निरंतरता और शुद्धता बनी रहती है।

यह फ़ंक्शन तब अच्छा काम करता है जब data gaps खेत में बिखरे हुए हों और field boundary के किसी खास हिस्से में केंद्रित न हों।

### determine\_data\_similarity

```python
similarity = geopard.determine_data_similarity(yield_2023, yield_2024)
```

इस फ़ंक्शन का उपयोग दो Datasets के बीच per-pixel similarity निकालने के लिए करें। Variables `data_layer_1` और `data_layer_2` को **same measurement** को **same units** में दर्शाना चाहिए, ताकि तुलना अर्थपूर्ण रहे। Datasets से जुड़े variables देने पर `data_layer_1` और `data_layer_2` आप 0 से 1 तक के मानों वाला similarity map बना सकते हैं, जो comparative studies और pattern recognition में मदद करता है।

### determine\_data\_similarity\_from\_normalized

```python
layer_1_norm = geopard.normalize_data(layer_1)
layer_2_norm = geopard.normalize_data(layer_2)

similarity = geopard.determine_data_similarity_from_normalized(layer_1_norm, layer_2_norm)
```

इस फ़ंक्शन का उपयोग दो normalized datasets के बीच per-pixel similarity निकालने के लिए करें। Normalization तब recommended है जब मूल `data_layer_1` और `data_layer_2` की scales या units अलग-अलग हों। इन datasets को input के रूप में देने पर, यह फ़ंक्शन 0 से 1 तक के मानों वाला similarity map बनाता है, जो comparative studies, pattern recognition और spatial consistency analysis के लिए उपयुक्त है।

### determine\_low\_high\_similarity

```python
zones = geopard.determine_low_high_similarity(soil_ph, yield_layer)
```

यह फ़ंक्शन दो Datasets के बीच low-high similarity का आकलन करता है। Variables `data_layer_1` और `data_layer_2` जो Datasets से जुड़े हों, देने पर आपको एक categorized similarity map मिलता है, जिसमें low-low, low-high, high-low और high-high जैसे संयोजन दिखते हैं, जो बारीक डेटा वर्गीकरण के लिए उपयोगी है।

### get\_value\_for\_zone

```python
zone_3_values = geopard.get_value_for_zone(yield_layer, zone_map, zone_id=3)
```

इस फ़ंक्शन का उपयोग किसी एक zone के भीतर Dataset attribute के सभी values निकालने के लिए करें। `data_layer` (attribute layer), `zones_layer` (zones map), और `zone_id` (zone number) दें, ताकि उस zone के अंदर yield, application rate, या seed rate जैसे values analysis के लिए अलग किए जा सकें।

### drop\_value

```python
clean_layer = geopard.drop_value(elevation_layer, value_to_drop=0)
```

यह फ़ंक्शन dataset attribute से specific values हटाने की सुविधा देता है। `data_layer` और `value_to_drop`निर्दिष्ट करके, आप उन values को result से हटाकर dataset को साफ कर सकते हैं; तकनीकी रूप से उन्हें `NaN`.

### normalize\_data

```python
ndvi_normalized = geopard.normalize_data(ndvi_layer)
```

इस फ़ंक्शन से dataset attribute को normalize करें। `data_layer`देने पर, आप डेटा को 0 से 1 की standardized range में scale कर सकते हैं, जिससे अलग-अलग datasets के बीच तुलना और integration आसान हो जाता है।

### calculate\_total\_applied\_fertilizer

```python
applications = [urea_rate, map_rate]
coefficients = [1.0, 1.0]  # units बनाए रखने के लिए 1.0 उपयोग करें, या product concentration के अनुसार समायोजित करें

total_applied = geopard.calculate_total_applied_fertilizer(applications, coefficients)
```

इस फ़ंक्शन से प्रति क्षेत्रफल इकाई में Total Applied Fertilizer की गणना करें (उदाहरण के लिए, kg/ha, l/ha, gal/ac आदि में)। `application_list` को AppliedRate attributes वाले Datasets और संबंधित `active_ingredient_coefficient_list` को fertilizer products के साथ देने पर, आप वास्तव में डाली गई कुल खाद को units (जैसे kg, l, gal आदि) में प्राप्त कर सकते हैं।

### calculate\_total\_applied\_nitrogen

```python
applications = [urea_rate, uan_rate]
nitrogen_coefficients = [0.46, 0.32]  # हर product में N fraction (active ingredient)

N_total_applied = geopard.calculate_total_applied_nitrogen(applications, nitrogen_coefficients)
```

इस फ़ंक्शन से kg/ha में Total Applied Nitrogen की गणना करें। `application_list` को AppliedRate attributes वाले Datasets और संबंधित `active_ingredient_coefficient_list` को nitrogen products के साथ देकर actual nitrogen को kg/ha में बदला जाता है, जिससे आप Total Applied Nitrogen की सही गणना कर सकते हैं। यह कृषि योजना और sustainability assessment के लिए जरूरी है। Output का उपयोग `N_total_applied` के रूप में[`geopard.calculate_nitrogen_use_efficiency`](#calculate_nitrogen_use_efficiency).

### calculate\_nitrogen\_uptake

```python
N_uptake = geopard.calculate_nitrogen_uptake(
    yield_wet_tha=yield_layer,
    moisture_pct=moisture_layer,
    protein_pct=protein_layer,
    protein_crop_correction_coefficient=6.25
)
```

इस फ़ंक्शन से kg/ha में Nitrogen Uptake निर्धारित करें। `yield_wet_tha`, `moisture_pct`, `protein_pct` को Yield Dataset से और `protein_crop_correction_coefficient` को protein और nitrogen uptake के बीच संबंध दर्शाने के लिए देने पर, आप फसल उत्पादन में Nitrogen Use Efficiency का आकलन कर सकते हैं। Output का उपयोग `N_uptake` के रूप में[`geopard.calculate_nitrogen_use_efficiency`](#calculate_nitrogen_use_efficiency) .

### calculate\_nitrogen\_use\_efficiency

```python
NUE_pct = geopard.calculate_nitrogen_use_efficiency(N_total_applied, N_uptake)
```

इस फ़ंक्शन से प्रतिशत के रूप में Nitrogen Use Efficiency का मूल्यांकन करें। [`N_total_applied`](#calculate_total_applied_nitrogen) और [`N_uptake`](#calculate_nitrogen_uptake) variables (पिछले functions से) देने पर, आप nitrogen application की प्रभावशीलता माप सकते हैं, जिससे fertilizer use को बेहतर बनाया जा सके।

### calculate\_costs

```python
rates = [seed_rate, fertilizer_rate]
prices = [1.2, 0.8]  # हर rate layer के लिए प्रति unit कीमत
costs = geopard.calculate_costs(rates, prices)
```

इस फ़ंक्शन से application rates और prices के आधार पर Total Costs निकालें। एक `application_rate_list` जिसमें AppliedRate attributes वाले Datasets हों और एक संबंधित `price_per_unit_list`देने पर, आप विभिन्न कृषि कार्यों से जुड़े खर्चों को जोड़ सकते हैं, जिससे बजट प्रबंधन और वित्तीय योजना में मदद मिलती है। Output का उपयोग `costs` के रूप में[`geopard.calculate_profit`](#calculate_profit).

### calculate\_revenue

```python
revenue = geopard.calculate_revenue(yield_as_mass=yield_layer, yield_price_per_unit=0.25)
```

इस फ़ंक्शन से Yield Dataset से Revenue की गणना करें। `yield_as_mass` जो Yield Dataset attribute से जुड़ा हो और `yield_price_per_unit`देने पर, आप फसल उत्पादन से होने वाली आय का अनुमान लगा सकते हैं, जिससे आर्थिक मूल्यांकन आसान होता है। Output का उपयोग `costs` के रूप में[`geopard.calculate_profit`](#calculate_profit) .

### calculate\_profit

```python
profit = geopard.calculate_profit(revenue, costs)
```

इस फ़ंक्शन से Revenue में से Costs घटाकर Profit निकालें। [`revenue`](#calculate_revenue) और [`costs`](#calculate_costs) variables (पिछले functions से) देने पर, आप अपनी कृषि गतिविधियों से होने वाला वित्तीय लाभ आसानी से निकाल सकते हैं, जिससे profitability analysis और रणनीतिक निर्णय लेने में सहायता मिलती है।

### fill\_value\_for\_range

```python
# केवल 10 और 20 के बीच के values रखें, बाकी को 0 से बदलें
filtered = geopard.fill_value_for_range(layer, min_value=10, max_value=20, value_to_fill=0)
```

यह फ़ंक्शन `input` array में निर्दिष्ट range के भीतर के values को फ़िल्टर करता है। `input` array, along with optional `min_value` और optional `max_value` thresholds देने पर, आप desired range में आने वाले values को अलग कर सकते हैं। `value_to_fill` parameter range से बाहर के values को किसी निर्दिष्ट value से बदलने की सुविधा देता है, जिससे data filtering और normalization बेहतर होती है।

### calculate\_per\_pixel\_mae

```python
mae_layer = geopard.calculate_per_pixel_mae(predicted_yield, observed_yield)
```

इस फ़ंक्शन का उपयोग दो datasets के बीच प्रति pixel Mean Absolute Error (MAE) निकालने के लिए करें। यह absolute differences का एक spatial map देता है। "absolute difference" का सीधा मतलब है संबंधित pixel values के बीच का अंतर कितना है, यह देखना, चाहे कोई मान ज्यादा हो या कम।

यह फ़ंक्शन उन क्षेत्रों की पहचान करने में मदद करता है जहाँ अंतर अधिक है।

### calculate\_per\_pixel\_relative\_deviation

```python
relative_dev = geopard.calculate_per_pixel_relative_deviation(observed_yield, modeled_yield)
```

यह फ़ंक्शन दो datasets के बीच हर pixel के लिए relative deviation निकालता है, और अंतर को `dataset_1`में मौजूद value के प्रतिशत के रूप में दिखाता है। मूल रूप से, यह बताता है कि एक pixel का मान संबंधित value से कितना अलग है `dataset_1` को अनुपातिक रूप में।

यह तरीका खास तौर पर मिट्टी के गुणों, फसल उपज, या remote sensing data में बदलाव का विश्लेषण करते समय बहुत उपयोगी है, क्योंकि इससे आप proportion के हिसाब से बड़े फर्क वाले क्षेत्रों को जल्दी पहचान सकते हैं।

### calculate\_difference

```python
difference = geopard.calculate_difference(yield_2024, yield_2023)
```

यह फ़ंक्शन एक dataset में से दूसरे dataset को घटाकर difference map बनाता है। यह उन क्षेत्रों को उभारता है जहाँ एक dataset के values दूसरे की तुलना में ज्यादा या कम हैं, जिससे समय के साथ रुझान और बदलाव देखना आसान हो जाता है।

यह टूल मिट्टी के गुणों, फसल उपज, या remote sensing data में बदलाव दिखाने के लिए खास तौर पर उपयोगी है, जिससे आप जल्दी उन क्षेत्रों की पहचान कर सकते हैं जहाँ आगे analysis या intervention की जरूरत हो सकती है।

### calculate\_relative\_difference

```python
relative_diff = geopard.calculate_relative_difference(yield_2024, yield_2023)
```

यह फ़ंक्शन हर pixel के लिए relative difference निकालता है, जिसमें datasets के बीच के अंतर को `dataset_2`के values से normalize किया जाता है। इसका मतलब है कि यह दिखाता है कि बदलाव की महत्ता `dataset_2`.

की मात्रा के मुकाबले कितनी है। ऐसा proportional comparison अलग-अलग scale वाले datasets पर काम करते समय खास उपयोगी होता है, क्योंकि इससे मिट्टी के गुणों, फसल उपज, या sensor outputs में सापेक्ष बदलाव सामने आते हैं। यह तरीका उल्लेखनीय variation वाले क्षेत्रों को पहचानने में मदद करता है।

### calculate\_normalized\_difference

```python
normalized_diff = geopard.calculate_normalized_difference(layer_1, layer_2)
```

यह फ़ंक्शन हर pixel के लिए normalized difference निकालता है, जिसमें दोनों datasets को उनके global maximum value के विरुद्ध scale किया जाता है। इस प्रक्रिया से datasets सीधे तुलना योग्य बन जाते हैं, भले ही उनकी ranges मूल रूप से अलग हों।

बनने वाला map मिट्टी के गुणों, फसल उपज और remote sensing data में बदलाव का साफ दृश्य देता है, जिससे आप मुख्य अंतरों को जल्दी पहचान और समझ सकते हैं।

### build\_zones\_by\_intervals

```python
# zoning के लिए intervals
intervals = [
    (4, 8),
    (8, 12),
    (12, 16)
]

# उपयोग
zones = geopard.build_zones_by_intervals(
    layer, 
    intervals
)
```

यह फ़ंक्शन user-defined value intervals के आधार पर एक continuous raster layer को discrete zones में वर्गीकृत करके management zone map बनाता है।

हर interval एक zone तय करता है, और हर pixel को उसी zone में रखा जाता है जिसकी value range में वह आता है। जो pixels किसी भी interval से मेल नहीं खाते, उन्हें -1 के रूप में चिह्नित किया जाता है।

यह zoning तरीका आमतौर पर yield maps, soil properties, या remote sensing indices को variable-rate applications के लिए उपयोगी management zones में बदलने के लिए इस्तेमाल किया जाता है।

**सामान्य उपयोग के मामले**

* yield, NDVI, या soil layers से management zones बनाना
* nutrient या seeding rate calculations के लिए zone maps तैयार करना
* निर्णय लेने के लिए खेतों को समान प्रकृति वाले zones में बाँटना

### calculate\_nutrient\_rate\_as\_active\_ingredients\_per\_zone

```python
# target_nutrient विकल्प
target_nutrient_option1 = 50 # स्थिर संख्या
# या
target_nutrient_option2 = {1: 20, 2: 40} # प्रति-zone dict
# या
target_nutrient_option3 = np.array([[1, 1], [2, 3]], dtype=float) # continuous raster layer

# applied_nutrient_operations विकल्प
applied_operations = [
    5,                                      # operation1 स्थिर संख्या के रूप में
    {1: 2, 2: 4},                           # operation2 प्रति-zone dict के रूप में
    np.array([[1, 1], [2, 3]], dtype=float) # operation3 continuous raster layer के रूप में
]

# उपयोग
rates_as_active_ingredients = geopard.calculate_nutrient_rate_as_active_ingredients_per_zone(
    zone_map, 
    target_nutrient, 
    plant_available_soil_nutrient, 
    applied_nutrient_operations = applied_operations # या []
)
```

यह फ़ंक्शन हर management zone के लिए जरूरी nutrient application rate (active ingredient) की गणना करता है।

गणना इन आधारों पर की जाती है:

* एक target nutrient level,
* मिट्टी से पौधों के लिए उपलब्ध nutrient supply,
* और पहले किए गए operations (manure, fertilizers, digestate आदि) से पहले से डाले गए nutrients।

Applied nutrient operations को constants, per-zone values, raster layers, या इनके किसी भी संयोजन के रूप में दिया जा सकता है। सभी inputs को अपने-आप resolve करके per zone aggregate किया जाता है।

डिफ़ॉल्ट रूप से, जरूरी rate की गणना target nutrient level और soil supply तथा applied nutrients के योग के अंतर के रूप में की जाती है। परिणाम raster map के रूप में मिलता है, जिसमें हर zone में एक समान nutrient rate होता है।

### convert\_active\_ingredient\_and\_product

```python
# active_ingredient से product और vice versa conversion coefficient
corrected_coefficient = 1.5  # स्थिर coefficient
# या
corrected_coefficient = np.array([[np.nan, 5], [np.nan, 1]], dtype=float)  # per-pixel coefficients

# उपयोग
rates_as_products = geopard.convert_active_ingredient_and_product(
    layer, 
    corrected_coefficient
)
```

यह फ़ंक्शन raster layer को **active ingredient rates और product rates** के बीच correction coefficient का उपयोग करके convert करता है।

The `corrected_coefficient` एक single **float** (सभी pixels पर लागू) या coefficient **matrix** (per-pixel conversion) हो सकता है। इसका उपयोग आमतौर पर निकाली गई nutrient requirement (active ingredient) को fertilizer composition या nutrient concentration के आधार पर actual product application rates में, या इसके उलट, बदलने के लिए किया जाता है।

यह conversion pixel-wise लागू होता है, जिससे original layer की spatial structure बनी रहती है।

**सामान्य उपयोग के मामले**

* nutrient rates को fertilizer product rates में बदलना
* nutrient concentration के आधार पर application maps को समायोजित करना
* machinery के लिए अंतिम prescription maps तैयार करना

### estimate\_texture\_class\_based\_on\_usda

```python
usda_texture = geopard.estimate_texture_class_based_on_usda(
    sand_pct_layer,
    silt_pct_layer,
    clay_pct_layer
)
```

यह फ़ंक्शन sand, silt, और clay percentages का उपयोग करके हर pixel के लिए USDA soil texture का अनुमान लगाता है।

प्रतिशत (0-100) में तीन raster layers दें, जो particle-size fractions को दर्शाते हों। Output है <mark style="background-color:green;">USDA class names जैसे</mark> *<mark style="background-color:green;">sand, loamy\_sand, sandy\_loam, loam, silt\_loam, sandy\_clay\_loam, clay\_loam, silty\_clay\_loam, silty\_clay, या undefined</mark>* <mark style="background-color:green;">जब inputs invalid हों।</mark>

### estimate\_texture\_class\_based\_on\_fao\_wrb

```python
fao_wrb_texture = geopard.estimate_texture_class_based_on_fao_wrb(
    sand_pct_layer,
    silt_pct_layer,
    clay_pct_layer
)
```

यह फ़ंक्शन sand, silt, और clay percentages के आधार पर हर pixel के लिए FAO/WRB (ISO 11277) soil texture class का अनुमान लगाता है।

प्रतिशत (0-100) में तीन raster layers दें, जो particle-size fractions को दर्शाते हों। Output है <mark style="background-color:green;">FAO/WRB class codes जैसे</mark> *<mark style="background-color:green;">S, LS, SL, L, SiL, Si, SCL, CL, SiCL, SC, SiC, C, HC, या undefined</mark>* <mark style="background-color:green;">जब inputs invalid हों</mark>.

### calculate\_soil\_bulk\_density

```python
bulk_density = geopard.calculate_soil_bulk_density(texture_class_layer, som_pct_layer)
```

यह फ़ंक्शन गणना करता है <mark style="background-color:green;">soil bulk density (g/cm³), जो texture class और optional soil organic matter (SOM) पर आधारित होती है</mark>.

The `texture_class_layer` में class names या codes होने चाहिए, जो [USDA texture function](#estimate_texture_class_based_on_usda) या [FAO/WRB texture function](#estimate_texture_class_based_on_fao_wrb) से ऊपर बताए अनुसार प्राप्त हुए हों।

यदि `som_pct_layer` को प्रतिशत मान के रूप में दिया गया है, तो यह फ़ंक्शन SOM के आधार पर bulk density को समायोजित करता है। अन्यथा, यह USDA या FAO/WRB lookup के अनुसार texture classes से जुड़ी soil bulk density values g/cm³ में लौटाता है।


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.geopard.tech/geopard-tutorials/in/product-tour-web-app/equation-based-analytics/catalog-of-custom-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
