{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":91448,"databundleVersionId":11249847,"isSourceIdPinned":false,"sourceType":"competition"}],"dockerImageVersionId":30407,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# FungiCLEF25 GeoData","metadata":{"papermill":{"duration":0.004571,"end_time":"2023-03-16T10:11:47.202301","exception":false,"start_time":"2023-03-16T10:11:47.19773","status":"completed"},"tags":[]}},{"cell_type":"code","source":"import geopandas as gpd\nfrom geopandas import GeoDataFrame\nfrom shapely.geometry import Point\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt","metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","papermill":{"duration":0.733799,"end_time":"2023-03-16T10:11:47.939946","exception":false,"start_time":"2023-03-16T10:11:47.206147","status":"completed"},"tags":[],"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T04:19:55.325728Z","iopub.execute_input":"2025-03-11T04:19:55.326237Z","iopub.status.idle":"2025-03-11T04:19:55.332064Z","shell.execute_reply.started":"2025-03-11T04:19:55.32621Z","shell.execute_reply":"2025-03-11T04:19:55.330818Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df = pd.read_csv('/kaggle/input/fungi-clef-2025/metadata/FungiTastic-FewShot/FungiTastic-FewShot-Train.csv')\ndisplay(df[0:2].T)","metadata":{"papermill":{"duration":0.158635,"end_time":"2023-03-16T10:11:48.102075","exception":false,"start_time":"2023-03-16T10:11:47.94344","status":"completed"},"tags":[],"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T04:19:55.33373Z","iopub.execute_input":"2025-03-11T04:19:55.334182Z","iopub.status.idle":"2025-03-11T04:19:55.430538Z","shell.execute_reply.started":"2025-03-11T04:19:55.334155Z","shell.execute_reply":"2025-03-11T04:19:55.429486Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df2=df[['latitude','longitude','species']]\nprint(len(df2))\n\ndf3 = df2[df2['latitude']!='None'][df2['longitude']!='None']\nprint(len(df3))\n\ndf3['latitude']=df3['latitude'].astype(float)\ndf3['longitude']=df3['longitude'].astype(float)\n\ndisplay(df3.info())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T04:19:55.431588Z","iopub.execute_input":"2025-03-11T04:19:55.431883Z","iopub.status.idle":"2025-03-11T04:19:55.460419Z","shell.execute_reply.started":"2025-03-11T04:19:55.431858Z","shell.execute_reply":"2025-03-11T04:19:55.459541Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"names = df3['species'].unique().tolist()\nprint(len(names))\nnames.sort()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T04:19:55.461408Z","iopub.execute_input":"2025-03-11T04:19:55.461643Z","iopub.status.idle":"2025-03-11T04:19:55.468034Z","shell.execute_reply.started":"2025-03-11T04:19:55.46162Z","shell.execute_reply":"2025-03-11T04:19:55.466746Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"name_df=names.copy()\nfor i,name in enumerate(names):\n    name_df[i]=df3[df3['species']==name].reset_index(drop=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T04:19:55.470697Z","iopub.execute_input":"2025-03-11T04:19:55.471278Z","iopub.status.idle":"2025-03-11T04:19:55.782353Z","shell.execute_reply.started":"2025-03-11T04:19:55.471243Z","shell.execute_reply":"2025-03-11T04:19:55.781341Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"geometry = [Point(xy) for xy in zip(df3['longitude'], df3['latitude'])]\ngdf = GeoDataFrame(df3, geometry = geometry)\nworld = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))\ngdf.plot(ax=world.plot(figsize=(12,12)), color='orange', markersize=10)\nplt.title('All')\nplt.show()","metadata":{"papermill":{"duration":3.223819,"end_time":"2023-03-16T10:11:52.279741","exception":false,"start_time":"2023-03-16T10:11:49.055922","status":"completed"},"tags":[],"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T04:19:55.783548Z","iopub.execute_input":"2025-03-11T04:19:55.783931Z","iopub.status.idle":"2025-03-11T04:19:59.523444Z","shell.execute_reply.started":"2025-03-11T04:19:55.783898Z","shell.execute_reply":"2025-03-11T04:19:59.522084Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"for i in range(len(names)):\n    datai=name_df[i]\n    name=names[i]\n    geometry = [Point(xy) for xy in zip(datai['longitude'], datai['latitude'])]\n    gdf = GeoDataFrame(datai, geometry = geometry)\n    world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))\n    gdf.plot(ax=world.plot(figsize=(12,12)), color='orange', markersize=15)\n    plt.title(name)\n    plt.show()","metadata":{"papermill":{"duration":0.006013,"end_time":"2023-03-16T10:11:52.292832","exception":false,"start_time":"2023-03-16T10:11:52.286819","status":"completed"},"tags":[],"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T04:19:59.525137Z","iopub.execute_input":"2025-03-11T04:19:59.525448Z","iopub.status.idle":"2025-03-11T04:21:03.242024Z","shell.execute_reply.started":"2025-03-11T04:19:59.525415Z","shell.execute_reply":"2025-03-11T04:21:03.241023Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"papermill":{"duration":0.005654,"end_time":"2023-03-16T10:11:52.304712","exception":false,"start_time":"2023-03-16T10:11:52.299058","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"papermill":{"duration":0.005664,"end_time":"2023-03-16T10:11:52.316436","exception":false,"start_time":"2023-03-16T10:11:52.310772","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null}]}