{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,4,5]],"date-time":"2026-04-05T09:45:01Z","timestamp":1775382301429,"version":"3.50.1"},"reference-count":63,"publisher":"MDPI AG","issue":"7","license":[{"start":{"date-parts":[[2022,7,19]],"date-time":"2022-07-19T00:00:00Z","timestamp":1658188800000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"DOI":"10.13039\/501100004837","name":"Spanish Ministry of Science and Innovation","doi-asserted-by":"publisher","award":["PID2020-114381GB-100"],"award-info":[{"award-number":["PID2020-114381GB-100"]}],"id":[{"id":"10.13039\/501100004837","id-type":"DOI","asserted-by":"publisher"}]},{"name":"Research Groups and Projects of the Generalitat Valenciana","award":["PID2020-114381GB-100"],"award-info":[{"award-number":["PID2020-114381GB-100"]}]},{"name":"Research Groups FQM-343 and RNM-188","award":["PID2020-114381GB-100"],"award-info":[{"award-number":["PID2020-114381GB-100"]}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["JMSE"],"abstract":"<jats:p>The k-nearest neighbors (KNN) algorithm is a non-parametric supervised machine learning classifier; which uses proximity and similarity to make classifications or predictions about the grouping of an individual data point. This ability makes the KNN algorithm ideal for classifying datasets of geological variables and parameters prior to 3D visualization. This paper introduces a machine learning KNN algorithm and Python libraries for visualizing the 3D stratigraphic architecture of sedimentary porous media in the Quaternary onshore Llobregat River Delta (LRD) in northeastern Spain. A first HTML model showed a consecutive 5 m-equispaced set of horizontal sections of the granulometry classes created with the KNN algorithm from 0 to 120 m below sea level in the onshore LRD. A second HTML model showed the 3D mapping of the main Quaternary gravel and coarse sand sedimentary bodies (lithosomes) and the basement (Pliocene and older rocks) top surface created with Python libraries. These results reproduce well the complex sedimentary structure of the LRD reported in recent scientific publications and proves the suitability of the KNN algorithm and Python libraries for visualizing the 3D stratigraphic structure of sedimentary porous media, which is a crucial stage in making decisions in different environmental and economic geology disciplines.<\/jats:p>","DOI":"10.3390\/jmse10070986","type":"journal-article","created":{"date-parts":[[2022,7,19]],"date-time":"2022-07-19T23:10:22Z","timestamp":1658272222000},"page":"986","update-policy":"https:\/\/doi.org\/10.3390\/mdpi_crossmark_policy","source":"Crossref","is-referenced-by-count":14,"title":["A K-Nearest Neighbors Algorithm in Python for Visualizing the 3D Stratigraphic Architecture of the Llobregat River Delta in NE Spain"],"prefix":"10.3390","volume":"10","author":[{"ORCID":"https:\/\/orcid.org\/0000-0001-6914-8052","authenticated-orcid":false,"given":"Manuel","family":"Bullejos","sequence":"first","affiliation":[{"name":"Departamento de \u00c1lgebra, University of Granada, 18010 Granada, Spain"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-7823-6756","authenticated-orcid":false,"given":"David","family":"Cabezas","sequence":"additional","affiliation":[{"name":"Departamento de An\u00e1lisis Matem\u00e1tico, University of Granada, 18010 Granada, Spain"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-5797-9892","authenticated-orcid":false,"given":"Manuel","family":"Mart\u00edn-Mart\u00edn","sequence":"additional","affiliation":[{"name":"Departamento de Ciencias de la Tierra y Medio Ambiente, University of Alicante, 03080 Alicante, Spain"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-8165-8669","authenticated-orcid":false,"given":"Francisco Javier","family":"Alcal\u00e1","sequence":"additional","affiliation":[{"name":"Departamento de Desertificaci\u00f3n y Geo-Ecolog\u00eda, Estaci\u00f3n Experimental de Zonas \u00c1ridas (EEZA\u2013CSIC), 04120 Almeria, Spain"},{"name":"Instituto de Ciencias Qu\u00edmicas Aplicadas, Facultad de Ingenier\u00eda, Universidad Aut\u00f3noma de Chile, Santiago 7500138, Chile"}]}],"member":"1968","published-online":{"date-parts":[[2022,7,19]]},"reference":[{"key":"ref_1","doi-asserted-by":"crossref","first-page":"455","DOI":"10.1016\/S0098-3004(00)00142-4","article-title":"Three-dimensional geological modelling of potential-field data","volume":"27","author":"Jessell","year":"2001","journal-title":"Comput. Geosci."},{"key":"ref_2","doi-asserted-by":"crossref","first-page":"165","DOI":"10.1016\/j.cageo.2007.09.001","article-title":"High-resolution 3D spatial modelling of complex geological structures for an environmental risk assessment of abundant mining and industrial megasites","volume":"35","author":"Wycisk","year":"2009","journal-title":"Comput. Geosci."},{"key":"ref_3","first-page":"205","article-title":"Geological 3D modelling: Scientific discovery and enhanced understanding of the subsurface, with examples from the UK","volume":"161","author":"Ford","year":"2010","journal-title":"Z. Dtsch. Ges. Geowiss."},{"key":"ref_4","doi-asserted-by":"crossref","unstructured":"Rohmer, O., Bertrand, E., Mercerat, E.D., R\u00e9gnier, J., Pernoud, M., Langlaude, P., and Alvarez, M. (2020). Combining borehole log-stratigraphies and ambient vibration data to build a 3D Model of the Lower Var Valley, Nice (France). Eng. Geol., 270.","DOI":"10.1016\/j.enggeo.2020.105588"},{"key":"ref_5","unstructured":"(2022, June 09). GemPy: Open-Source 3D Geological Modeling. Available online: https:\/\/www.gempy.org."},{"key":"ref_6","unstructured":"(2022, June 09). OSGeo: The Open Source Geospatial Foundation. Available online: https:\/\/www.osgeo.org\/."},{"key":"ref_7","unstructured":"(2022, June 09). GeoPandas. Available online: https:\/\/geopandas.org\/en\/stable."},{"key":"ref_8","unstructured":"(2022, June 09). Albion: 3D Geological Models in QGIS. Available online: https:\/\/gitlab.com\/Oslandia\/albion."},{"key":"ref_9","unstructured":"GISgeography (2022, June 09). 15 Python Libraries for GIS and Mapping. Available online: https:\/\/gisgeography.com\/python-libraries-gis-mapping."},{"key":"ref_10","unstructured":"Parpoil, B. (2022, June 09). Open Source and Geology. Available online: https:\/\/oslandia.com\/en\/2020\/07\/09\/geologie-open-source."},{"key":"ref_11","doi-asserted-by":"crossref","first-page":"28","DOI":"10.1109\/MCG.2006.94","article-title":"Web-based visualization of 3D geospatial data using Java3D","volume":"26","author":"Hobona","year":"2006","journal-title":"IEEE Comput. Graph. Appl."},{"key":"ref_12","doi-asserted-by":"crossref","first-page":"200","DOI":"10.1016\/j.cageo.2017.11.007","article-title":"3D geospatial visualizations: Animation and motion effects on spatial objects","volume":"111","author":"Evangelidis","year":"2018","journal-title":"Comput. Geosci."},{"key":"ref_13","doi-asserted-by":"crossref","first-page":"95","DOI":"10.1080\/00087041.2015.1119462","article-title":"Cartography-oriented design of 3D geospatial information visualization\u2013overview and techniques","volume":"52","author":"Semmo","year":"2015","journal-title":"Cartogr. J."},{"key":"ref_14","first-page":"1","article-title":"3D Geographic Scenes Visualization Based on WebGL","volume":"Volume 1","author":"Miao","year":"2017","journal-title":"Proceedings of the 6th International Conference on Agro-Geoinformatics, Fairfax, VA, USA, 7\u201310 August 2017"},{"key":"ref_15","unstructured":"Pyrcz, M. (2022, June 09). GeostatsGuy Lectures. Available online: https:\/\/www.youtube.com\/c\/GeostatsGuyLectures."},{"key":"ref_16","doi-asserted-by":"crossref","unstructured":"Bullejos, M., Cabezas, D., Mart\u00edn-Mart\u00edn, M., and Alcal\u00e1, F.J. (2022). A Python Application for Visualizing the 3D Stratigraphic Architecture of the Onshore Llobregat River Delta in NE Spain. Water, 14, Available online: https:\/\/www.mdpi.com\/2073-4441\/14\/12\/1882.","DOI":"10.3390\/w14121882"},{"key":"ref_17","first-page":"436","article-title":"Seawater intrusion in the Llobregat Delta near Barcelona (Catalonia, Spain)","volume":"Volume 45","author":"Custodio","year":"1987","journal-title":"Groundwater Problems in the Coastal Areas, Studies and Reports in Hydrology"},{"key":"ref_18","unstructured":"Medialdea, J., and Sol\u00e9-Sabar\u00eds, L. (1991). Geological Map of Spain, Scale 1:50,000, Sheet n\u00b0 448. El Prat de Llobregat, Memory and Maps, Geological Survey of Spain. Available online: http:\/\/info.igme.es\/cartografiadigital\/geologica\/Magna50Hoja.aspx?language=es&id=448."},{"key":"ref_19","unstructured":"Alonso, F., Pe\u00f3n, A., Rosell, J., Arrufat, J., and Obrador, A. (1974). Geological Map of Spain, Scale 1:50,000, Sheet n\u00b0 421. Barcelona, Memory and Maps, Geological Survey of Spain. Available online: http:\/\/info.igme.es\/cartografiadigital\/geologica\/Magna50Hoja.aspx?language=es&id=421."},{"key":"ref_20","doi-asserted-by":"crossref","first-page":"65","DOI":"10.1016\/j.sedgeo.2009.03.007","article-title":"Onshore\u2013offshore correlation of the Llobregat deltaic system, Spain: Development of deltaic geometries under different relative sea-level and growth fault influences","volume":"217","author":"Lobo","year":"2009","journal-title":"Sediment. Geol."},{"key":"ref_21","unstructured":"Almera, J. (2022, April 18). Mapa Geol\u00f3gico y Topogr\u00e1fico De La Provincia De Barcelona: Regi\u00f3n Primera o De Contornos de la Capital Detallada, Scale 1:40,000, Memory and Maps, Diputaci\u00f3n de Barcelona, Barcelona. Available online: https:\/\/cartotecadigital.icgc.cat\/digital\/collection\/catalunya\/id\/2174."},{"key":"ref_22","doi-asserted-by":"crossref","unstructured":"Abarca, E., V\u00e1zquez-Su\u00f1\u00e9, E., Carrera, J., Capino, B., G\u00e1mez, D., and Batlle, F. (2006). Optimal design of measures to correct seawater intrusion. Water Resour. Res., 42.","DOI":"10.1029\/2005WR004524"},{"key":"ref_23","doi-asserted-by":"crossref","first-page":"1015","DOI":"10.1016\/j.pce.2006.07.008","article-title":"Groundwater modelling as a tool for the European Water Framework Directive (WFD) application: The Llobregat case","volume":"31","author":"Abarca","year":"2006","journal-title":"Phys. Chem. Earth"},{"key":"ref_24","doi-asserted-by":"crossref","unstructured":"Postigo, C., Ginebreda, A., Barbieri, M.V., Barcel\u00f3, D., Mart\u00edn-Alonso, J., de la Cal, A., Boleda, M.R., Otero, N., Carrey, R., and Sol\u00e0, V. (2021). Investigative monitoring of pesticide and nitrogen pollution sources in a complex multi-stressed catchment: The lower Llobregat River basin case study (Barcelona, Spain). Sci. Total Environ., 755.","DOI":"10.1016\/j.scitotenv.2020.142377"},{"key":"ref_25","unstructured":"(1994). Resolution 12956\/1994. Cooperation Agreement on Infrastructure and Environment in the Llobregat Delta. Official Journal of Spain, Government of Spain. Available online: https:\/\/www.boe.es\/diario_boe\/txt.php?id=BOE-A-1994-12956."},{"key":"ref_26","unstructured":"(2004). Official Statement. The Water Authority of Catalonia Creates the Technical Unit of the Llobregat Aquifers. Official Journal of Catalonia, Department of the Environment and Housing, Government of Catalonia. Available online: https:\/\/govern.cat\/salapremsa\/notes-premsa\/68710\/agencia-catalana-aigua-crea-mesa-tecnica-dels-aqueifers-del-llobregat."},{"key":"ref_27","unstructured":"Medialdea, J., and Sol\u00e9-Sabar\u00eds, L. (1973). Geological Map of Spain, Scale 1:50,000, Sheet n\u00b0 420. Hospitalet de Llobregat, Memory and Maps, Geological Survey of Spain. Available online: http:\/\/info.igme.es\/cartografiadigital\/geologica\/Magna50Hoja.aspx?language=es&id=420."},{"key":"ref_28","first-page":"321","article-title":"Tectomorfolog\u00eda del Macizo del Tibidabo y valle inferior del Llobregat","volume":"3","author":"Llopis","year":"1942","journal-title":"Estud. Geogr."},{"key":"ref_29","first-page":"7","article-title":"Ensayo de interpretaci\u00f3n del Cuaternario Barcelon\u00e9s","volume":"2","year":"1963","journal-title":"Misc. Barcinonensia"},{"key":"ref_30","unstructured":"Marqu\u00e9s, M.A. (1984). Les Formacions Quatern\u00e0ries del Delta del Llobregat, Institut d\u2019Estudis Catalans."},{"key":"ref_31","unstructured":"Manzano, M. (1986). Estudio Sedimentol\u00f3gico del Prodelta Holoceno del Llobregat. [Master\u2019s Thesis, University of Barcelona]."},{"key":"ref_32","unstructured":"IGME (1989). Geological Map of the Spanish Continental Shelf and Adjacent Areas, Scale 1:200,000, Sheet n\u00b0 42E. Barcelona, Memory and Maps, Geological Survey of Spain. Available online: https:\/\/info.igme.es\/cartografiadigital\/tematica\/Fomar200Hoja.aspx?language=es&id=42E."},{"key":"ref_33","unstructured":"IGME (1986). Geological Map of the Spanish Continental Shelf and Adjacent Areas, Scale 1:200,000, Sheet n\u00b0 42. Tarragona, Memory and Maps, Geological Survey of Spain. Available online: https:\/\/info.igme.es\/cartografiadigital\/tematica\/Fomar200Hoja.aspx?language=es&id=42."},{"key":"ref_34","first-page":"49","article-title":"La Plataforma Holocena en el Prodelta del Llobregat","volume":"Volume 2","author":"Obrador","year":"1983","journal-title":"X Congreso Nacional de Sedimentolog\u00eda"},{"key":"ref_35","doi-asserted-by":"crossref","first-page":"226","DOI":"10.1016\/S0022-1694(96)03290-8","article-title":"Inverse modelling of seawater intrusion in the Llobregat delta deep aquifer","volume":"198","author":"Iribar","year":"1997","journal-title":"J. Hydrol."},{"key":"ref_36","first-page":"42","article-title":"Sobre la intrusi\u00f3n marina en el sector oriental del acu\u00edfero profundo del delta del Llobregat (Barcelona, Espa\u00f1a). Breve descripci\u00f3n hist\u00f3rica y evoluci\u00f3n actual","volume":"97","year":"2002","journal-title":"Bol. Real Soc. Espa\u00f1ola Hist. Nat."},{"key":"ref_37","first-page":"45","article-title":"Actualizaci\u00f3n Geol\u00f3gica del Delta del Llobregat (Barcelona, Espa\u00f1a). Implicaciones Geol\u00f3gicas e Hidrogeol\u00f3gicas","volume":"Volume 1","author":"Ramos","year":"2003","journal-title":"Tecnolog\u00eda de la Intrusi\u00f3n de Agua de Mar en Acu\u00edferos Costeros: Pa\u00edses Mediterr\u00e1neos"},{"key":"ref_38","first-page":"23","article-title":"Caracter\u00edsticas estructurales y estratigr\u00e1ficas del substrato Plioceno del Delta de Llobregat (Barcelona, Espa\u00f1a)\u2014Aplicaci\u00f3n a los estudios hidrogeol\u00f3gicos","volume":"5","year":"2003","journal-title":"Rev. Geotemas"},{"key":"ref_39","first-page":"171","article-title":"Arquitectura de facies de los deltas cuaternarios del r\u00edo Llobregat, Barcelona, Espa\u00f1a","volume":"38","author":"Salvany","year":"2005","journal-title":"Geogaceta"},{"key":"ref_40","first-page":"483","article-title":"Circulaci\u00f3n marina en la plataforma continental del Ebro determinada a partir de la distribuci\u00f3n de masas de agua y los microcontaminantes org\u00e1nicos en el sedimento","volume":"21","author":"Font","year":"1987","journal-title":"Acta Geol. Hisp."},{"key":"ref_41","doi-asserted-by":"crossref","first-page":"195","DOI":"10.1016\/S0037-0738(97)00035-3","article-title":"Stratal architecture of Western Mediterranean Margins as the result of the stacking of Quaternary lowstand deposits below \u2018glacio-eustatic fluctuation base-level\u2019","volume":"112","author":"Chiocci","year":"1997","journal-title":"Sediment. Geol."},{"key":"ref_42","unstructured":"Alcal\u00e1, F.J., Mart\u00edn-Mart\u00edn, M., and Garc\u00eda-Ruz, A. (2020). A lithology database from historical 457 boreholes in the Llobregat River Delta aquifers in northeastern Spain. Figshare Dataset."},{"key":"ref_43","unstructured":"(2022, June 09). Python Programming Language. Available online: https:\/\/www.python.org."},{"key":"ref_44","unstructured":"(2022, June 13). Numpy. Available online: https:\/\/numpy.org."},{"key":"ref_45","unstructured":"(2022, June 13). Pandas. Available online: https:\/\/pandas.pydata.org\/."},{"key":"ref_46","unstructured":"(2022, June 09). Plotly. Available online: https:\/\/plotly.com."},{"key":"ref_47","unstructured":"(2022, June 13). Scipy. Available online: https:\/\/scipy.org."},{"key":"ref_48","unstructured":"(2022, June 13). Scikit-learn. Available online: https:\/\/scikit-learn.org\/stable\/install.html#installation-instructions."},{"key":"ref_49","unstructured":"(2022, June 13). GEODOSE. Available online: https:\/\/www.geodose.com\/2019\/09\/3d-terrain-modelling-in-python.html."},{"key":"ref_50","doi-asserted-by":"crossref","first-page":"356","DOI":"10.1016\/j.eswa.2018.08.021","article-title":"A generalized mean distance-based k-nearest neighbor classifier","volume":"115","author":"Gou","year":"2019","journal-title":"Expert Syst. Appl."},{"key":"ref_51","first-page":"538","article-title":"Machine Learning: Using Optimized KNN (K-Nearest Neighbors) to Predict the Facies Classifications","volume":"Volume 1","author":"Pratama","year":"2018","journal-title":"Proceedings of the 13th SEGJ International Symposium, Tokyo, Japan, 12\u201314 November 2018"},{"key":"ref_52","doi-asserted-by":"crossref","first-page":"157","DOI":"10.1016\/j.petrol.2018.03.034","article-title":"Lithology identification using an optimized KNN clustering method based on entropy-weighed co-sine distance in Mesozoic strata of Gaoqing field, Jiyang depression","volume":"166","author":"Wang","year":"2018","journal-title":"J. Pet. Sci. Eng."},{"key":"ref_53","doi-asserted-by":"crossref","unstructured":"Huang, S., Huang, M., and Lyu, Y. (2020). An Improved KNN-Based Slope Stability Prediction Model. Adv. Civ. Eng., 2020.","DOI":"10.1155\/2020\/8894109"},{"key":"ref_54","unstructured":"(2022, June 09). Convex Hull Algorithm. Available online: https:\/\/docs.scipy.org\/doc\/scipy\/reference\/generated\/scipy.spatial.ConvexHull.html."},{"key":"ref_55","first-page":"93","article-title":"Estratigraf\u00eda y petrolog\u00eda del subsuelo precuaternario del sector SW de la depresi\u00f3n de Barcelona (Cadenas Costeras Catalanas, NE de Iberia)","volume":"21","author":"Parcerisa","year":"2008","journal-title":"Rev. Soc. Geol. Espa\u00f1a"},{"key":"ref_56","doi-asserted-by":"crossref","first-page":"1","DOI":"10.1344\/GeologicaActa2020.18.10","article-title":"The Neogene and Quaternary deposits of the Barcelona city through the high-speed train line","volume":"18","author":"Salvany","year":"2020","journal-title":"Geol. Acta"},{"key":"ref_57","doi-asserted-by":"crossref","first-page":"7531","DOI":"10.1038\/s41598-022-11365-8","article-title":"The influence of grain shape and size on the relationship between porosity and permeability in sandstone: A digital approach","volume":"12","author":"Payton","year":"2022","journal-title":"Sci. Rep."},{"key":"ref_58","doi-asserted-by":"crossref","first-page":"739","DOI":"10.1061\/(ASCE)1090-0241(2000)126:8(739)","article-title":"Hydraulic conductivity of soils from grain-size distribution: New models","volume":"126","author":"Boadu","year":"2000","journal-title":"J. Geotech. Geoenviron. Eng."},{"key":"ref_59","doi-asserted-by":"crossref","first-page":"71","DOI":"10.1007\/s11242-013-0262-7","article-title":"Grain shape effects on permeability, formation factor, and capillary pressure from pore-scale modeling","volume":"102","author":"Torskaya","year":"2014","journal-title":"Transp. Porous Media"},{"key":"ref_60","doi-asserted-by":"crossref","first-page":"889","DOI":"10.1007\/s12517-012-0823-z","article-title":"Estimating porosity and permeability using Digital Image Analysis (DIA) technique for highly porous sandstones","volume":"7","author":"Nabawy","year":"2014","journal-title":"Arab. J. Geosci."},{"key":"ref_61","doi-asserted-by":"crossref","first-page":"12","DOI":"10.1016\/S0022-1694(00)00256-0","article-title":"Estimation of hydraulic parameters of shaly sandstone aquifers from geoelectrical measurements","volume":"235","author":"Sri","year":"2000","journal-title":"J. Hydrol."},{"key":"ref_62","doi-asserted-by":"crossref","first-page":"868","DOI":"10.1016\/j.scitotenv.2017.03.210","article-title":"Current uses of ground penetrating radar in groundwater-dependent ecosystems research","volume":"595","author":"Paz","year":"2017","journal-title":"Sci. Total Environ."},{"key":"ref_63","doi-asserted-by":"crossref","first-page":"153","DOI":"10.2113\/JEEG19-039","article-title":"Ground penetrating radar attenuation expressions in shallow groundwater research","volume":"25","author":"Paz","year":"2020","journal-title":"J. Environ. Eng. Geophys."}],"container-title":["Journal of Marine Science and Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.mdpi.com\/2077-1312\/10\/7\/986\/pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,10,10]],"date-time":"2025-10-10T23:53:57Z","timestamp":1760140437000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.mdpi.com\/2077-1312\/10\/7\/986"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2022,7,19]]},"references-count":63,"journal-issue":{"issue":"7","published-online":{"date-parts":[[2022,7]]}},"alternative-id":["jmse10070986"],"URL":"https:\/\/doi.org\/10.3390\/jmse10070986","relation":{},"ISSN":["2077-1312"],"issn-type":[{"value":"2077-1312","type":"electronic"}],"subject":[],"published":{"date-parts":[[2022,7,19]]}}}