Skip to content

Commit

Permalink
Minor color palette changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Divyansh8321 committed Mar 25, 2024
1 parent 2fdea17 commit ae68865
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 131 deletions.
Binary file modified .DS_Store
Binary file not shown.
22 changes: 11 additions & 11 deletions .ipynb_checkpoints/UI-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "336254f7",
"metadata": {},
"source": [
"### This notebook is created for users to be able to use the tool easily without running the backend code. However we request you to please check out the Functions.ipynb and Sample_Use.ipynb to get an idea on the total range of outputs. We also have an Accessing_and_Visualising.ipynb to access and visualise the downloaded data from this ntoebook."
"### This notebook is created for users to be able to use the tool easily without running the backend code. However we request you to please check out the Functions.ipynb and Sample_Use.ipynb to get an idea on the total range of outputs. We also have an Accessing_and_Visualising.ipynb to access and visualise the downloaded data from this notebook."
]
},
{
Expand All @@ -27,7 +27,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"id": "56f9fc95",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -84,7 +84,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2323a2695e6f4eaa9851905c90d23a9c",
"model_id": "778edab631194b0fb2da141c5c5f888c",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -184,7 +184,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a8c370a651db44aeae7781ef92e01951",
"model_id": "6623bf7fe58f4820815553c3bd9bc556",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -198,7 +198,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d1d2fd916f0d479ab76575b92c5511f4",
"model_id": "9128753b57a442ccae3da7806515a588",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -325,7 +325,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e207c1ac053f4b30baa8b505adf7a85e",
"model_id": "5523fb4fb2174889b16da7779f8e6200",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -412,7 +412,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "efdc74664b9740f8b980967500a41c9f",
"model_id": "8766a688b6c0429f99ca297ac4ecf796",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -510,7 +510,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "79b6af980a38453d9f0c9c25aa2dc4a4",
"model_id": "38051c5d1e2e4320931ac1edfac9b9d7",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -621,9 +621,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "geo_env",
"language": "python",
"name": "python3"
"name": "geo_env"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -635,7 +635,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
142 changes: 47 additions & 95 deletions Accessing_and_Visualising.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 31,
"id": "823c91bf",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -63,7 +63,7 @@
"import plotly.graph_objects as go\n",
"import plotly.io as pio\n",
"import seaborn as sns\n",
"from bokeh.palettes import magma\n",
"from bokeh.palettes import magma , Blues8 , plasma\n",
"\n",
"# Importing required libraries to obtain shapefiles\n",
"import gadm\n",
Expand Down Expand Up @@ -1767,7 +1767,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 32,
"id": "dfe02c88",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -1803,7 +1803,7 @@
" combined_max = array.max().item()\n",
"\n",
" # Create a new color mapper for the raster data\n",
" mapper = LinearColorMapper(palette=bp.viridis(256), low=combined_min, high=combined_max)\n",
" mapper = LinearColorMapper(palette=bp.Blues8, low=combined_min, high=combined_max)\n",
"\n",
"\n",
" # Create a Bokeh figure\n",
Expand All @@ -1829,7 +1829,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 33,
"id": "2611cb9e-03d8-4bb6-aed2-704c74d6851c",
"metadata": {},
"outputs": [],
Expand All @@ -1855,7 +1855,7 @@
" combined_min = non_zero_array.min().item() if non_zero_array.size > 0 else array.min().item()\n",
" combined_max = array.max().item()\n",
"\n",
" palette = magma(256) # Using the Magma palette, or choose another\n",
" palette = plasma(256) # Using the Magma palette, or choose another\n",
"\n",
" mapper = LinearColorMapper(palette=palette, low=combined_min, high=combined_max)\n",
"\n",
Expand Down
15 changes: 7 additions & 8 deletions Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# ## Loading all the CSVs containing the required raster files

# In[1]:
# In[31]:


# Importing a few important libraries essential to the work.
Expand Down Expand Up @@ -42,7 +42,7 @@
import plotly.graph_objects as go
import plotly.io as pio
import seaborn as sns
from bokeh.palettes import magma
from bokeh.palettes import magma , Blues8 , plasma

# Importing required libraries to obtain shapefiles
import gadm
Expand Down Expand Up @@ -1465,7 +1465,7 @@ def get_total_biomass_potential(shapefile, time_period, climate_model, rcp, wate

# ### Functions to visualize the raster with pixel values shown & to display the crop selected int eh case of marginal lands

# In[11]:
# In[32]:


# Assuming the rest of your code remains the same
Expand Down Expand Up @@ -1499,7 +1499,7 @@ def bokeh_plot(shapefile, array ):
combined_max = array.max().item()

# Create a new color mapper for the raster data
mapper = LinearColorMapper(palette=bp.viridis(256), low=combined_min, high=combined_max)
mapper = LinearColorMapper(palette=bp.Blues8, low=combined_min, high=combined_max)


# Create a Bokeh figure
Expand All @@ -1523,7 +1523,7 @@ def bokeh_plot(shapefile, array ):
bpl.show(p)


# In[14]:
# In[33]:


def bokeh_max_min_plot(shapefile, array):
Expand All @@ -1547,7 +1547,7 @@ def bokeh_max_min_plot(shapefile, array):
combined_min = non_zero_array.min().item() if non_zero_array.size > 0 else array.min().item()
combined_max = array.max().item()

palette = magma(256) # Using the Magma palette, or choose another
palette = plasma(256) # Using the Magma palette, or choose another

mapper = LinearColorMapper(palette=palette, low=combined_min, high=combined_max)

Expand All @@ -1565,7 +1565,7 @@ def bokeh_max_min_plot(shapefile, array):
bpl.show(p)


# In[28]:
# In[30]:


def crop_show(crop_array,shapefile):
Expand Down Expand Up @@ -1617,7 +1617,6 @@ def crop_show(crop_array,shapefile):
# Plot the shapefile boundary
shapefile.plot(ax=ax, facecolor='none', edgecolor='black')

# Adjust legend_patches to include 'None'
legend_patches = [mpatches.Patch(color=cmap(i), label=crop) for crop, i in crop_indices.items()]
plt.legend(handles=legend_patches, bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)

Expand Down
Binary file not shown.
Binary file not shown.
22 changes: 11 additions & 11 deletions UI.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "336254f7",
"metadata": {},
"source": [
"### This notebook is created for users to be able to use the tool easily without running the backend code. However we request you to please check out the Functions.ipynb and Sample_Use.ipynb to get an idea on the total range of outputs. We also have an Accessing_and_Visualising.ipynb to access and visualise the downloaded data from this ntoebook."
"### This notebook is created for users to be able to use the tool easily without running the backend code. However we request you to please check out the Functions.ipynb and Sample_Use.ipynb to get an idea on the total range of outputs. We also have an Accessing_and_Visualising.ipynb to access and visualise the downloaded data from this notebook."
]
},
{
Expand All @@ -27,7 +27,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"id": "56f9fc95",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -84,7 +84,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2323a2695e6f4eaa9851905c90d23a9c",
"model_id": "affb8617aad447d6bfa4fe869dbf0d01",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -184,7 +184,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a8c370a651db44aeae7781ef92e01951",
"model_id": "6623bf7fe58f4820815553c3bd9bc556",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -198,7 +198,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d1d2fd916f0d479ab76575b92c5511f4",
"model_id": "9128753b57a442ccae3da7806515a588",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -325,7 +325,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e207c1ac053f4b30baa8b505adf7a85e",
"model_id": "5523fb4fb2174889b16da7779f8e6200",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -412,7 +412,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "efdc74664b9740f8b980967500a41c9f",
"model_id": "8766a688b6c0429f99ca297ac4ecf796",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -510,7 +510,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "79b6af980a38453d9f0c9c25aa2dc4a4",
"model_id": "38051c5d1e2e4320931ac1edfac9b9d7",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -621,9 +621,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "geo_env",
"language": "python",
"name": "python3"
"name": "geo_env"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -635,7 +635,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
Binary file modified __pycache__/Functions.cpython-311.pyc
Binary file not shown.

0 comments on commit ae68865

Please sign in to comment.