You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
6.5 KiB
167 lines
6.5 KiB
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# ਗ੍ਰੋਇੰਗ ਡਿਗਰੀ ਡੇਜ਼\n",
|
|
"\n",
|
|
"ਇਹ ਨੋਟਬੁੱਕ ਇੱਕ CSV ਫਾਈਲ ਵਿੱਚ ਸੇਵ ਕੀਤੇ ਗਏ ਤਾਪਮਾਨ ਡਾਟਾ ਨੂੰ ਲੋਡ ਕਰਦੀ ਹੈ ਅਤੇ ਇਸ ਦਾ ਵਿਸ਼ਲੇਸ਼ਣ ਕਰਦੀ ਹੈ। ਇਹ ਤਾਪਮਾਨਾਂ ਨੂੰ ਪਲਾਟ ਕਰਦੀ ਹੈ, ਹਰ ਦਿਨ ਲਈ ਸਭ ਤੋਂ ਉੱਚੀ ਅਤੇ ਸਭ ਤੋਂ ਘੱਟ ਮੁੱਲ ਦਿਖਾਉਂਦੀ ਹੈ, ਅਤੇ GDD ਦੀ ਗਿਣਤੀ ਕਰਦੀ ਹੈ।\n",
|
|
"\n",
|
|
"ਇਸ ਨੋਟਬੁੱਕ ਨੂੰ ਵਰਤਣ ਲਈ:\n",
|
|
"\n",
|
|
"* `temperature.csv` ਫਾਈਲ ਨੂੰ ਇਸ ਨੋਟਬੁੱਕ ਦੇ ਨਾਲੇ ਵਾਲੇ ਫੋਲਡਰ ਵਿੱਚ ਕਾਪੀ ਕਰੋ\n",
|
|
"* ਉੱਪਰ ਦਿੱਤੇ **▶︎ ਰਨ** ਬਟਨ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਸਾਰੀਆਂ ਸੈੱਲਾਂ ਚਲਾਓ। ਇਹ ਚੁਣੀ ਗਈ ਸੈੱਲ ਨੂੰ ਚਲਾਏਗਾ ਅਤੇ ਫਿਰ ਅਗਲੀ ਸੈੱਲ ਤੇ ਜਾਵੇਗਾ।\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"ਪੌਦੇ ਦੇ ਮੂਲ ਤਾਪਮਾਨ ਨੂੰ ਸੈਟ ਕਰਨ ਲਈ ਹੇਠਾਂ ਦਿੱਤੇ ਸੈੱਲ ਵਿੱਚ `base_temperature` ਸੈਟ ਕਰੋ।\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"base_temperature = 10"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"CSV ਫਾਈਲ ਹੁਣ pandas ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਲੋਡ ਕੀਤੀ ਜਾਣੀ ਚਾਹੀਦੀ ਹੈ।\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import pandas as pd\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"\n",
|
|
"# Read the temperature CSV file\n",
|
|
"df = pd.read_csv('temperature.csv')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"plt.figure(figsize=(20, 10))\n",
|
|
"plt.plot(df['date'], df['temperature'])\n",
|
|
"plt.xticks(rotation='vertical');"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"ਜਦੋਂ ਡਾਟਾ ਪੜ੍ਹ ਲਿਆ ਜਾਂਦਾ ਹੈ, ਇਸਨੂੰ `date` ਕਾਲਮ ਦੁਆਰਾ ਸਮੂਹਬੱਧ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ, ਅਤੇ ਹਰ ਤਾਰੀਖ ਲਈ ਘੱਟੋ-ਘੱਟ ਅਤੇ ਵੱਧ ਤੋਂ ਵੱਧ ਤਾਪਮਾਨ ਨਿਕਾਲੇ ਜਾ ਸਕਦੇ ਹਨ।\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Convert datetimes to pure dates so we can group by the date\n",
|
|
"df['date'] = pd.to_datetime(df['date']).dt.date\n",
|
|
"\n",
|
|
"# Group the data by date so it can be analyzed by date\n",
|
|
"data_by_date = df.groupby('date')\n",
|
|
"\n",
|
|
"# Get the minimum and maximum temperatures for each date\n",
|
|
"min_by_date = data_by_date.min()\n",
|
|
"max_by_date = data_by_date.max()\n",
|
|
"\n",
|
|
"# Join the min and max temperatures into one dataframe and flatten it\n",
|
|
"min_max_by_date = min_by_date.join(max_by_date, on='date', lsuffix='_min', rsuffix='_max')\n",
|
|
"min_max_by_date = min_max_by_date.reset_index()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"GDD ਨੂੰ ਮਿਆਰ GDD ਸਮੀਕਰਨ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਗਣਨਾ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def calculate_gdd(row):\n",
|
|
" return ((row['temperature_max'] + row['temperature_min']) / 2) - base_temperature\n",
|
|
"\n",
|
|
"# Calculate the GDD for each row\n",
|
|
"min_max_by_date['gdd'] = min_max_by_date.apply (lambda row: calculate_gdd(row), axis=1)\n",
|
|
"\n",
|
|
"# Print the results\n",
|
|
"print(min_max_by_date[['date', 'gdd']].to_string(index=False))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"\n---\n\n**ਅਸਵੀਕਰਤੀ**: \nਇਹ ਦਸਤਾਵੇਜ਼ AI ਅਨੁਵਾਦ ਸੇਵਾ [Co-op Translator](https://github.com/Azure/co-op-translator) ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਅਨੁਵਾਦ ਕੀਤਾ ਗਿਆ ਹੈ। ਹਾਲਾਂਕਿ ਅਸੀਂ ਸਹੀ ਹੋਣ ਦੀ ਕੋਸ਼ਿਸ਼ ਕਰਦੇ ਹਾਂ, ਕਿਰਪਾ ਕਰਕੇ ਧਿਆਨ ਦਿਓ ਕਿ ਸਵੈਚਾਲਿਤ ਅਨੁਵਾਦਾਂ ਵਿੱਚ ਗਲਤੀਆਂ ਜਾਂ ਅਸੁਚੀਤਤਾਵਾਂ ਹੋ ਸਕਦੀਆਂ ਹਨ। ਮੂਲ ਦਸਤਾਵੇਜ਼ ਨੂੰ ਇਸਦੀ ਮੂਲ ਭਾਸ਼ਾ ਵਿੱਚ ਅਧਿਕਾਰਤ ਸਰੋਤ ਮੰਨਿਆ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ। ਮਹੱਤਵਪੂਰਨ ਜਾਣਕਾਰੀ ਲਈ, ਪੇਸ਼ੇਵਰ ਮਨੁੱਖੀ ਅਨੁਵਾਦ ਦੀ ਸਿਫਾਰਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। ਇਸ ਅਨੁਵਾਦ ਦੀ ਵਰਤੋਂ ਤੋਂ ਪੈਦਾ ਹੋਣ ਵਾਲੇ ਕਿਸੇ ਵੀ ਗਲਤਫਹਿਮੀ ਜਾਂ ਗਲਤ ਵਿਆਖਿਆ ਲਈ ਅਸੀਂ ਜ਼ਿੰਮੇਵਾਰ ਨਹੀਂ ਹਾਂ।\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.9.1"
|
|
},
|
|
"metadata": {
|
|
"interpreter": {
|
|
"hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
|
|
}
|
|
},
|
|
"coopTranslator": {
|
|
"original_hash": "8fcf954f6042f0bf3601a2c836a09574",
|
|
"translation_date": "2025-08-27T15:08:18+00:00",
|
|
"source_file": "2-farm/lessons/1-predict-plant-growth/code-notebook/gdd.ipynb",
|
|
"language_code": "pa"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
} |