PageSourceSearch

https://10code.ai/assets/comparar-clima-CfxKxYs_.js

js 10code.ai collected 2026-10-05 11:47:28 UTC 15,396 bytes, 1 lines download raw bytes

1import{j as e,u as Y}from"./vendor-query-Df_Xbx4p.js";import{c as Q,e as A,r as E,L as C}from"./vendor-router-BHV-2cCT.js";import{a5 as D,m as _,t as k}from"./index-UZ_1qV1X.js";import{c as M}from"./municipio-climate-profiles-CqgceQBR.js";import{G as g}from"./glass-card-848ey6Yv.js";import{S as y}from"./scroll-reveal-BZHUMeV6.js";import{O as P}from"./OdSlot-DbCkcpO4.js";import{g as F,a as T}from"./climate-utils-boIMRWk7.js";import{F as I,p as H,J as U,I as Z,y as ee}from"./vendor-icons-BAVaECHf.js";import{a as B,h as te,C as R,X as q,Y as O,T as W,k as K,L as J,B as ae,e as G}from"./vendor-charts-B2mhFsTX.js";import"./vendor-react-C0Dkio3Y.js";import"./vendor-motion-CdFSgn6J.js";const se={0:"Despejado",1:"Poco nuboso",2:"Parcialmente nuboso",3:"Nublado",45:"Niebla",48:"Niebla engelante",51:"Llovizna",53:"Llovizna moderada",55:"Llovizna intensa",61:"Lluvia ligera",63:"Lluvia moderada",65:"Lluvia intensa",71:"Nieve ligera",73:"Nieve moderada",75:"Nieve intensa",80:"Chubascos",81:"Chubascos moderados",82:"Chubascos intensos",95:"Tormenta",96:"Tormenta con granizo"};function re(n){return se[n]??"Variable"}function ne({day:n,max:o,min:a,code:t}){const l=new Date(n+"T12:00:00"),c=["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"][l.getDay()],m=l.getDate(),i=T[l.getMonth()];return e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-gray-50 last:border-0 gap-2",children:[e.jsxs("div",{className:"w-16 flex-shrink-0",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-700",children:c}),e.jsxs("p",{className:"text-[10px] text-gray-400",children:[m," ",i]})]}),e.jsx("div",{className:"flex-1 text-[10px] text-gray-500 truncate",children:re(t)}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsxs("span",{className:"text-sm font-bold text-[#E65100]",children:[Math.round(o),"°"]}),e.jsxs("span",{className:"text-xs text-gray-400 ml-1",children:[Math.round(a),"°"]})]})]})}function V({name:n,slug:o,lat:a,lon:t}){const{data:l,isLoading:c}=Y({queryKey:["/api/weather/detail",a,t],queryFn:async()=>{const i=await fetch(`/api/weather/detail?lat=${a}&lon=${t}`);if(!i.ok)throw new Error("Weather fetch failed");return i.json()},staleTime:9e5}),m=l?.daily?.time?.slice(0,7)??[];return e.jsxs(g,{intensity:"light",className:"p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(H,{className:"w-4 h-4 text-[#E65100]"}),e.jsxs("h3",{className:"text-base font-bold text-gray-800",children:["Previsión 7 días — ",n]})]}),l?.current?.temperature_2m!=null&&e.jsxs("div",{className:"mb-3 flex items-baseline gap-1",children:[e.jsxs("span",{className:"text-3xl font-extrabold text-gray-800",children:[Math.round(l.current.temperature_2m),"°C"]}),e.jsx("span",{className:"text-sm text-gray-500",children:"ahora"})]}),c?e.jsx("div",{className:"flex items-center justify-center h-20",children:e.jsx("div",{className:"w-5 h-5 border-2 border-[#4CAF50] border-t-transparent rounded-full animate-spin"})}):e.jsx("div",{children:m.map((i,u)=>e.jsx(ne,{day:i,max:l?.daily?.temperature_2m_max?.[u]??0,min:l?.daily?.temperature_2m_min?.[u]??0,code:l?.daily?.weather_code?.[u]??0},i))}),e.jsx(C,{href:`/el-tiempo-en/${o}`,children:e.jsxs("span",{className:"mt-3 inline-flex items-center gap-1 text-xs text-[#2E7D32] font-semibold hover:underline",children:["Ver todo el tiempo en ",n," ",e.jsx(ee,{className:"w-3 h-3"})]})})]})}function X({active:n,payload:o,label:a}){return!n||!o?.length?null:e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg shadow-md px-3 py-2 text-xs",children:[e.jsx("p",{className:"font-semibold text-gray-700 mb-1",children:a}),o.map(t=>e.jsxs("p",{style:{color:t.color},children:[t.name,": ",t.value,t.unit??""]},t.name))]})}function ge(){const{slug1:n,slug2:o}=Q();if(n&&o&&n>o)return e.jsx(A,{to:`/comparar-clima/${o}/${n}`});const a=n?D(n,_):void 0,t=o?D(o,_):void 0;return!a||!t?e.jsx(A,{to:"/el-tiempo-en"}):e.jsx(oe,{slug1:n,slug2:o,muni1:a,muni2:t})}function oe({slug1:n,slug2:o,muni1:a,muni2:t}){const l=M[k(a.nombre)]??M[k(a.provincia)]??null,c=M[k(t.nombre)]??M[k(t.provincia)]??null,m=E.useMemo(()=>l?F(l):[],[l]),i=E.useMemo(()=>c?F(c):[],[c]),u=E.useMemo(()=>T.map((s,r)=>({mes:s,[`temp_${n}`]:m[r]?.temp,[`temp_${o}`]:i[r]?.temp,[`precip_${n}`]:m[r]?.precip,[`precip_${o}`]:i[r]?.precip})),[m,i,n,o]),z=E.useMemo(()=>{const s=[];if(l&&c){const r=+(l.tempMedia-c.tempMedia).toFixed(1),d=r>0?a.nombre:t.nombre,x=r>0?t.nombre:a.nombre,p=Math.abs(r);p>=.5?s.push(`${d} es ${p}°C más cálida en media anual que ${x}. Esto se debe principalmente a diferencias en altitud, proximidad al mar y tipo de clima.`):s.push(`${a.nombre} y ${t.nombre} tienen temperaturas medias anuales muy similares, con apenas ${p}°C de diferencia.`);const h=l.precipitacion-c.precipitacion,b=h>0?a.nombre:t.nombre,w=h>0?t.nombre:a.nombre;if(Math.abs(h)>50&&s.push(`En cuanto a precipitaciones, ${b} recibe unos ${Math.abs(h)} mm más al año que ${w} (${Math.max(l.precipitacion,c.precipitacion)} mm frente a ${Math.min(l.precipitacion,c.precipitacion)} mm anuales).`),m.length&&i.length){const N=(m[6]?.temp??0)-(i[6]?.temp??0);if(Math.abs(N)>=2){const f=N>0?a.nombre:t.nombre;s.push(`En julio, ${f} es ${Math.abs(N)}°C más calurosa.`)}const v=0,$=(m[v]?.temp??0)-(i[v]?.temp??0);if(Math.abs($)>=2){const f=$<0?a.nombre:t.nombre;s.push(`En enero, ${f}
1 tiene inviernos más fríos, con ${Math.abs($)}°C de diferencia.`)}}const L=l.horasSol-c.horasSol;if(Math.abs(L)>100){const j=L>0?a.nombre:t.nombre;s.push(`${j} acumula más horas de sol al año: ${Math.max(l.horasSol,c.horasSol).toLocaleString("es")} h frente a ${Math.min(l.horasSol,c.horasSol).toLocaleString("es")} h.`)}}return s},[l,c,a.nombre,t.nombre,m,i,n,o]),S="https://andalmet.es";return E.useEffect(()=>{const s=`Comparar clima ${a.nombre} vs ${t.nombre} — Andalmet`,r=`Compara el clima de ${a.nombre} y ${t.nombre}: temperatura, precipitación, horas de sol y previsión meteorológica mes a mes.`;document.title=s;const d=document.querySelector('meta[name="description"]');d&&d.setAttribute("content",r);const x=`${S}/comparar-clima/${n}/${o}`;let p=document.querySelector('link[rel="canonical"]');p||(p=document.createElement("link"),p.rel="canonical",document.head.appendChild(p)),p.href=x;const h=document.querySelector('meta[property="og:title"]');h&&h.setAttribute("content",s);const b=document.querySelector('meta[property="og:description"]');b&&b.setAttribute("content",r);const w={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Inicio",item:`${S}/`},{"@type":"ListItem",position:2,name:"Comparar clima",item:`${S}/el-tiempo-en`},{"@type":"ListItem",position:3,name:`${a.nombre} vs ${t.nombre}`,item:x}]},L={"@context":"https://schema.org","@type":"WebPage",name:s,description:r,url:x,inLanguage:"es",isPartOf:{"@type":"WebSite",name:"Andalmet",url:S},breadcrumb:w},j=v=>{document.getElementById(v)?.remove()};j("schema-breadcrumb"),j("schema-webpage");const N=(v,$)=>{const f=document.createElement("script");f.id=v,f.type="application/ld+json",f.textContent=JSON.stringify($),document.head.appendChild(f)};
1return N("schema-breadcrumb",w),N("schema-webpage",L),()=>{j("schema-breadcrumb"),j("schema-webpage")}},[n,o,a.nombre,t.nombre]),e.jsxs("div",{className:"max-w-3xl mx-auto px-4 pt-[calc(var(--hh)+1.5rem)] pb-10 space-y-5",children:[e.jsxs("nav",{className:"flex items-center gap-1 text-xs text-gray-500 flex-wrap",children:[e.jsx(C,{href:"/",children:e.jsx("span",{className:"hover:text-[#2E7D32] cursor-pointer",children:"Inicio"})}),e.jsx(I,{className:"w-3 h-3"}),e.jsx(C,{href:"/el-tiempo-en",children:e.jsx("span",{className:"hover:text-[#2E7D32] cursor-pointer",children:"El tiempo en Andalucía"})}),e.jsx(I,{className:"w-3 h-3"}),e.jsxs("span",{className:"text-gray-700 font-medium",children:[a.nombre," vs ",t.nombre]})]}),e.jsx(y,{children:e.jsxs(g,{intensity:"medium",className:"p-5 sm:p-7",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-extrabold text-gray-900 mb-1",children:["Comparar clima: ",e.jsx("span",{className:"text-[#2E7D32]",children:a.nombre})," ",e.jsx("span",{className:"text-gray-400",children:"vs"})," ",e.jsx("span",{className:"text-[#1565C0]",children:t.nombre})]}),e.jsxs("p",{className:"text-sm text-gray-500 mb-4",children:[a.provincia," · ",t.provincia," — Comparativa climática y previsión meteorológica"]}),(l||c)&&e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{name:a.nombre,profile:l,color:"#2E7D32"},{name:t.nombre,profile:c,color:"#1565C0"}].map(({name:s,profile:r,color:d})=>e.jsxs("div",{className:"rounded-xl border p-3",style:{borderColor:`${d}30`,backgroundColor:`${d}08`},children:[e.jsx("p",{className:"text-xs font-bold mb-1",style:{color:d},children:s}),r?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-gray-600 capitalize mb-1",children:r.tipo}),e.jsxs("div",{className:"flex gap-3 text-xs",children:[e.jsxs("span",{className:"text-gray-700",children:[e.jsxs("span",{className:"font-bold text-sm",children:[r.tempMedia,"°C"]})," media"]}),e.jsxs("span",{className:"text-gray-700",children:[e.jsx("span",{className:"font-bold text-sm",children:r.precipitacion})," mm/año"]})]}),e.jsxs("p",{className:"text-[10px] text-gray-400 mt-1",children:[r.horasSol.toLocaleString("es")," h de sol/año"]})]}):e.jsx("p",{className:"text-xs text-gray-400",children:"Sin perfil climático disponible"})]},s))})]})}),e.jsx(P,{desktop:"Content_1",mobile:"Mobile_Pos1"}),z.length>0&&e.jsx(y,{delay:.05,children:e.jsxs(g,{intensity:"light",className:"p-5",children:[e.jsxs("h2",{className:"text-base font-bold text-gray-900 mb-3",children:["¿Cuál es más cálida: ",a.nombre," o ",t.nombre,"?"]}),e.jsx("div",{className:"space-y-2",children:z.map((s,r)=>e.jsx("p",{className:"text-sm text-gray-700 leading-relaxed",children:s},r))})]})}),m.length>0&&i.length>0&&e.jsx(y,{delay:.06,children:e.jsxs(g,{intensity:"light",className:"p-5",children:[e.jsxs("h2",{className:"text-base font-bold text-gray-900 mb-1 flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-[#E65100]"}),"Temperatura media mensual (°C)"]}),e.jsx("p",{className:"text-xs text-gray-400 mb-4",children:"Comparación mes a mes"}),e.jsx(B,{width:"100%",height:220,children:e.jsxs(te,{data:u,margin:{top:5,right:10,left:0,bottom:0},children:[e.jsx(R,{strokeDasharray:"3 3",stroke:"#f0f0f0",vertical:!1}),e.jsx(q,{dataKey:"mes",tick:{fontSize:10,fill:"#9E9E9E"},axisLine:!1,tickLine:!1}),e.jsx(O,{tick:{fontSize:9,fill:"#9E9E9E"},axisLine:!1,tickLine:!1,tickFormatter:s=>`${s}°`,width:30}),e.jsx(W,{content:e.jsx(X,{})}),e.jsx(K,{wrapperStyle:{fontSize:11}}),e.jsx(J,{type:"monotone",dataKey:`temp_${n}`,name:a.nombre,stroke:"#2E7D32",strokeWidth:2.5,dot:!1,unit:"°C"}),e.jsx(J,{type:"monotone",dataKey:`temp_${o}`,name:t.nombre,stroke:"#1565C0",strokeWidth:2.5,dot:!1,unit:"°C"})]})})]})}),m.length>0&&i.length>0&&e.jsx(P,{desktop:"Content_2",mobile:"Mobile_Pos2"}),m.length>0&&i.length>0&&e.jsx(y,{delay:.07,children:e.jsxs(g,{intensity:"light",className:"p-5",children:[e.jsxs("h2",{className:"text-base font-bold text-gray-900 mb-1 flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4 text-[#1565C0]"}),"Precipitación mensual (mm)"]}),e.jsx("p",{className:"text-xs text-gray-400 mb-4",children:"Comparación mes a mes"}),e.jsx(B,{width:"100%",height:180,children:e.jsxs(ae,{data:u,margin:{top:5,right:10,left:0,bottom:0},children:[e.jsx(R,{strokeDasharray:"3 3",stroke:"#f0f0f0",vertical:!1}),e.jsx(q,{dataKey:"mes",tick:{fontSize:10,fill:"#9E9E9E"}
1,axisLine:!1,tickLine:!1}),e.jsx(O,{tick:{fontSize:9,fill:"#9E9E9E"},axisLine:!1,tickLine:!1,tickFormatter:s=>`${s}mm`,width:38}),e.jsx(W,{content:e.jsx(X,{})}),e.jsx(K,{wrapperStyle:{fontSize:11}}),e.jsx(G,{dataKey:`precip_${n}`,name:a.nombre,fill:"#4CAF5066",stroke:"#2E7D32",strokeWidth:1,radius:[3,3,0,0],maxBarSize:20,unit:"mm"}),e.jsx(G,{dataKey:`precip_${o}`,name:t.nombre,fill:"#1565C066",stroke:"#1565C0",strokeWidth:1,radius:[3,3,0,0],maxBarSize:20,unit:"mm"})]})})]})}),m.length>0&&i.length>0&&e.jsx(y,{delay:.08,children:e.jsxs(g,{intensity:"light",className:"p-5",children:[e.jsxs("h2",{className:"text-base font-bold text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(Z,{className:"w-4 h-4 text-[#FF9800]"}),"Tabla comparativa mensual"]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-gray-400",children:[e.jsx("th",{className:"text-left py-1 pr-2 font-medium",children:"Mes"}),e.jsxs("th",{className:"text-right py-1 px-1 font-medium",style:{color:"#2E7D32"},children:["Temp ",a.nombre]}),e.jsxs("th",{className:"text-right py-1 px-1 font-medium",style:{color:"#1565C0"},children:["Temp ",t.nombre]}),e.jsxs("th",{className:"text-right py-1 px-1 font-medium",style:{color:"#2E7D32"},children:["Lluvia ",a.nombre.split(" ")[0]]}),e.jsxs("th",{className:"text-right py-1 pl-1 font-medium",style:{color:"#1565C0"},children:["Lluvia ",t.nombre.split(" ")[0]]})]})}),e.jsx("tbody",{children:T.map((s,r)=>{const d=m[r]?.temp??"-",x=i[r]?.temp??"-",p=m[r]?.precip??"-",h=i[r]?.precip??"-",b=typeof d=="number"&&typeof x=="number"?d-x:0;return e.jsxs("tr",{className:"border-t border-gray-50",children:[e.jsx("td",{className:"py-1.5 pr-2 font-semibold text-gray-600",children:s}),e.jsxs("td",{className:"text-right py-1.5 px-1 font-bold",style:{color:b>0?"#2E7D32":b<0?"#9E9E9E":"#374151"},children:[d,"°"]}),e.jsxs("td",{className:"text-right py-1.5 px-1 font-bold",style:{color:b<0?"#1565C0":b>0?"#9E9E9E":"#374151"},children:[x,"°"]}),e.jsxs("td",{className:"text-right py-1.5 px-1 text-gray-600",children:[p,"mm"]}),e.jsxs("td",{className:"text-right py-1.5 pl-1 text-gray-600",children:[h,"mm"]})]},s)})})]})})]})}),e.jsx(y,{delay:.09,children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(V,{name:a.nombre,slug:n,lat:a.lat,lon:a.lon}
1),e.jsx(V,{name:t.nombre,slug:o,lat:t.lat,lon:t.lon})]})}),e.jsx(y,{delay:.1,children:e.jsxs(g,{intensity:"light",className:"p-5",children:[e.jsx("h2",{className:"text-sm font-bold text-gray-700 mb-3",children:"Más comparaciones"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:[{a:"sevilla",b:"malaga"},{a:"granada",b:"malaga"},{a:"cordoba",b:"sevilla"},{a:"almeria",b:"malaga"},{a:"cadiz",b:"malaga"},{a:"huelva",b:"sevilla"},{a:"jaen",b:"cordoba"},{a:"almeria",b:"granada"}].filter(({a:s,b:r})=>!(s===n&&r===o)&&!(s===o&&r===n)).slice(0,6).map(({a:s,b:r})=>{const d=D(s,_),x=D(r,_);return!d||!x?null:e.jsx(C,{href:`/comparar-clima/${s}/${r}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-semibold bg-gray-100 text-gray-700 hover:bg-green-50 hover:text-[#2E7D32] cursor-pointer transition-colors",children:[d.nombre," vs ",x.nombre]})},`${s}-${r}`)})}),e.jsxs("div",{className:"mt-3 flex gap-4 text-xs",children:[e.jsx(C,{href:`/el-tiempo-en/${n}`,className:"text-left",children:e.jsxs("span",{className:"text-[#2E7D32] hover:underline font-semibold text-left",children:["El tiempo en ",a.nombre," →"]})}),e.jsx(C,{href:`/el-tiempo-en/${o}`,className:"text-left",children:e.jsxs("span",{className:"text-[#1565C0] hover:underline font-semibold",children:["El tiempo en ",t.nombre," →"]})})]})]})})]})}export{ge as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.