<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gain on Medium]]></title>
        <description><![CDATA[Stories by Gain on Medium]]></description>
        <link>https://medium.com/@gainsira?source=rss-9202e7b016f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rH6AW8WIem5Ou81MYzIbGQ.jpeg</url>
            <title>Stories by Gain on Medium</title>
            <link>https://medium.com/@gainsira?source=rss-9202e7b016f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 09:17:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gainsira/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Draft research plan to create a tropical cyclone rainfall early warning system]]></title>
            <link>https://gainsira.medium.com/draft-research-plan-to-create-a-tropical-cyclone-rainfall-early-warning-system-56846e5c16b7?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/56846e5c16b7</guid>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Thu, 27 Nov 2025 03:45:52 GMT</pubDate>
            <atom:updated>2025-11-27T03:45:52.836Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F_REM7V2MWiD-mpB1dFNEw.jpeg" /></figure><h3>1. Project Overview &amp; Objectives</h3><h3>Primary Goal</h3><p>Develop an early warning system that combines historical tropical cyclone precipitation patterns with Google DeepMind’s GraphCast probabilistic forecasts to improve prediction of precipitation hazards during tropical cyclones.</p><h3>Key Objectives</h3><ul><li>Leverage historical TC-precipitation relationships to understand rainfall patterns relative to storm characteristics</li><li>Integrate GraphCast’s probabilistic medium-range forecasts to provide ensemble-based precipitation predictions</li><li>Create operational thresholds and warning criteria for different precipitation hazard levels</li><li>Validate system performance against recent TC events</li></ul><h3>2. Data Acquisition &amp; Preprocessing</h3><h3>Historical TC-Precipitation Data</h3><p><strong>Primary Datasets:</strong></p><ul><li><a href="https://zenodo.org/records/10105751"><strong>MSTCP Dataset</strong></a>: Multi-source global TC precipitation with merged satellite, reanalysis, and gauge data</li><li><a href="https://www.ncei.noaa.gov/products/international-best-track-archive?name=ibtracs-data-access"><strong>IBTrACS</strong></a>: International Best Track Archive for Climate Stewardship for TC track and intensity data</li><li><a href="https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=overview"><strong>ERA5 reanalysis</strong></a>: For atmospheric conditions and additional precipitation validation</li></ul><p><strong>Data Requirements:</strong></p><ul><li>TC tracks and intensity parameters (position, maximum winds, pressure, size)</li><li>Precipitation fields at appropriate spatial resolution (ideally ≤25km)</li><li>Storm-relative coordinates to standardize patterns</li><li>Minimum 20–30 years of data for robust climatology (1990s-present)</li></ul><h3>GraphCast Forecast Data</h3><p><strong>Components Needed:</strong></p><ul><li>10-day probabilistic forecasts of precipitation</li><li>Ensemble members or probabilistic outputs</li><li>Atmospheric variables: MSLP, winds, humidity, temperature profiles</li><li>Spatial resolution: 0.25° (GraphCast’s native resolution)</li><li>Temporal resolution: 6-hourly forecasts</li></ul><p>GraphCast github repo: <a href="https://github.com/google-deepmind/graphcast">https://github.com/google-deepmind/graphcast</a></p><h3>Preprocessing Steps</h3><ol><li><strong>Standardize coordinate systems</strong>: Convert all data to consistent spatial reference</li><li><strong>Storm-relative framework</strong>: Transform precipitation fields to TC-centered coordinates (radius/azimuth)</li><li><strong>Temporal alignment</strong>: Match historical precipitation to TC positions at 6-hourly intervals</li><li><strong>Quality control</strong>: Remove incomplete cases, filter spurious values</li><li><strong>Feature engineering</strong>: Calculate derived parameters (translation speed, shear, SST, landfall proximity)</li></ol><h3>3. Historical Pattern Analysis</h3><h3>Climatological Relationships</h3><p><strong>Analysis Tasks:</strong></p><ul><li>Quantify precipitation distributions as function of:</li><li>TC intensity (sustained winds, central pressure)</li><li>Storm size and structure</li><li>Translation speed and direction</li><li>Environmental shear and moisture</li><li>Distance from coast/landfall status</li><li>Geographic region and seasonal variations</li></ul><p><strong>Statistical Modeling:</strong></p><ul><li>Develop regression models linking TC parameters to precipitation amounts</li><li>Cluster analysis to identify distinct precipitation regimes</li><li>Quantile regression for extreme rainfall estimation</li><li>Account for asymmetric patterns (e.g., enhanced rainfall in right-front quadrant)</li></ul><h3>Storm-Relative Precipitation Composites</h3><ul><li>Create composites for different intensity categories, motion speeds, and environmental conditions</li><li>Analyze radial profiles and azimuthal variations</li><li>Identify regions of maximum precipitation relative to TC center</li><li>Examine differences between ocean vs. land precipitation patterns</li></ul><h3>4. GraphCast Integration Framework</h3><h3>Forecast Processing Pipeline</h3><p><strong>Input Processing:</strong></p><ol><li>Ingest GraphCast 10-day ensemble forecasts (or probabilistic output)</li><li>Extract TC-relevant variables: precipitation, winds, MSLP, moisture</li><li>Apply TC tracking algorithm to forecast fields to identify future positions</li><li>Transform to storm-relative coordinates for each forecast time</li></ol><p><strong>Bias Correction &amp; Calibration:</strong></p><ul><li>Compare GraphCast precipitation forecasts against historical observations</li><li>Develop bias correction using quantile mapping or machine learning</li><li>Calibrate ensemble spread to match observed forecast uncertainty</li><li>Account for systematic biases in TC precipitation (common in NWP models)</li></ul><h3>Hybrid Forecast Generation</h3><p><strong>Method 1: Analog-Based Enhancement</strong></p><ul><li>For each forecast TC state (intensity, environment), find historical analogs</li><li>Weight historical precipitation patterns by similarity to forecast conditions</li><li>Blend GraphCast forecast with analog-weighted climatology</li><li>Produces probabilistic precipitation estimates</li></ul><p><strong>Method 2: Machine Learning Integration</strong></p><ul><li>Train neural network or gradient boosting model with:</li><li>Inputs: GraphCast forecast fields + TC parameters + climatological patterns</li><li>Target: Observed TC precipitation from historical data</li><li>Model learns to correct GraphCast and integrate climatological knowledge</li><li>Generates probabilistic predictions via ensemble or quantile regression</li></ul><p><strong>Method 3: Bayesian Updating</strong></p><ul><li>Use historical TC-precip relationships as prior distribution</li><li>Update with GraphCast forecast as likelihood</li><li>Posterior provides calibrated probabilistic precipitation forecast</li><li>Naturally incorporates uncertainty from both sources</li></ul><h3>5. Early Warning System Development</h3><h3>Warning Thresholds &amp; Criteria</h3><p><strong>Precipitation Hazard Levels:</strong></p><ul><li><strong>Level 1 (Minor)</strong>: 50–100mm in 24 hours</li><li><strong>Level 2 (Moderate)</strong>: 100–200mm in 24 hours</li><li><strong>Level 3 (Major)</strong>: 200–400mm in 24 hours</li><li><strong>Level 4 (Extreme)</strong>: &gt;400mm in 24 hours</li></ul><p><strong>Geographic Warning Products:</strong></p><ul><li>Probability of exceeding thresholds at lead times: 24h, 48h, 72h, 120h</li><li>Spatial maps showing exceedance probabilities</li><li>Most likely precipitation amounts (ensemble median/mean)</li><li>Uncertainty visualization (ensemble spread, percentile ranges)</li></ul><h3>Operational Implementation</h3><p><strong>System Components:</strong></p><ol><li><strong>Data ingestion module</strong>: Automated download of GraphCast forecasts</li><li><strong>TC detection/tracking</strong>: Identify cyclones in forecast fields</li><li><strong>Hybrid forecast generator</strong>: Apply chosen integration method</li><li><strong>Warning logic</strong>: Evaluate thresholds and issue alerts</li><li><strong>Dissemination</strong>: Generate maps, bulletins, API outputs</li></ol><p><strong>Update Frequency:</strong></p><ul><li>Refresh warnings every 6 hours with new GraphCast runs</li><li>Maintain consistency in messaging while updating probabilities</li><li>Archive forecasts for verification</li></ul><h3>6. Validation &amp; Performance Metrics</h3><h3>Retrospective Testing</h3><p><strong>Approach:</strong></p><ul><li>Select 10–20 recent major TCs (2020–2024) not used in training</li><li>Run system in hindcast mode using archived GraphCast forecasts (or reforecasts)</li><li>Compare against observed precipitation</li></ul><p><strong>Metrics:</strong></p><ul><li><strong>Probabilistic skill</strong>: Brier Score, Continuous Ranked Probability Score (CRPS)</li><li><strong>Deterministic skill</strong>: RMSE, bias, correlation for ensemble mean</li><li><strong>Threshold-based</strong>: POD, FAR, CSI for warning categories</li><li><strong>Economic value</strong>: Relative value for different cost/loss ratios</li><li><strong>Comparison</strong>: Benchmark against raw GraphCast, climatology, and operational products</li></ul><h3>Lead-Time Dependent Skill</h3><ul><li>Assess how skill degrades with forecast lead time</li><li>Identify optimal lead times for different warning decisions</li><li>Determine when hybrid approach adds value over raw GraphCast</li></ul><h3>Regional and Seasonal Stratification</h3><ul><li>Evaluate performance by ocean basin</li><li>Check for seasonal biases</li><li>Assess skill for different TC characteristics (weak vs. intense, fast vs. slow-moving)</li></ul><h3>7. System Refinement &amp; Iteration</h3><h3>Based on validation results:</h3><ol><li><strong>Recalibrate</strong> bias correction and ensemble weighting schemes</li><li><strong>Retrain</strong> ML models with expanded datasets</li><li><strong>Adjust</strong> warning thresholds based on false alarm rates and user feedback</li><li><strong>Incorporate</strong> additional predictors (e.g., TC structure metrics, orographic effects)</li><li><strong>Expand</strong> to include multi-hazard warnings (wind, storm surge if applicable)</li></ol><h3>Uncertainty Quantification</h3><ul><li>Clearly communicate sources of uncertainty to end users</li><li>Develop “confidence” metrics that reflect forecast reliability</li><li>Provide ensemble-based scenarios for decision support</li></ul><h3>8. Stakeholder Engagement &amp; Deployment</h3><h3>Target Users</h3><ul><li>National meteorological services</li><li>Emergency management agencies</li><li>Humanitarian organizations</li><li>Infrastructure operators (utilities, transportation)</li></ul><h3>User Requirements Gathering</h3><ul><li>Conduct interviews to understand decision-making needs</li><li>Determine preferred lead times and acceptable false alarm rates</li><li>Identify information delivery preferences (maps, text, APIs)</li></ul><h3>Pilot Implementation</h3><ul><li>Deploy system operationally for one or two active basins</li><li>Collect user feedback in real-time during TC events</li><li>Monitor system performance and iterate rapidly</li></ul><h3>Training &amp; Documentation</h3><ul><li>Develop user guides and technical documentation</li><li>Provide training on interpreting probabilistic forecasts</li><li>Create case study examples demonstrating system capabilities</li></ul><h3>9. Timeline &amp; Milestones</h3><p><strong>Phase 1 (Months 1–3): Data Assembly</strong></p><ul><li>Acquire MSTCP and IBTrACS datasets</li><li>Set up GraphCast data access</li><li>Complete preprocessing pipeline</li></ul><p><strong>Phase 2 (Months 4–6): Historical Analysis</strong></p><ul><li>Develop climatological TC-precipitation relationships</li><li>Create storm-relative composites</li><li>Statistical modeling of precipitation patterns</li></ul><p><strong>Phase 3 (Months 7–9): Integration Development</strong></p><ul><li>Implement hybrid forecast methods</li><li>Bias correction and calibration</li><li>Initial validation on test cases</li></ul><p><strong>Phase 4 (Months 10–12): Warning System</strong></p><ul><li>Define thresholds and products</li><li>Build operational pipeline</li><li>Retrospective validation</li></ul><p><strong>Phase 5 (Months 13–15): Refinement &amp; Pilot</strong></p><ul><li>Iterate based on validation results</li><li>Deploy pilot system</li><li>Stakeholder engagement</li></ul><p><strong>Phase 6 (Months 16–18): Operational Transition</strong></p><ul><li>Full deployment and monitoring</li><li>Documentation and training</li><li>Publication of methodology and results</li></ul><h3>10. Expected Outcomes &amp; Impact</h3><h3>Scientific Contributions</h3><ul><li>Novel integration of ML-based forecasts with observational climatology</li><li>Improved understanding of TC precipitation predictability</li><li>Benchmark for future hybrid forecasting approaches</li></ul><h3>Operational Benefits</h3><ul><li>Extended lead times for precipitation warnings (up to 10 days)</li><li>Probabilistic guidance for decision-makers</li><li>Reduced casualties and economic losses from TC flooding</li></ul><h3>Potential Challenges &amp; Mitigation</h3><ul><li><strong>GraphCast biases</strong>: Extensive calibration and validation required</li><li><strong>Data limitations</strong>: Some regions lack dense observations; use multi-source approach</li><li><strong>Computational costs</strong>: Optimize code, use cloud computing resources</li><li><strong>User adoption</strong>: Strong engagement and training programs</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56846e5c16b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2 ตัวอย่าง ที่ openlink เอา AI มาใช้หลังบ้าน]]></title>
            <link>https://gainsira.medium.com/2-%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87-%E0%B8%97%E0%B8%B5%E0%B9%88-openlink-%E0%B9%80%E0%B8%AD%E0%B8%B2-ai-%E0%B8%A1%E0%B8%B2%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%AB%E0%B8%A5%E0%B8%B1%E0%B8%87%E0%B8%9A%E0%B9%89%E0%B8%B2%E0%B8%99-311bedff8b42?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/311bedff8b42</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[spam-detection]]></category>
            <category><![CDATA[openlink]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 23:11:06 GMT</pubDate>
            <atom:updated>2025-07-17T23:37:50.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rCgS-GoUyjVWXOsFkDJ8Vg.png" /><figcaption><a href="http://www.openlinkc.o/">www.openlink</a>.co</figcaption></figure><p>ก่อนอื่นก็ขอแนะนำ openlink สั้นๆสำหรับคนที่ยังไม่รู้จักนะครับ openlink ก็เป็นเว็บไซต์รวมลิ้งง่ายๆ (link in bio) ที่สามารถทำให้คนทั่วไปสร้างหน้าเว็บตัวเองได้ ใส่รูปใส่ลิ้ง และรายละเอียดต่างๆ เสร็จแล้วก็เอาลิ้งนั้นไปใส่ในโซเชี่ยวมีเดียตัวเองหรือเผยแพร่ทางอื่นๆ ปัจจุบัน openlink เองก็มีผู้ใช้งานในไทยเป็นจำนวนมากพอสมควร เกือบจะแตะหลักแสนแล้ว ถ้าใครใช้ Instagram บ่อยๆแล้วสังเกตลิ้งใน bio ดีๆก็จะเห็นได้ว่ามีแบรนและ content creator ต่างๆใช้ลิ้งของ openlink อยู่มากมายและ usecase ก็แตกต่างกันออกไป หลากหลาย industry (ดูตัวอย่างได้ที่ <a href="https://www.openlink.co/explore">https://www.openlink.co/explore</a>)</p><p>ทีนี้มาพูดถึง AI กันครับ ส่วนตัวเองผู้เขียนก็มีประสบการณ์กับ AI มานานพอสมควร (ตั้งแต่ทำ GB bot ในบทความเก่าๆที่ค่อนข้าง manual หรือแม้กระทั่งในงาน consult ปัจจุบันก็ตาม) เรียกได้ว่าตั้งแต่ยุคที่มันยังไม่ค่อยฉลาดนักมาจนถึงในยุคนี้ที่มันเก่งกว่ามนุษย์ในหลายๆด้าน (บางทีก็ hype กันเกินไปในบางเรื่อง) สำหรับ AI usecase ที่เขียนในบทความนี้ก็เป็นตัวอย่างของการนำ AI มาใช้หลังบ้าน เพื่อช่วย operation ของทีม (ที่มีจำนวนน้อย) ให้ทำงานได้ดีและมีประสิทธิภาพมากขึ้นครับ หลังๆมาเราจะเริ่มเห็นเทรนว่าสตาทอัพสมัยนี้ไม่ได้เน้นสเกลจำนวนคนในทีมอย่างเดียวแล้ว เพราะว่า AI สามารถ automate ได้จะแทบทุกงานที่มนุษย์ทำซ้ำๆเป็นกิจวัตร ตัวอย่างนี้จริงๆใช้งานมานานพอสมควรแล้วครับ แต่เพิ่งมีเวลามาเขียนลงบทความ</p><h3>1. Spam detection — ตรวจจับ user ไม่พึงประสงค์</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uf2SB8LPbI9EKvxc1TqhcA.png" /></figure><p>ปัญหานึงของ openlink ก็คือว่าเรามี user ที่สมัครเข้ามาใหม่แต่ละวันๆก็หลักร้อย และก็มีจำนวนไม่น้อยในนั้นที่สร้างปัญหาให้กับเรา เช่น spam, คอนเทนที่ผิดกฎหมาย อาจจะการพนัน, บอท, ปลอมแปลงเป็นบุคคน/องค์กรอื่น, ลิ้ง click bait ไวรัสต่างๆ ซึ่งพวกนี้ทีมของ openlink ก็ต้องมานั่งดูและบนเป็นราย user ไป ซึ่งใช้เวลาแต่ละวันนานพอสมควรครับ บางคนอาจจะบอกว่าก็ไม่ได้สำคัญเท่าไหร่ แต่จริงๆแล้วถ้าเราไม่ใส่ใจกับเรื่องแบบนี้ก็มีโอกาสที่เว็บของเราจะปลิวได้ครับ มีหลายวิธีที่ทั้งเว็บจะโดนแบนได้ ตั้งแต่ระดับท้องถิ่นไปจนถึง domain registrar</p><p>Solution นี้ก็คือการเขียน cronjob + Server side script + database + LLM API + Slack API มาเชื่อมกัน แล้วก็ flag user ที่ต้องสงสัยมาให้กับทีมเบื้องต้น แล้วทีมก็รีวิวซ้ำอีกที แล้วก็แค่กดคอนเฟิมว่าจะแบน user เหล่านี้ครับ วิธีการทำงานก็คือเราดึงข้อมูลของ user ที่สมัครเข้ามาใหม่ทุกๆชั่วโมง แล้วก็ mask out sensitive data ออกจาก user (หรือเลือกเฉพาะ public field ที่จำเป็น) แล้วก็ feed ไปให้กับ LLM API เพื่อที่จะให้ AI มันแสกนดูว่ายูเสอไหนเข้าข่ายที่จะเป็น spam และสมควรโดนแบนบ้าง และก็ให้บอทส่งข้อความแจ้งมาใน Slack</p><p>คีย์หลักของการใช้ LLM API ก็คือว่าต้องเขียน context ไปใน prompt ให้มันเข้าใจประมาณนี้ครับ:</p><ol><li>Database schema, data structure และ field meaning — แต่ละ field ของ user ที่เราเลือกจาก database มาใช้มีอะไรบ้าง และมีความหมายอย่างไร เพื่อให้ AI สามารถเข้าใจข้อมูลที่ใช้ในการประเมินได้</li><li>Role and rules — user ประเภทไหนที่เราอยากให้แบนเราก็ต้องบอกมันให้ชัดเจน ยิ่งเราอธิบาย context ได้ดีและชัดเจนเท่าไหร่ AI ก็ทำงานออกมาได้ดีตามที่เราต้องการมากเท่านั้นครับ</li><li>Example output — ในที่นี้เราก็ให้มัน Return เป็น structure json output ออกมา (ส่วนใหญ่จะตั้งค่าได้ใน LLM API request) พร้อมกับเหตุผล และ confidence level ซึ่งสองอย่างนี้เป็นตัวสำคัญเลยครับ ที่ช่วยให้คนที่จะมารีวิวผลลัพธ์จาก AI อีกทีทำงานได้สะดวกขึ้น และพอมันเป็น structure data แบบนี้เราก็เอาไปทำอะไรต่อได้ อย่างในตัวอย่างรูปด้านล่างจะเห็นว่ามีลิ้งให้กดไปรีวิวรายชื่อ user และแบนต่อได้ทันที แต่เฉพาะรายการที่มีความมั่นใจตั้งแต่ 4 ขึ้นไปเท่านั้น ตัวเลข 4 นี้ก็ได้มาจากการทดลองใช้ระบบมาระยะหนึ่ง และก็ดูว่าระดับไหนที่เรามั่นใจในการทำงานของ AI ซึ่งตัวคะแนนนี้มันก็จะเปลี่ยนไปถ้าเกิดเราแก้ prompt/context, temperature, หรือเราเปลี่ยนโมเดล/เวอชั่นที่เราใช้ครับ ก็ต้องทดลองและปรับตามไปถ้ามีอะไรเหล่านี้เปลี่ยนแปลง</li></ol><h3>2. Natural langage data analytics —วิเคราะห์ฐานข้อมูลด้วยภาษาคน</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*Z_rTm3Zo9Pt3pVo3Wg6yqg.png" /></figure><p>สำหรับตัวอย่างนี้ สิ่งที่เราต้องการแก้ก็คือว่าจะทำยังไงให้ทีมสามารถเข้าใจฐานข้อมูลของเราได้ง่ายขึ้น แล้วนำข้อมูลเรานี้มาวิเคราะห์ได้อย่างรวดเร็ว ซึ่งปกติถ้าคนที่ทำสาย data analytics ก็คงจะรู้ว่าเราอาจจะก็ต้องเขียน python หรือ SQL เพื่อที่จะดึงข้อมูลออกมาจากฐานข้อมูล แล้วก็นำไปวิเคราะห์ต่ออีกที</p><p>Solution อันนี้ก็คือง่ายๆเลยครับ เราก็แค่แปลงภาษาอังกฤษให้เป็น query languge สะ แล้วก็ทำให้ทีมของเราสามารถถามคำถามอะไรก็ได้ภาษาคน แล้วบอทก็ตอบกลับมาเป็น query language (filter + projection) พร้อมลิ้งที่เรากดรันแล้วก็ดู result ได้เลย ส่วนที่สำคัญที่สุดเหมือนเดิมก็คือตัว prompt และ context ที่เราจะต้องอธิบายให้กับ AI เข้าใจว่าแต่ละ field เก็บอะไรและมีความหมายอย่างไรบ้าง เพื่อที่จะให้ AI เขียน query ออกมาได้อย่างแม่นยำครับ หรือว่าถ้าเรามี internal doc สำหรับ database ของเราก็สามารถ feed ไปใน api request ได้ด้วยเหมือนกัน แต่ก็ต้องดู context length และราคาที่เหมาะสมกับการใช้งานของเราครับ</p><p>จริงๆแล้วมีวิธีทำได้หลายท่าครับ แต่ที่เราเลือกที่จะโชว์ query มาพร้อมกับข้อความด้วย ก็เพื่อที่เราจะได้รีวิวว่ามันถูกต้องแค่ไหน และเราจะปรับอะไรไหม และอีกประโยชน์นึงก็คือเราสามารถเซฟลิ้งของ query นั้นๆ มาใช้ซ้ำได้อีกในอนาคต</p><p>สิ่งที่สามารถทำเพิ่มเติมหลังจากนี้ก็คือเอา query result เหล่านี้ feed กลับไปให้ LLM API เพื่อที่จะคิดวิเคราะห์/คำนวน และตอบคำถามเราได้แบบ end-to-end ซึ่งในตัวอย่างนี้เป็นการโชว์แค่ครึ่งทางครับ และก็คิดว่าตอบโจทย์ทีมของเราได้ระดับนึงแล้ว ถ้าเราต้องการให้ LLM นำ query result ไปคิดวิเคราะห์ต่อก็ทำได้ไม่ยาก</p><p>อีกท่านึงที่สามารถทำได้ก็คือแต่อาจจะยากหน่อยก็คือเอาฐานข้อมูลของเราไป vectorize แล้วเราก็ deploy กับ database provider สักเจ้า ก็จะทำให้เราคุยกับฐานข้อมูลได้โดยตรง อันนี้ทดลองแล้วก็คิดว่า overkill และ complicate เกินไปครับ แค่ gen database query มาให้แค่นี้แก้ปัญหาให้กับทีมได้เยอะพอสมควรแล้ว ฟีเจอร์เหล่านี้อีกหน่อยตัว database/cloud provider เองก็คงทำออกมาให้เราใช้งานได้สะดวกมากขึ้นเหมือนกัน แต่พอดีทีมงานของเรารอไม่ไหวก็เลยต้องทำฟีเจอร์แบบนี้ขึ้นมาใช้เองก่อน</p><p>Usecase ในบทความนี้ก็เป็นตัวอย่างที่เราเอา AI มาใช้กับระบบหลังบ้านของ openlink ครับ เป็นอะไรที่ง่ายๆไม่ซับซ้อนแต่ตอบโจทย์และก็พัฒนาเพิ่มเติมได้ไม่ยาก หลักคิดของการนำ AI มาใช้ก็คืออะไรที่ช่วยประหยัดเวลาเราได้เพราะเราต้องทำซ้ำๆ หรือปัญหามันค่อนข้างถึก พวกนี้ก็ควรที่จะให้ AI มาช่วยครับ ส่วน bottoleneck ของการนำ AI มาใช้จริงๆแล้วน่าจะอยู่ที่การ integrate กับระบบปัจจุบันที่เรามีมากกว่า เพราะความสามารถของ AI จริงๆแล้วเราก็ทดลองกับ ChatGPT, Claude พวกนี้ได้อยู่แล้วว่าอะไรทำได้อะไรยังทำไม่ได้ แต่การ integrate AI model เข้ามากับระบบที่เรามีเป็นสิ่งที่ต้องใช้เวลา และก็มีรายละเอียด/ข้อจำกัดยิบหย่อยที่ต้องคำนึงถึง</p><p>สำหรับ openlink เอง เราก็ไม่ได้หยุดที่จะพัฒนาเว็บของเราให้ดีขึ้น ทั้งหลังบ้านและหน้าบ้าน เป้าหมายก็คือเราต้องการสร้างฟีเจอร์ที่จะตอบโจทย์ให้กับผู้ใช้มากขึ้นต่อไปครับ ใครที่สนใจทางด้าน AI และ เคยเห็น openlink ผ่านตามาบ้าง และอยากจะเข้ามาร่วมจอยทีมกับเรา (part-time/freelance) ก็ติดต่อมาได้นะครับ มีโปรเจคให้เล่นมากมาย ด้วยความที่เราเป็นทีมเล็กเราก็ค่อนข้างเปิดกว้างให้กับไอเดียใหม่ๆและพร้อมลุยอยู่เสมอครับ openlink เองก็มีผู้ใช้อยู่จำนวนมาก เพราะฉะนั้นคุณจะได้เล่นกับ production ที่มี traffic จริงๆ และได้คุยกับคนใช้จริงๆครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=311bedff8b42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[รวมชุดข้อมูลเปิดแผนที่น้ำท่วมประเทศไทย]]></title>
            <link>https://gainsira.medium.com/%E0%B8%A3%E0%B8%A7%E0%B8%A1%E0%B8%8A%E0%B8%B8%E0%B8%94%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5%E0%B9%80%E0%B8%9B%E0%B8%B4%E0%B8%94%E0%B9%81%E0%B8%9C%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%99%E0%B9%89%E0%B8%B3%E0%B8%97%E0%B9%88%E0%B8%A7%E0%B8%A1%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B9%80%E0%B8%97%E0%B8%A8%E0%B9%84%E0%B8%97%E0%B8%A2-11fc1f6e32fe?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/11fc1f6e32fe</guid>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[floods]]></category>
            <category><![CDATA[thailand]]></category>
            <category><![CDATA[flooding]]></category>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Sat, 24 Aug 2024 06:38:37 GMT</pubDate>
            <atom:updated>2024-12-12T06:04:40.101Z</atom:updated>
            <content:encoded><![CDATA[<p>Democratizing Thailand Flood risk data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bggg9fd2yxFhBchJ5ldnFA.png" /><figcaption>AHA Centre Flash update (<a href="https://ahacentre.org/flash-updates/">https://ahacentre.org/flash-updates</a>) on 24 Aug 2024</figcaption></figure><p><strong>หมายเหตุ:</strong> ข้อมูลแต่ละชุด มีข้อจำกัดที่ไม่เหมือนกัน เนื่องจากวิธีการจัดทำ (methodology) และจุดประสงค์ที่แตกต่างกันออกไป ไม่สามารถนำเปรียบเทียบกันได้โดยตรง โปรดศึกษาข้อมูล metadata ประกอบการใช้งาน สีของแผนที่จำเป็นจะต้องดูคู่กับแถบสีและหน่วย (ความสูงของระดับน้ำ) ของแผนที่เพิ่มเติม แถบสีที่แนบมาในบทความนี้เป็นเพียงแค่ตัวอย่างเท่านั้น ข้อมูลแผนที่น้ำท่วมในบทความนี้ควรใช้สำหรับการวางแผนระยะไกล และไม่เหมาะกับการใช้ในเหตุการณ์ภัยพิบัติระยะสั้น สำหรับการพยากรณ์/แจ้งเตือนระยะสั้น โปรดติดตามข้อมูลจาก<a href="https://tmd.go.th/">กรมอุตุนิยมวิทยา</a>, <a href="http://www.onwr.go.th/">สำนักทรัพยากรน้ำแห่งชาติ (สนท.)</a>, <a href="https://www.disaster.go.th/">กรมป้องกันและบรรเทาสาธารณภัย</a>, <a href="https://www.thaiwater.net/">คลังข้อมูลน้ำแห่งชาติ</a> (ทั้งจากเว็บไซต์และเฟสบุ้ค)</p><p><strong>จุดประสงค์: </strong>เพื่อรวบรวมข้อมูลเปิดแผนที่น้ำท่วมประเทศไทยให้ประชาชนทั่วไปสามารถเข้าถึง/วิเคราะห์ได้ หรือสำหรับนักวิจัยเพื่อที่จะนำไปวิจัยศึกษาต่อยอด</p><p><strong>วิธีการใช้งาน: </strong>บางชุดข้อมูลมีเว็บแสดงผลสำเร็จรูป ส่วนข้อมูลอื่นๆสามารถ<a href="https://www.qgis.org/download/">ดาวโหลดโปรแกรม QGIS</a> เพื่อไปเปิดดูข้อมูลระดับน้ำแบบละเอียด (ตาม lat, lon)ได้ฟรี</p><h4>1. [GISTDA] แผนที่น้ำท่วมซ้ำซาก — แสดงจำนวนครั้งที่น้ำท่วมตั้งแต่ปี 2005 ถึง 2016</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mrfkVU2DQ30dB36cql8b1A.png" /></figure><p>Web map: <a href="https://gistdaportal.gistda.or.th/gmos/_Floodfreqstat/">https://gistdaportal.gistda.or.th/gmos/_Floodfreqstat/</a></p><p>Metadata: <a href="https://oasishub.co/dataset/thailand-annual-flood-extents-gistda">https://oasishub.co/dataset/thailand-annual-flood-extents-gistda</a></p><p>ระบบสนับสนุนการตัดสินใจเพื่อการบริการจัดการน้ำท่วม – ข้อมูลปัจจุบัน, คาดการณ์น้ำท่วม, น้ำท่วมซ้ำซาก, ขอบเขตน้ำท่วม, ดาวโหลดข้อมูล, API/STAC <a href="https://disaster.gistda.or.th/flood/">https://disaster.gistda.or.th/flood/</a></p><h4>2. [EU JRC] Global river flood hazard maps V2.0.0 (2024–03–14)</h4><ul><li>ความละเอียด: ประมาณ 90 m, หน่วยของข้อมูล: เมตร</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*l_yOvBZd4-Qarpiy48qtDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*pmOlf78VJsfVLwetHCdnXA.png" /></figure><p><strong>Return periods (RPs): </strong>10, 20, 50, 75, 100, 200, 500 years</p><p><strong>หมายเหตุ</strong>: return period เป็นหน่วยมาตรฐานสากลที่ใช้ในแผนที่น้ำท่วม ไม่ได้หมายความว่าจะเกิดขึ้นทุกๆ 200 ปี แต่หมายถึงโอกาสที่น้ำจะท่วมเกินความสูงเท่านี้ ที่ความน่าจะเป็นเท่านี้ <a href="https://kkurojjanawong.wordpress.com/2018/08/17/return-period-vs-frequency-of-occurence/">อ่านความหมายเพิ่มเติมได้นี้</a> ซึ่งความน่าจะเป็นนี้สามารถนำไปคำนวนความเสี่ยงและโอกาสที่จะเกิดขึ้นได้ หนึ่งในตัวอย่างอุตสาหกรรมที่นำไปใช้คือประกันภัย และ Catastrophe Modeling</p><p>แผนที่ความสูงที่ใช้: MERIT-DEM (2018)</p><p><strong>Data Download:</strong> <a href="https://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/CEMS-GLOFAS/flood_hazard/">https://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/CEMS-GLOFAS/flood_hazard/</a> (ประเทศไทยครอบคลุม 6 tile ids คือ N9_E90, N29_E100, N29_E90, N19_E90, N19_E100, N9_E100)</p><p><strong>Metadata: </strong><a href="https://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/CEMS-GLOFAS/flood_hazard/README-flood_maps-Global.txt">https://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/CEMS-GLOFAS/flood_hazard/README-flood_maps-Global.txt</a> (<a href="https://data.jrc.ec.europa.eu/dataset/jrc-floods-floodmapgl_rp50y-tif?fbclid=IwZXh0bgNhZW0CMTEAAR2q_utEZNENMeB7CruKlpCOvAIDqROVTSGCZ50eGg0zJA9LwJ_c08EBpSA_aem__Tu9X48UEC79qpxJJJxvYw#description"><strong>Main data page</strong></a><strong>)</strong></p><h4>3. [CIMA Foundation and UNEP-GRID] GAR15 Global Riverine Flood hazard map</h4><ul><li>RPs: 25, 50, 100, 200, 500, 1000</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*pOw_h2eDipoGHIvh35P1gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/51/1*QrtkEzkIjCSamDTTXug-8w.png" /></figure><p>Data download: <a href="https://risk.preventionweb.net/">https://risk.preventionweb.net/</a> (Grid file)</p><p>Metadata: <a href="https://energydata.info/dataset/global-river-flood-hazard-0">https://energydata.info/dataset/global-river-flood-hazard-0</a></p><h4>4. [World Bank] South-East Asia River Flood Hazard</h4><p>RPs: 2,5,10,25,50,100,250,500,1000</p><ul><li>ความละเอียดประมาณ 1 กม.</li><li>climate change scenarios (จาก WRI): historical baseline, RCP45, RCP85</li><li>ปีที่คาดการ: current, 2030, 2050, 2080</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*ZlhcSTA2zs_eNnZ6r-tLKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/85/1*j1jpJR14SKah74IRzE23aQ.png" /><figcaption>RCP8.5 2080 RP1000</figcaption></figure><p>หมายเหตุ: ปัจจุบันแผนที่น้ำท่วมส่วนใหญ่มักจะผลิตออกมาในรูปแบบของ climate change scenario และ ปีที่คาดการณ์แบบนี้ เพื่อใช้ในการคำนวนความเสี่ยงและวางแผนอนาคต</p><p>Data download &amp; Metadata: <a href="https://datacatalog.worldbank.org/search/dataset/0042423/South-East-Asia-river-flood-hazard">https://datacatalog.worldbank.org/search/dataset/0042423/South-East-Asia-river-flood-hazard</a></p><h4><strong>5. [ไม่ฟรี] ตัวอย่างแผนที่จากบริษัทแผนที่น้ำท่วมชั้นนำ</strong></h4><ul><li><a href="https://oasishub.co/dataset/thailand-bangkok-flood-hazard-full-package-fathom">Fathom Thailand — Bangkok Flood Hazard (Full Package)</a> — updated in 2018</li><li>ราคา: 80,620 บาท</li><li>หมายเหตุ: ชุดข้อมูลนี้เป็นข้อมูลที่ล้าหลังแล้ว มีการอัพเดทเวอชั่นใหม่ออกมาจากบริษัทผู้ผลิต <a href="https://www.fathom.global/">https://www.fathom.global/</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZB9C4XMqntFQ-yjV" /></figure><h4>6. ข้อมูล/รายงานต่างๆเกี่ยวกับน้ำท่วมปี 54</h4><ul><li>[สมาคมวิทยุสมัครเล่นแห่งประเทศไทยในพระบรมราชูปถัมภ์] <a href="https://www.qsl.net/rast/text/flood.html">Thailand’s flood situation: the big picture</a> รวบรวมภาพ timeline แผนที่น้ำท่วมปี 2011 และแผนที่ระดับความสูงของพื้นที่กทม.จาก GISTDA</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y1IsmRMPxdvSGqOl.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o1_A8CeilwwfutrO.png" /></figure><ul><li>[GISTDA] <a href="https://giportal.gistda.or.th/portal/home/webmap/viewer.html?layers=3802cb887c3548199d7f117b7a472001">FL_flood_GISTDA_50k_Y2011 </a>— ขอบเขตน้ำท่วมจากการแปลตีความดาวเทียม Radarsat และ Thaichote ปี พ.ศ. 2554 (<a href="https://giportal.gistda.or.th/portal/home/item.html?id=3802cb887c3548199d7f117b7a472001">metadata</a>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*10r1F6vBev0KmlFiEyZpLQ.png" /></figure><ul><li>[GFDRR] <a href="https://www.gfdrr.org/sites/default/files/publication/Thai_Flood_2011_2.pdf">Thailand Flood 2011 - Rapid Assessment for Resilient Recovery and Reconstruction Planning</a></li><li>[GISTDA — Preesan Preesan Rakwatin] <a href="https://sentinel-asia.org/meetings/SA3JPTM1/agenda/2.5.4_GISTDA.pdf">Flood monitoring using Remote monitoring monitoring using Remote sensing technology sensing technology in Thailand</a></li><li>[Gale and Saunders 2013] <a href="https://rmets.onlinelibrary.wiley.com/doi/full/10.1002/wea.2133">The 2011 Thailand flood: climate causes and return periods</a></li><li>[GUY CARPENTER] <a href="https://www.guycarp.com/content/dam/guycarp/en/documents/dynamic-content/Thailand%20Flood%202011_One%20Year%20Retrospective.pdf">Thailand Flood 2011 One Year Retrospective</a></li><li>[คลังข้อมูลน้ำและภูมิอากาศแห่งชาติ] <a href="https://tiwrm.hii.or.th/current/2011/flood54.html">สรุปสถานการณ์และประเด็นข้อเท็จจริงจากเหตุการณ์มหาอุทกภัยปี 2554</a> — <a href="http://tiwrm.hii.or.th/thaiwater_l5/public/archive">บันทึกเหตุการณ์น้ำ</a></li><li><a href="https://www.eorc.jaxa.jp/ALOS/en/img_up/pi-sar_thai_nov2011_1.htm">[JAXA] Observation results of flooding in Thailand by Pi-SAR-L (L-band-Polarimetric and interferometry-Synthetic Aperture Radar)</a></li></ul><h4>7. [Fathom] FABDEM V1– 2 แผนที่ระดับความสูง</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*yih4VM9-mBNus5boUD_jCg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*PuKZZjZm6JjiOKqKoe3NfQ.png" /><figcaption>ซ้าย: ตัวอย่างการ<a href="https://code.earthengine.google.com/?scriptPath=users/sat-io/awesome-gee-catalog-examples:elevation-bathymetry/FABDEM">แสดงผลข้อมูล FABDEM แบบหยาบ บน Google Earth Engine</a> จาก <a href="https://gee-community-catalog.org/projects/glo30/">awesome-gee-community-catalog</a> | ขวา: ตัวอย่าง <a href="http://xn--fabdem_v12_tiles-kg6i.geojson/">Tile coverage</a> และข้อมูลบริเวณภาคใต้บางส่วนจาก FABDEM V1–2</figcaption></figure><ul><li>FABDEM (Forest And Buildings removed Copernicus DEM) เป็นแผนที่ระดับความสูงที่ลบตึกและต้นไม้ออกจากแผนที่ และเป็นแผนที่ความสูงที่มีคุณภาพมากที่สุดแผนที่หนึ่งในปัจจุบันในการทำแผนที่น้ำท่วม (เผยแพร่ล่าสุดวันที่ 18 Jan 2023) <strong>หมายเหตุ:</strong> โดยปกติ แผนที่น้ำท่วมจะผลิตจากข้อมูล 3 ส่วนหลักๆ คือ 1.Digital Elevation Model (DEM) 2.Hydrology modeling 3.Climate Change scenario projection</li><li>ความละเอียดประมาณ 30m</li><li>ข้อมูลต้นทางจาก Copernicus GLO 30 Digital Elevation Model (DEM), ดูออนไลน์ได้ที่ <a href="https://browser.dataspace.copernicus.eu/?zoom=3&amp;lat=36.80928&amp;lng=100.72266&amp;themeId=DEFAULT-THEME&amp;visualizationUrl=U2FsdGVkX1%2B%2FFYrMg6yEblu1tnu1FB57aSn0ktMSGSqDlkR8KIiIM7VgKbPGkiZMuLeZWq84M0k2ngTTFBp4WjNIFdZm2H48Thegao2kxxQosZI8SA%2BZqhR0MZAfK0iu&amp;datasetId=DEM_COPERNICUS_30_CDAS&amp;fromTime=2024-08-27T00%3A00%3A00.000Z&amp;toTime=2024-08-27T23%3A59%3A59.999Z&amp;layerId=1_TOPOGRAPHIC&amp;demSource3D=%22MAPZEN%22&amp;cloudCoverage=30&amp;dateMode=SINGLE">Corpernicus Browser</a></li><li>Licensed under a Creative Commons “CC BY-NC-SA 4.0” license</li><li><strong>Medata &amp; Data Download:</strong> <a href="https://data.bris.ac.uk/data/dataset/s5hqmjcdj8yo2ibzi9b4ew3sn">https://data.bris.ac.uk/data/dataset/s5hqmjcdj8yo2ibzi9b4ew3sn</a></li><li>ข้อมูลจะแบ่งเป็น tile โดยขนาด tile ละ 1x1 degree (ประมาณ 111x111 กม.) โดยสามารถดาวโหลด <a href="https://data.bris.ac.uk/datasets/s5hqmjcdj8yo2ibzi9b4ew3sn/FABDEM_v1-2_tiles.geojson"><strong>FABDEM_v1–2_tiles.geojson</strong></a> เพื่อหา tile id สำหรับบริเวณที่สนใจได้</li><li>หาก V1–2 เข้าไม่ได้สามารถดาวโหลดเวอชั่นก่อนหน้าได้ที่ <a href="https://data.bris.ac.uk/data/dataset/25wfy0f9ukoge2gs7a5mqpq2j7">FABDEM V1–0</a></li><li>Paper: <a href="https://iopscience.iop.org/article/10.1088/1748-9326/ac4d4f">https://iopscience.iop.org/article/10.1088/1748-9326/ac4d4f</a></li></ul><h4>8. [WRI] Aqueduct Floods Hazard Maps — Version 2 (updated October 20, 2020)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0YMdQjMJ9q_TXGYwhF-uEA.png" /></figure><ul><li>ประเภทของน้ำท่วม: Coastal, riverine</li><li>8 RPs: 5, 10, 25, 50, 100, 250, 500, 1000</li><li>Year: Baseline, 2030, 2050, 2080</li><li>Scenarios: RCP4.5, RCP8.5</li><li>5 climate models</li><li><strong>Metadata &amp; Data Download:</strong> <a href="https://wri-projects.s3.amazonaws.com/AqueductFloodTool/download/v2/index.html">https://wri-projects.s3.amazonaws.com/AqueductFloodTool/download/v2/index.html</a></li><li><strong>Methodology</strong>: <a href="https://www.wri.org/research/aqueduct-floods-methodology">https://www.wri.org/research/aqueduct-floods-methodology</a></li><li><a href="https://www.wri.org/applications/aqueduct/floods/#/?p=eyJjb21tb24iOnsiZ2VvZ3VuaXRfdW5pcXVlX25hbWUiOiJKYXBhbiIsInNjZW5hcmlvIjoiYnVzaW5lc3MgYXMgdXN1YWwifSwiaGF6YXJkIjp7InllYXIiOiIyMDgwLjAiLCJmbG9vZCI6ImludW5yaXZlciIsInNjZW5hcmlvIjoicmNwOHA1IiwicHJvamVjdGlvbl9tb2RlbCI6IjAwMDBHRkRMLUVTTTJNIiwic3ViX3NjZW5hcmlvIjp0cnVlfSwicmlzayI6eyJzY2VuYXJpbyI6ImJ1c2luZXNzIGFzIHVzdWFsIiwiZmxvb2QiOiJyaXZlcmluZSIsImV4cG9zdXJlIjoidXJiYW5fZGFtYWdlX3YyIiwiZXhpc3RpbmdfcHJvdCI6bnVsbCwic3ViX3NjZW5hcmlvIjpmYWxzZSwiYWR2YW5jZWRfc2V0dGluZ3MiOmZhbHNlfSwiY2JhIjp7ImV4aXN0aW5nX3Byb3QiOm51bGwsInByb3RfZnV0IjpudWxsLCJyZWZfeWVhciI6MjA1MCwiaW1wbGVtZW50YXRpb25fc3RhcnQiOjIwMjAsImltcGxlbWVudGF0aW9uX2VuZCI6MjA0MCwiaW5mcmFzdHJ1Y3R1cmVfbGlmZSI6ODAsImJlbmVmaXRzX3N0YXJ0IjoyMDI1LCJ1c2VyX3VyYl9jb3N0IjpudWxsLCJkaXNjb3VudF9yYXRlIjo1LCJvbV9jb3N0cyI6MX0sImFjdGl2ZUxheWVycyI6WyI3MjAyMTIzNS00OGFmLTQ3ZGUtYWJlZC05NzU2OGFlZTMyZDQiLCI5NjI2MjA3My0xNDVkLTQ1ZWUtODYwYS00ZDZlNjAwMjQ5MWMiLCIxNWYzZTk0NC0yM2U2LTRjOGQtYjcyYy0wM2RjZDFmNDllODYiLCJlNmYxYWYzMi0yMWEzLTRjODgtYjY0Ni0zNWZhZmZlM2NkNmQiLCI5N2U0MTU2OS1lOTVhLTQ0MWQtYmVhMi01YTJlNGM3MjQyZjMiLCI3ZTc1ZDIxMC0yZWZhLTQ1YmMtYTJiNC04OTQ3YzU1NTQ0OWMiLCIwYjY4OGEyZC02ZGFjLTQ3YzItOTFjMS05NGYyYzI4OTFkMDYiLCI5MTAxNTc2ZS0zZjI4LTQ1MTUtYjE5Yi00MGU5NzQ2ODQ0ZmEiLCJhNTk3MTExMy1kOGFkLTQ0MzAtYmQ0MC1iNzAyNTBjMTBmNjYiXSwibWFwIjp7ImJvdW5kcyI6eyJiYm94IjpbOTQuNDE2NTAzOTA2MjUwMDEsMTguMTU2MjkxNDAyODM1NDUsMTA4LjQ3OTAwMzkwNjI1MDAxLDEyLjU5NzQ1NDUwNDgzMjAwNV19LCJiYXNlbWFwIjoiaHlkcm8iLCJib3VuZGFyaWVzIjp0cnVlLCJyZXR1cm5QZXJpb2QiOiIxMDAwIn19"><strong>Web app visualization</strong></a></li></ul><h4>9. [USAID, NASA, ADPC] HydraFloods Viewer</h4><ul><li>Hydrologic Remote Sensing Analysis for Floods (HYDRAFloods)</li><li>แผนที่บริเวณน้ำท่วม (flood extent) โดยคำนวณมาจากภาพถ่ายดาวเทียม (Satellite-derived) <strong>หมายเหตุ: </strong>แผนที่มีความล่าช้าประมาณ 1–2 วัน</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9pBElz6QPR20TQ9D" /></figure><p>ผู้เขียนขอเรียกร้องให้รัฐบาลจัดทำชุดข้อมูลเปิดแผนที่น้ำท่วมความละเอียดสูงเพื่อให้ประชาชนสามารถเข้าถึงได้ และสามารถวางแผนปรับตัวชีวิตทรัพย์สินและบ้านเรือนเพื่อที่จะรับมือกับน้ำท่วมที่เกิดขึ้นในปัจจุบัน และน้ำท่วมในอนาคตที่มีแนวโน้มที่รุนแรงขึ้นจากภาวะโลกร้อน</p><p>อ่านบทความที่เกี่ยวข้องเพิ่มเติม:</p><ul><li><a href="https://gainsira.medium.com/3-%E0%B8%AA%E0%B8%B4%E0%B9%88%E0%B8%87%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%84%E0%B8%97%E0%B8%A2%E0%B8%95%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%97%E0%B8%B3%E0%B8%95%E0%B8%AD%E0%B8%99%E0%B8%99%E0%B8%B5%E0%B9%89%E0%B9%80%E0%B8%9E%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%A3%E0%B8%B1%E0%B8%9A%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B8%81%E0%B8%B1%E0%B8%9A-climate-change-aadf502052e1">3 สิ่งที่ไทยต้องเริ่มทำตอนนี้เพื่อรับมือกับ Climate change</a></li><li><a href="https://blogs.adb.org/blog/words-matter-stop-using-phrase-natural-disasters">Words Matter: Stop Using the Phrase ‘Natural Disasters’</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11fc1f6e32fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 สิ่งที่ไทยต้องเริ่มทำตอนนี้เพื่อรับมือกับ Climate change]]></title>
            <link>https://gainsira.medium.com/3-%E0%B8%AA%E0%B8%B4%E0%B9%88%E0%B8%87%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%84%E0%B8%97%E0%B8%A2%E0%B8%95%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%97%E0%B8%B3%E0%B8%95%E0%B8%AD%E0%B8%99%E0%B8%99%E0%B8%B5%E0%B9%89%E0%B9%80%E0%B8%9E%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%A3%E0%B8%B1%E0%B8%9A%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B8%81%E0%B8%B1%E0%B8%9A-climate-change-aadf502052e1?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/aadf502052e1</guid>
            <category><![CDATA[adaptation]]></category>
            <category><![CDATA[thailand]]></category>
            <category><![CDATA[climate-risk]]></category>
            <category><![CDATA[early-warning-systems]]></category>
            <category><![CDATA[climate-change]]></category>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Sun, 07 Jan 2024 05:08:12 GMT</pubDate>
            <atom:updated>2024-01-15T09:55:58.968Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*frJ9bAb0YUqCIS3Y" /></figure><p>ปี 2023 เป็นปีที่คนไทยตระหนักถึงผลกระทบจาก Climate Change เป็นอย่างมาก หลายสื่อเริ่มให้ความสนใจ และประชาชนก็เริ่มรับรู้ถึงผลกระทบจากความเสียหายต่างๆ ประเทศไทยเป็นประเทศที่เคยได้รับความเสียหายจากภัยพิบัติสูงเป็นอันดับต้นๆของโลก และมีแนวโน้มว่าภัยในอนาคตจะยิ่งทวีคูณ การปรับตัวในการอยู่ร่วมกับสภาพภูมิอากาศและอากาศที่แปรปรวนในอนาคตจึงเป็นสิ่งที่สำคัญ และนี้คือ 3 สิ่งที่ไทยควรจะเริ่มทำตอนนี้ เพื่อปรับตัวและลดความเสียหายที่กำลังเกิดขึ้นจะเกิดขึ้นในอนาคตจาก Climate Change</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*faRO96XT5JmoI9tMI3YNtg.png" /><figcaption>จำนวนภัยพิบัติที่เกิดขึ้นในประเทศไทย จาก <a href="https://climatedata.imf.org/">https://climatedata.imf.org/</a></figcaption></figure><h4><strong>1. ระบบแจ้งเตือนล่วงหน้า (Early warning system)— พูดกันมาไม่รู้กี่รอบกี่รัฐบาล แต่สุดท้ายก็ไม่มีใครทำสำเร็จ</strong></h4><ul><li><strong>หน่วยงานที่รับผิดชอบต้องมี SOP กับ KPI ที่ชัดเจนและเผยแพร่ต่อสาธารณะ</strong> ไม่ว่าจะเป็น กรมอุตุนิยมวิทยา, สำนักทรัพยากรน้ำแห่งชาติ, กรมป้องกันและบรรเทาสาธารณภัย, หรือ กสทช ต้องมีโครงสร้างการทำงานร่วมกันที่ชัดเจน 24/7 และรับผิดชอบในกรณีที่ไม่สามารถทำงานตามขอบเขตและหน้าที่ของตัวเองที่ตกลงกันไว้ ถ้าหากการทำงานข้ามหน่วยงานกันเป็นอุปสรรคหรือทับซ้อน ก็ควรจะตั้งหน่วยงานใหม่ที่รวมศูนย์เพื่อการแจ้งเตือนโดยเฉพาะ</li><li><strong>ทุกภัยพิบัตที่เกิดขึ้น จะต้องมีการจดบันทึกและเผยแพร่เวลาการทำงาน </strong>การแจ้งเตือน รวมไปถึงเวลาตัดสินใจที่ชัดเจน เพื่อที่จะสามารถนำไปพัฒนาและแก้ไขการทำงานในครั้งถัดไปให้มีประสิทธิภาพและรวดเร็วมากขึ้น KPI ควรจะเป็นการแจ้งเตือนที่ถูกต้องและแม่นยำตามพื้นที่ และสามารถแจ้งเตือนล่วงหน้าได้ทันท่วงทีให้ประชาชนมีเวลาได้เตรียมตัว (อย่างน้อย 2–3 วัน)</li><li><strong>แผนที่และโมเดลในการแจ้งเตือนจะต้องทำด้วยความละเอียดสูง</strong> (high resolution) กรมอุตุมีโมเดลพยากรณ์อากาศความละเอียดสูงถึง 1–2 กม. แต่ปัจจุบันกลับแจ้งเตือนแค่ในระดับจังหวัด/ภูมิภาค ซึ่งไม่เป็นประโยชน์ต่อประชาชน เพราะพื้นที่นั้นใหญ่เกินไปและไม่เจาะจงพอ ปัจจุบันแผนที่ความสูง public ทั่วโลกมีความละเอียดถึง 30m เช่น <a href="https://spacedata.copernicus.eu/collections/copernicus-digital-elevation-model">Copernicus DEM</a> ซึ่งสามารถนำมาใช้ในการ<strong>รันโมเดลน้ำท่วม</strong>และภัยพิบัติอื่นๆได้อย่างเจาะจง และหลายหน่วยงานในไทยก็ได้มีการจัดซื้อ High Performance Computing และมีความสามารถในการรันโมเดลเหล่านี้อยู่แล้ว <strong>การแจ้งเตือนไม่ควรจะบอกแค่ว่าจังหวัดไหนฝนจะตกหนัก แต่ควรจะบอกถึงระดับตำบล/หมู่บ้าน/พื้นที่ ว่าที่ไหนมีโอกาสเสี่ยงน้ำท่วมที่มีความรุนแรงระดับใด </strong>และแจ้งเตือนไปยังกลุ่มเป้าหมายแบบเจาะจง</li><li><strong>เชื่อมต่อกับ Emergency Alert ของ Apple และ Android —</strong> ปัจจุบันไทยมีแผนที่เสี่ยง/การแจ้งเตือนจากหลายหน่วยงาน แต่ไม่มี Product ของหน่วยงานไหนเลยที่แจ้งเตือนถึงประชาชน มีความพยายามของกสทช.ที่จะส่ง SMS แจ้งเตือน แต่ก็ไม่ต่อเนื่องและเหมือนจะไม่ทำงานอีกต่อไปแล้ว การเชื่อมต่อกับระบบของ Apple และ Android จึงเป็นสิ่งที่ง่ายที่สุด ถูกที่สุด และเข้าถึงประชาชนมากที่สุด ปัจจุบัน Apple weather app ก็ได้มีความพยายามในการใช้ public API ของกรมอุตุ แต่ความถี่ในการอัพเดทกับพื้นที่ในการแจ้งเตือนก็ยังไม่ละเอีดยและรวดเร็วเพียงพอ รวมไปถึงยังมีการสื่อสารที่ผิดพลาดเช่น <a href="https://ch3plus.com/news/socialnews/ch3onlinenews/379551">ค.ศ. พ.ศ. ซึ่งแสดงให้เห็นถึงการทำงานที่ไม่สอดคล้องกัน</a></li><li><strong>ซ้อมแจ้งเตือนทุกปีปีละหนึ่งครั้ง </strong>— ถ้าหากไม่มีการซักซ้อมก็ไม่มีทางที่จะรู้ว่าระบบนั้นรันได้จริงๆ การซ้อมแจ้งเตือนและส่ง alert ทดสอบไปยังประชาชนจึงเป็นสิ่งที่จำเป็นและหลายประเทศทำอยู่เป็นประจำ ซึ่งการแจ้งเตือนควรจะมาจากหน่วยงานกลางส่งไปหาทุกคน ส่วนการซักซ้อมนี้ควรจะทำทั้งในระดับครัวเรือนและชุมชน เมื่อเกิดเหตุการณ์ระดับใดจะต้องปฏิบัติตัวอย่างไร ศูนย์อพยพอยู่ที่ไหน เส้นทางการเดินทางเป็นอย่างไร การซ้อมเหล่านี้จะช่วยลดความเสียหายที่เกิดขึ้นจากภัยพิบัติได้มหาศาล</li></ul><h4>2. แผนที่ความเสี่ยงสาธารณะความละเอียดสูง (National Risk Index Map)</h4><ul><li><strong>จัดทำแผนที่ความเสี่ยง</strong>ภัยพิบัติต่างๆความละเอียดสูงและเผยแพร่เป็นสาธารณะให้กับประชาชน รวมไปถึง methodology, dataset, และแหล่งที่มาของข้อมูล แผนที่ความเสี่ยงนี้จะช่วยให้ประชาชนและรัฐบาลสามารถวางแผนความเสี่ยงในชีวิตและทรัพย์สินของตัวเองได้ และทำให้ลดความความเสียหายโดยรวมที่จะเกิดขึ้นจากภัยพิบัติ ในอดีตไทยมีการจัดทำแผนที่ความเสี่ยงจากหลายหน่วยงานรัฐแต่ยัง<strong>ไม่มีแผนที่ใดที่มีความละเอียดสูง (ระดับ asset level) และสามารถนำไปใช้งานได้จริงแบบครอบคลุมทั้งประเทศ</strong></li><li><strong>จัดทำรายงานเมิณความเสี่ยง</strong> โดยใช้ข้อมูลจากแผนที่ความเสี่ยง ประกอบกับข้อมูลอื่นๆและอัพเดททุกปี รายงานควรจะมุ่งเน้นไปที่การเมินความเสี่ยงโดยรวมทั้งประเทศ การประเมินความเสี่ยงเฉพาะพื้นที่ การรับรู้ของประชาชน และแผนการในการปรับตัวกับความเสี่ยงปัจจุบันและอนาคต</li><li>ความเสี่ยง (risk) เกิดจาก 3 ตัวแปร คือ <a href="https://www.preventionweb.net/understanding-disaster-risk/component-risk/disaster-risk">Hazard x Exposure x Vulnerability</a> ซึ่งทั้งสามส่วนนี้ปัจจุบันสามารถคำนวนได้อย่างชัดเจน แผนที่ความเสี่ยงสาธารณะควรจะเผยแพร่:<br>- แผนที่ความเสี่ยงของแต่ละภัยพิบัติ (hazard) ตาม SSP scenarios และ year timestep ไปจนถึง 2100<br>- แผนที่ความเสี่ยงรวม (combined risk) <br>- แผนที่ของ exposure และ vulnerability</li><li>ุตัวอย่างแผนที่ความเสี่ยง: <a href="https://hazards.fema.gov/nri/">FEMA National Risk Index</a>, <a href="https://climatevulnerabilityindex.org/">The U.S. Climate Vulnerability Index</a>, <a href="https://data.london.gov.uk/dataset/climate-risk-mapping">London Climate Risk Mapping</a>, <a href="https://seasia.infrastructureresilience.org/">Southeast Asia Infrastructure Risk Prototype</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTE1readFuorHOaocYhw2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adgraTVB4-8_iCSrX6XlVA.png" /><figcaption>The U.S. Climate Vulnerability Index (ซ้าย), FEMA National Risk Index (ขวา)</figcaption></figure><ul><li>ตัวอย่างรายงานประเมินความเสี่ยง: <a href="https://www.mss-int.sg/V3-climate-projections">Singapore’s Third National Climate Change Study (V3)</a>, <a href="https://www.climateassessment.ca.gov/">California national risk assessment</a>, <a href="https://www.gov.uk/government/publications/uk-climate-change-risk-assessment-2022">UK Climate Change Risk Assessment 2022</a>, <a href="https://www.gov.uk/government/publications/uk-singapore-cop26-universities-network-policy-reports/adaptation-and-resilience-in-asean-managing-disaster-risks-from-natural-hazards">Adaptation and Resilience in ASEAN: managing disaster risks from natural hazards</a>, <a href="https://climatescreeningtools.worldbank.org/">World <br>Bank Climate and Disaster Risk Screening Tools</a> (tool), <a href="https://gfdrr.github.io/CCDR-tools/home.html">World Bank Climate &amp; Disaster Risk Screening Tools (methodology)</a></li></ul><h4>3. นโยบายและแผนรับมือกับ Climate Change แบบรอบด้าน</h4><ul><li>รัฐจำเป็นจะต้องวางแผนรับมือกับสภาพภูมิอากาศในอนาคตแบบรอบด้าน โดยใช้ แผนที่ความเสี่ยงในข้อ 2 และนำไปปรับใช้ และวางแผนกับนโยบายในทุกๆด้าน ไม่ว่าจะเป็นในด้านการลงทุนโครงสร้างพื้นฐาน การจัดสรรงบประมาณและทรัพยากร การวางแผนทางด้านเศรษฐกิจ (เช่น ส่งออก, ท่องเที่ยว, เกษตร, พลังงาน) รวมไปถึงนโยบายที่ส่งเสริมการปรับตัว/การลดความเสียหายจากภัยพิบัติ (mitigation incentive)</li><li>กฎหมายต่างๆจำเป็นจะต้องถูกปรับเพื่อให้หน่วยงานทำงานได้มีประสิทธิภาพมากขึ้น<br>- เพื่อการแจ้งเตือนล่วงหน้าในข้อ 1, การทำแผนที่ความเสี่ยงในข้อ 2 และ การนำข้อมูลความเสี่ยงไปใช้ในการดำเนินการและตัดสินใจ <br>- นอกจากนั้น กฎหมายสิ่งปลูกสร้างและอาคารต่างๆจำเป็นจะต้องอ้างอิงมาตรฐานตามพื้นที่เสี่ยงภัยพิบัติ เช่น มาตรฐานบ้านเรือน/อาคารในพื้นที่เสี่ยง<br>- กฎหมายระดับท้องถิ่น/ภูมิภาค/ส่วนกลางในการจัดการภัยพิบัติระยะสั้น/กลาง/ยาว และความรุนแรงที่แตกต่างกันออกไป รวมไปถึงกลไกในการจ่ายค่าชดเชยความเสียหายที่ชัดเจน และกลไกในการลดความเสียหายที่จะเกิดขึ้นในอนาคต</li><li>แบงค์ชาติจำเป็นต้องเร่งรัดการส่งเสริม/บังคับใช้มาตรฐาน TCFD/IFRS climate risk disclosure และทำ stress test เศรษฐกิจระดับมหภาค เพื่อให้ภาคเอกชน/รัฐบาลเตรียมความพร้อม/มีแผนในการรับมือกับ climate change และเศรษฐกิจโดยรวมสามารถดำเนินต่อไปได้ในกรณีที่เกิดภัยพิบัติร้ายแรง โดยมีเป้าหมายคือการลดความเสียหายจากภัยพิบัติให้ได้มากที่สุดก่อนที่ภัยพิบัติจะเกิดขึ้น</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aadf502052e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DIY Pi Camera]]></title>
            <link>https://gainsira.medium.com/diy-pi-camera-fa3a9cd4a047?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa3a9cd4a047</guid>
            <category><![CDATA[pi-camera]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 06:35:27 GMT</pubDate>
            <atom:updated>2023-09-20T06:35:27.043Z</atom:updated>
            <content:encoded><![CDATA[<p>July 2017, Project length: 5 days</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q196afvIHW4-7TpMiYPCOA@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*42gqMDHk2wxNG4oC1SoevQ@2x.jpeg" /></figure><p><strong>Features</strong></p><ul><li>8 Megapixels</li><li>- 1080p30 Video mode</li><li>- Timelapse</li><li>- WiFi file sync</li><li>- Berrycam iOS app</li><li>- Battery life: 8hrs+ standby</li></ul><p>Buttons: 1 power button, 1 shutter button</p><p>Control: 1 click still, 2 clicks video, 3 clicks timelapse, hold 2 secs WiFi on/off, hold 5 secs power off</p><p>Status display: 1 LED</p><p>Budget: &lt; 2,000 Baht</p><p>Assembly by Dad</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*DVYR1NAp7lCWLYlFok18MQ@2x.jpeg" /></figure><p>DIY pi camera v0.99</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSPl0URnDB9A%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSPl0URnDB9A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSPl0URnDB9A%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b43d512ab9bf28e1c4010f1d8a0dbfa9/href">https://medium.com/media/b43d512ab9bf28e1c4010f1d8a0dbfa9/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa3a9cd4a047" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a tiny earth]]></title>
            <link>https://gainsira.medium.com/building-a-tiny-earth-e1e692d76635?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1e692d76635</guid>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[m5stack]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Sat, 08 Jul 2023 23:07:43 GMT</pubDate>
            <atom:updated>2023-07-08T23:25:41.042Z</atom:updated>
            <content:encoded><![CDATA[<h4>A DIY IoT satellite imagery display</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i367J7kjKCCNUKedW1FxVA.gif" /><figcaption>Example of satellite images on AtomS3 (24mm × 24mm × 13mm)</figcaption></figure><p>Inspired by <a href="https://instagram.com/mohitbhoite">@mohitbhoite</a>, I want to build something that would remind me of space and time. Something that would remind me that I’m living in a tiny earth among billions of stars in a galaxy. It’s easy to forget that when you’re busy with work, family, and life. So what’s better than looking at the earth from the outside in, to see yourself from the space through the lens of the near real-time satellite imagery. Earth’s Weather changes every day, and all living things on earth are affected by it. The shade and sunshine also reflect the time of day better than any digital clock. So here’s how I create my own tiny earth.</p><h3>Hardware:</h3><p>I’ve been wanting to try M5stack for a while as I see a lots of IoT community use M5stack to create so many fun projects. However, I haven’t found any device that I would match my need. After a while, AtomS3 came out last year and it’s perfectly for its simplicity and price.</p><ul><li>M5Stack <a href="https://shop.m5stack.com/products/atoms3-dev-kit-w-0-85-inch-screen">AtomS3</a> ($15.50 + $5 global shipping): WiFi 128x128 pixel display with a push screen button</li></ul><h3>Software:</h3><p>You can use both Arduino and UIFlow to program AtomS3. I chose <a href="https://uiflow2.m5stack.com/">UIFlow 2.0</a> because it supported MicroPython and has a no code dev interface which I have no idea how it work. But I know that kids these day learn how to code using these kind of tools and it would be fun for me to experience how that work as well.</p><p>Before connecting your AtomS3 to UIFlow, you will need to burn the UIFlow 2.0 firmware to your AtomS3 using <a href="https://docs.m5stack.com/en/download">M5Burner</a>. To do that, just download M5Burner form <a href="https://docs.m5stack.com/en/download">here</a>, install it to your pc, and run the program. When M5Burner is open, select ATOMS3 on the left menu, and look for UIFlow2.0 on the main screen. After that, you will need to create your login account. Then, select the latest version of firmware on the right dropdown, click configurate, enter your WiFi name and password, and click Burn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dSXKyo-zUjftDEsmdetq2g.png" /></figure><p>Now when you push a reset button your AtomS3, you can see whether your AtomS3 can connect to WiFi or not. Once it’s connected to WiFi, you should be able to go to <a href="https://uiflow2.m5stack.com/">https://uiflow2.m5stack.com/</a> and start coding. Note that you have to login to the same account you use in M5Burner. You will also need to select your active AtomS3 using the bottom right device selection menu before running/flashing the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pM-MESxR89KV5kmkCrrsZQ.png" /></figure><p>I did try the drag-drop UI tool a bit and was able to do a simple thing like displaying a message on the screen. But other than that, I found it a bit difficult to implement the logic I want. So I switched to the coding tab instead (top center menu, far right icon). The UI tool is still useful for exploring what features/libraries the device has though.</p><p>Now, what I want to do is quite straightforward. I want to display a satellite image and automatically update the image with a fixed interval timer. For the source of the images I use:</p><ul><li><a href="https://www.star.nesdis.noaa.gov/goes/conus.php?sat=G17">NOAA GOES Image Viewer</a> (5 min update interval)</li><li><a href="https://www.data.jma.go.jp/mscweb/data/himawari/">JMA Himawari Real-Time Image</a> (10 min update interval)</li></ul><p>Later on after I finished my first prototype, I feel that the image was too small and I kind of want to zoom in or change the image. So I added more images including west-coast specific image, sandwich, and different region image like Southeast Asia. I use the on-screen push button to switch between images.</p><h3>Code:</h3><p>This is also one of the first project I use ChatGPT to write about 90% of the total code. It’s amazing and save me so much time. I thought I know python but I was wrong because MicroPython functions are very limited and not everything in python works in MicroPython.</p><h4>PHP code on a web server:</h4><p>Since the AtomS3 can only display a 128x128 pixels image, the satellite image will need to be resized somewhere either on AtomS3 itself(not sure if it’s possible with limited memory) or somewhere else like a webserver. In this case, I just wrote a one file PHP script that take in an image URL and display a resized version of that image so that AtomS3 can download it and show it on the screen.</p><pre>&lt;?php<br><br>function downloadResizeAndDisplayImage($imageUrl) {<br>    // Download the image<br>    $imageData = file_get_contents($imageUrl);<br><br>    // Create the image resource from the downloaded image data<br>    $image = imagecreatefromstring($imageData);<br><br>    // Resize the image to 128x128 pixels<br>    $resizedImage = imagescale($image, 128, 128);<br><br>    // Set the appropriate header for image output<br>    header(&#39;Content-Type: image/jpeg&#39;);<br><br>    // Output the resized image<br>    imagejpeg($resizedImage);<br><br>    // Free up memory by destroying the images<br>    imagedestroy($image);<br>    imagedestroy($resizedImage);<br>}<br><br>$imageurl = $_GET[&#39;url&#39;];<br>downloadResizeAndDisplayImage($imageurl);<br><br>?&gt;</pre><h4>MicroPython code for AtomS3:</h4><p>Below is the code for AtomS3. I put it in <a href="https://uiflow2.m5stack.com/">UIFlow</a> code tab and download it to AtomS3.</p><pre>import os, sys, io<br>import M5<br>from M5 import *<br>import socket<br>import time<br>import utime<br>from hardware import *<br><br>image1 = None<br>show_img_num = 0  # start with first image on boot<br>latest_update = 0  # 0 for first run on boot<br>image_dict = [<br>  { # GO-East full disk - GeoColor<br>    &quot;filepath&quot;: &quot;res/img/geoeast_128x128.jpg&quot;,<br>    &quot;url&quot;: &quot;https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/GEOCOLOR/339x339.jpg&quot;<br>  },<br>  {  # GO-East full disk - sandwich<br>    &quot;filepath&quot;: &quot;res/img/sandwitch.jpg&quot;,<br>    &quot;url&quot;: &quot;https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/Sandwich/339x339.jpg&quot;<br>  },<br>  {  # GO-West Pacific coast - geocolor<br>    &quot;filepath&quot;: &quot;res/img/geowest-us_pacific_coast-geocolor.jpg&quot;,<br>    &quot;url&quot;: &quot;https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/wus/GEOCOLOR/250x250.jpg&quot;<br>  },<br>  {  # GO-West Pacific coast - sandwich<br>    &quot;filepath&quot;: &quot;res/img/geowest-us_pacific_coast-sandwich.jpg&quot;,<br>    &quot;url&quot;: &quot;https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/wus/Sandwich/250x250.jpg&quot;<br>  },<br>  {  # Himawari SE true color<br>    &quot;filepath&quot;: &quot;res/img/himawari-se1-visibleb03.jpg&quot;,<br>    &quot;url&quot;: &quot;https://www.data.jma.go.jp/mscweb/data/himawari/img/se1/se1_trm_{}.jpg&quot;<br>  },<br>  {  # Himawari SE sandwich<br>    &quot;filepath&quot;: &quot;res/img/himawari-se1-sandwichsnd.jpg&quot;,<br>    &quot;url&quot;: &quot;https://www.data.jma.go.jp/mscweb/data/himawari/img/se1/se1_snd_{}.jpg&quot;<br>  }<br>]<br><br>def download_image(url, save_path):<br>    # Parse the URL to extract the host and path<br>    host = url.split(&#39;/&#39;)[2]<br>    path = &#39;/&#39; + &#39;/&#39;.join(url.split(&#39;/&#39;)[3:])<br>    <br>    # Establish a socket connection<br>    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>    client_socket.connect((host, 80))<br>    <br>    # Send HTTP GET request<br>    request = f&quot;GET {path} HTTP/1.1\r\nHost: {host}\r\n\r\n&quot;<br>    client_socket.sendall(request.encode())<br>    <br>    # Receive the response<br>    response = b&quot;&quot;<br>    while True:<br>        data = client_socket.recv(512)<br>        if not data:<br>            break<br>        response += data<br>    <br>    # Find the start of the image content<br>    start_index = response.find(b&#39;\r\n\r\n&#39;) + 4<br>    <br>    # Save the image content to a file<br>    with open(save_path, &#39;wb&#39;) as file:<br>        file.write(response[start_index:])<br>    <br>    # Close the socket connection<br>    client_socket.close()<br><br>def get_current_utc_hour_and_minute():<br>    # Subtract 20 minutes (20 minutes * 60 seconds = 1200 seconds) because himawari delay<br>    current_time = utime.gmtime(utime.time() - 1200)<br>    current_hour = current_time[3]<br>    current_minute = current_time[4] // 10 * 10  # Round down to the nearest 10-minute interval<br>    formatted_time = &quot;{:02d}{:02d}&quot;.format(current_hour, current_minute)<br>    return formatted_time<br><br>def update_earth_image():<br>  global image1<br>  global show_img_num<br>  global image_dict<br>  global latest_update<br><br>  downloaded_image_fp = image_dict[show_img_num][&quot;filepath&quot;]  # local filepath to save to<br>  source_url = image_dict[show_img_num][&quot;url&quot;]<br>  # if Himari images, need to add UTC hour:min -20 min<br>  if show_img_num == 4 or show_img_num == 5:<br>    source_url = source_url.format(get_current_utc_hour_and_minute())<br>  image_url = &quot;https://YOUR_OWN_URL/resize_image.php?url=&quot; + source_url<br>  download_image(image_url, downloaded_image_fp)<br>  image1.setImage(downloaded_image_fp)<br>  latest_update = time.time()<br><br>def btnA_wasClicked_event(state):<br>  global image1<br>  global show_img_num<br>  global image_dict<br><br>  if show_img_num &lt; len(image_dict)-1: # array start from 0<br>    show_img_num += 1<br>  else:<br>    show_img_num = 0<br>  # set image from local filepath<br>  image_local_fp = image_dict[show_img_num][&quot;filepath&quot;]<br>  image_filename = image_local_fp.split(&quot;/&quot;)[-1]<br>  if image_filename in os.listdir(&quot;res/img/&quot;): # micro python doesn&#39;t havve os.path.isfile()<br>    image1.setImage(image_local_fp)<br>  else:  # if image is not exist (hasn&#39;t been downloaded)<br>    image1.setImage(&quot;res/img/uiflow.jpg&quot;)<br>    update_earth_image()<br><br>def setup():<br>  global image1<br>  global show_img_num<br>  global image_dict<br><br>  M5.begin()<br>  image1 = Widgets.Image(image_dict[show_img_num][&quot;filepath&quot;], 0, 0)<br><br>def loop():<br>  global latest_update<br>  M5.update()<br>  BtnA.setCallback(type=BtnA.CB_TYPE.WAS_CLICKED, cb=btnA_wasClicked_event)<br>  # Update every 8 min (480 s), the rest of time is waiting if button is press to toggle image<br>  # 8 min is from NOAA image update interval 10 min minus update_earth_image() that takes 2 min to finish<br>  if time.time() - latest_update &gt;= 480 or latest_update == 0:<br>    # zero when first run from global var initialization at the top<br>    try:  # just in case there&#39;s no internet an get error<br>      update_earth_image()  # download latest image and set to display<br>    except Exception:<br>      time.sleep(10)<br><br>if __name__ == &#39;__main__&#39;:<br>  try:<br>    setup()<br>    while True:<br>      loop()<br>  except (Exception, KeyboardInterrupt) as e:<br>    try:<br>      from utility import print_error_msg<br>      print_error_msg(e)<br>    except ImportError:<br>      print(&quot;please update to latest firmware&quot;)</pre><p>I hope you enjoy coding and making your own tiny earth! I would love to hear from you if you’re building something fun.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1e692d76635" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DIY indoor PM2.5 and weather station]]></title>
            <link>https://gainsira.medium.com/diy-indoor-pm2-5-and-weather-station-db2ccc8a24ac?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/db2ccc8a24ac</guid>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 03:02:29 GMT</pubDate>
            <atom:updated>2023-02-05T04:57:44.802Z</atom:updated>
            <content:encoded><![CDATA[<p>TBH, you don’t really need this. You need a Clean Air Act and a strong enforcement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkdC3Ve0qe-NezTXAXZtIA.jpeg" /></figure><p>It’s an air pollution season again in Bangkok and the PM2.5 values jump super high every single day when it’s cold (because it usually come with low ventilation). Based on my observation, the PM2.5 values are highly correlated with the minimum daily temperature and night time temperature.</p><p>Since I wrote an article on “<a href="https://gainsira.medium.com/pm2-5-%E0%B8%81%E0%B8%B1%E0%B8%9A-data-science-ac1a89940a19">PM2.5 andData science</a>” back in 2019, one things that was clear to me at that time was that we didn’t have enough data. Fast forward 4 years after, we have plenty of air quality stations with times series data. Numerous studies have been published since then. But the air quality problem still exist even though we know the cause. It’s crispy clear to me that unless we have a clean air act and a strong enforcement, we are going to kill 22,000+ people in Thailand every year accroding to the <a href="https://www.greenpeace.org/thailand/publication/23793/climate-airpollution-cost-estimate-report/">Greenpeace study</a>. I also want to urge the Thai government agencies and the Bangkok governer to STOP using an observation data to inform people. Instead, they should use <a href="http://ozone.tmd.go.th/wi.htm">PM2.5 forecast data</a> to notify people and implement countermeasure policies in advance (1 week ahead).</p><p>Now, if you’re still want to make your own PM2.5 + weather station, you can follow my notes below. Just a heads up, it’s not well structured and doesn’t have a clear outline. This article is kinda in my draft box for a long time and I never finish it. Today is the day and I just gonna give you a bunch of links and codes that I use to make this weather station. Enjoy!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*AbFBlJdRbcWEfkbH6zgVpw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*9MhSt-OMch-Jq6BkqTdo2g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*MV9FZBkIlgFBIdCUxeVNZw.jpeg" /><figcaption>Example of PM2.5 measurement devices in the market</figcaption></figure><h4><strong>Why make your own when you can buy one?</strong></h4><ul><li>Most PM2.5 monitor devices are pretty expensive</li><li>They don’t store time series data or even if they do you can’t really export the data for your own analysis.</li><li>They don’t have an online dashboard for easy access and sharing</li><li>They can’t send you a notification to your phone.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*oI4MT4ZBKmLOJhLB_dfwcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*tiwvH2fg2PwLp_oNszTMZA.png" /><figcaption>Example of customized LINE messages notification</figcaption></figure><h4><strong>Hardware:</strong></h4><ul><li><a href="https://www.raspberrypi.com/products/raspberry-pi-zero/">Raspberry Pi Zero W</a> — $15 (there’s a newer version as well)</li><li>8GB or more micro SD card — $10</li><li><a href="https://www.ebay.com/sch/i.html?_from=R40&amp;_nkw=bme280+sensor&amp;_sacat=0&amp;LH_TitleDesc=0&amp;LH_BIN=1&amp;_sop=12">BME280</a> Humidity + Barometric Pressure + Temperature Sensor — $6</li><li><a href="https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=p2334524.m570.l1313&amp;_nkw=nova+SDS011+pm2.5+sensor&amp;_sacat=0&amp;LH_TitleDesc=0&amp;_odkw=nova+pm2.5+sensor&amp;_osacat=0&amp;LH_BIN=1&amp;_sop=12">Nova SDS011 PM2.5 sensor</a> — $25</li><li>(Optional) <a href="https://www.raspberrypi.com/products/raspberry-pi-zero-case/">Raspberry Pi Zero Case</a> — $7.5</li><li>(Optional) Male Header 2.54mm 2x20pin Strips for Raspberry Pi Zero — ($1-5) You can skip this, if you will solder the BME280 pin to Pi Zero directly.</li><li>Micro usb cable</li><li>Any 1A USB wall charger from your phone charger — $4</li></ul><h4><strong>Tutorial:</strong></h4><ul><li>Wiring BME280 to Pi Zero and log data to Google Sheet. <a href="http://www.whatimade.today/log-sensor-data-straight-to-google-sheets-from-a-raspberry-pi-zero-all-the-python-code/">http://www.whatimade.today/log-sensor-data-straight-to-google-sheets-from-a-raspberry-pi-zero-all-the-python-code/</a> You will need to install some required libraries.</li><li>My own customized Google Sheet records and dashboard template (first sheet for dashboard, second sheet for database) <a href="https://docs.google.com/spreadsheets/d/1jlIFYC5jX6VwQpo9WIazYc_JqgUb1-hSP5tGemHzzWk/edit?usp=sharing">https://docs.google.com/spreadsheets/d/1jlIFYC5jX6VwQpo9WIazYc_JqgUb1-hSP5tGemHzzWk/edit?usp=sharing</a></li><li>Code snippet for reading data from NOVA SDS011 PM2.5 sensor <a href="https://gist.github.com/kadamski/92653913a53baf9dd1a8">https://gist.github.com/kadamski/92653913a53baf9dd1a8</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8FDGPEyuamMU4zV5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGKgAnLlke_1h48T471KuQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*5iB9ZARCrZyoGYffRkkQVQ.jpeg" /><figcaption>The end product of my messy device. I use a buch of tape to stick them together.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jcmgH6TzEHfQR5Ym" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*sjKMgZolVOCPhg4vpWW4UQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/0*SlyhvxaB6hv59Dzi" /><figcaption>Sometimes when I cook with oil and I didn’t open the window, the PM2.5 value jump pretty high. So don’t forget about ventilation when you cook!</figcaption></figure><h4><strong>Here’re the code I adapted from the tutorial:</strong></h4><ol><li><strong>log_pm25_sample.py</strong></li></ol><ul><li>Read PM2.5 and PM10 values from the sensor for 30 seconds</li><li>Averages each PM value across 30s</li><li>Save data to pm25.json</li></ul><pre>#!/usr/bin/python -u<br># coding=utf-8<br># &quot;DATASHEET&quot;: http://cl.ly/ekot<br># https://gist.github.com/kadamski/92653913a53baf9dd1a8<br>from __future__ import print_function<br>import serial, struct, sys, time, json, subprocess<br><br>DEBUG = 0<br>CMD_MODE = 2<br>CMD_QUERY_DATA = 4<br>CMD_DEVICE_ID = 5<br>CMD_SLEEP = 6<br>CMD_FIRMWARE = 7<br>CMD_WORKING_PERIOD = 8<br>MODE_ACTIVE = 0<br>MODE_QUERY = 1<br>PERIOD_CONTINUOUS = 0<br><br>JSON_FILE = &#39;/home/pi/pm25.json&#39;<br><br>MQTT_HOST = &#39;&#39;<br>MQTT_TOPIC = &#39;/weather/particulatematter&#39;<br><br>ser = serial.Serial()<br>ser.port = &quot;/dev/ttyUSB0&quot;<br>ser.baudrate = 9600<br><br>ser.open()<br>ser.flushInput()<br><br>byte, data = 0, &quot;&quot;<br><br>def dump(d, prefix=&#39;&#39;):<br>    print(prefix + &#39; &#39;.join(x.encode(&#39;hex&#39;) for x in d))<br><br>def construct_command(cmd, data=[]):<br>    assert len(data) &lt;= 12<br>    data += [0,]*(12-len(data))<br>    checksum = (sum(data)+cmd-2)%256<br>    ret = &quot;\xaa\xb4&quot; + chr(cmd)<br>    ret += &#39;&#39;.join(chr(x) for x in data)<br>    ret += &quot;\xff\xff&quot; + chr(checksum) + &quot;\xab&quot;<br><br>    if DEBUG:<br>        dump(ret, &#39;&gt; &#39;)<br>    return ret<br><br>def process_data(d):<br>    r = struct.unpack(&#39;&lt;HHxxBB&#39;, d[2:])<br>    pm25 = r[0]/10.0<br>    pm10 = r[1]/10.0<br>    checksum = sum(ord(v) for v in d[2:8])%256<br>    return [pm25, pm10]<br>    #print(&quot;PM 2.5: {} μg/m^3  PM 10: {} μg/m^3 CRC={}&quot;.format(pm25, pm10, &quot;OK&quot; if (checksum==r[2] and r[3]==0xab) else &quot;NOK&quot;))<br><br>def process_version(d):<br>    r = struct.unpack(&#39;&lt;BBBHBB&#39;, d[3:])<br>    checksum = sum(ord(v) for v in d[2:8])%256<br>    print(&quot;Y: {}, M: {}, D: {}, ID: {}, CRC={}&quot;.format(r[0], r[1], r[2], hex(r[3]), &quot;OK&quot; if (checksum==r[4] and r[5]==0xab) else &quot;NOK&quot;))<br><br>def read_response():<br>    byte = 0<br>    while byte != &quot;\xaa&quot;:<br>        byte = ser.read(size=1)<br><br>    d = ser.read(size=9)<br><br>    if DEBUG:<br>        dump(d, &#39;&lt; &#39;)<br>    return byte + d<br><br>def cmd_set_mode(mode=MODE_QUERY):<br>    ser.write(construct_command(CMD_MODE, [0x1, mode]))<br>    read_response()<br><br>def cmd_query_data():<br>    ser.write(construct_command(CMD_QUERY_DATA))<br>    d = read_response()<br>    values = []<br>    if d[1] == &quot;\xc0&quot;:<br>        values = process_data(d)<br>    return values<br><br>def cmd_set_sleep(sleep):<br>    mode = 0 if sleep else 1<br>    ser.write(construct_command(CMD_SLEEP, [0x1, mode]))<br>    read_response()<br><br>def cmd_set_working_period(period):<br>    ser.write(construct_command(CMD_WORKING_PERIOD, [0x1, period]))<br>    read_response()<br><br>def cmd_firmware_ver():<br>    ser.write(construct_command(CMD_FIRMWARE))<br>    d = read_response()<br>    process_version(d)<br><br>def cmd_set_id(id):<br>    id_h = (id&gt;&gt;8) % 256<br>    id_l = id % 256<br>    ser.write(construct_command(CMD_DEVICE_ID, [0]*10+[id_l, id_h]))<br>    read_response()<br><br># def pub_mqtt(jsonrow):<br>#     cmd = [&#39;mosquitto_pub&#39;, &#39;-h&#39;, MQTT_HOST, &#39;-t&#39;, MQTT_TOPIC, &#39;-s&#39;]<br>#     print(&#39;Publishing using:&#39;, cmd)<br>#     with subprocess.Popen(cmd, shell=False, bufsize=0, stdin=subprocess.PIPE).stdin as f:<br>#         json.dump(jsonrow, f)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    #cmd_set_sleep(0)<br>    cmd_firmware_ver()<br>    cmd_set_working_period(PERIOD_CONTINUOUS)<br>    cmd_set_mode(MODE_QUERY);<br><br>    #while True:<br><br>    #cmd_set_sleep(0)<br>    pm25 = 0<br>    pm10 = 0<br>    n = 0<br>    for t in range(30):<br>        values = cmd_query_data();<br>        if values is not None and len(values) == 2:<br>          n += 1<br>          print(t+1, &quot;PM2.5: &quot;, values[0], &quot;, PM10: &quot;, values[1])<br>          pm25 += values[0]<br>          pm10 += values[1]<br>          time.sleep(1)<br><br>    if pm25 != 0 and pm10 != 0:<br>        avg_pm25 = round(pm25/n, 1)<br>        avg_pm10 = round(pm10/n, 1)<br>        with open(JSON_FILE, &#39;w&#39;) as outfile: # overwrite<br>            data = {&#39;pm25&#39;: avg_pm25, &#39;pm10&#39;: avg_pm10, &#39;time&#39;: time.strftime(&quot;%d/%m/%Y %H:%M:%S&quot;)}<br>            json.dump(data, outfile)<br>        print(&quot;Save! avg_pm25: &quot;, str(avg_pm25), &quot;avg_pm10: &quot;, str(avg_pm10), &quot;time: &quot;, str(time.strftime(&quot;%d/%m/%Y %H:%M:%S&quot;)))<br>    else:<br>        print(&quot;Error: pm2.5, pm10 value are&quot;, pm25, pm10)</pre><p><strong>2. update_google_sheet.py</strong></p><ul><li>This script reads weather data from BME280 sensor and averaged PM2.5 log from pm25.json file</li><li>Delete pm25.json file</li><li>Push a new record to Google Sheet. (The dashboard is automatically updated right away and the published google sheet website is automatically updated every 5 minutes).</li></ul><pre># -*- coding: utf-8 -*-<br># python 2.7<br><br># import many libraries<br>from __future__ import print_function  <br>from googleapiclient.discovery import build  <br>from httplib2 import Http  <br>from oauth2client import file, client, tools  <br>from oauth2client.service_account import ServiceAccountCredentials  <br>import bme280  <br>import datetime<br>import json<br>import os<br>import requests<br><br># My Spreadsheet ID ... See google documentation on how to derive this<br>MY_SPREADSHEET_ID = &#39;CHANGE_THIS_TO_YOUR_SHEET_ID&#39;<br><br><br>def update_sheet(sheetname, temperature, pressure, humidity, pm25=None, pm10=None):  <br>    &quot;&quot;&quot;update_sheet method:<br>       appends a row of a sheet in the spreadsheet with the <br>       the latest temperature, pressure and humidity sensor data<br>    &quot;&quot;&quot;<br>    # authentication, authorization step<br>    SCOPES = &#39;https://www.googleapis.com/auth/spreadsheets&#39;<br>    creds = ServiceAccountCredentials.from_json_keyfile_name(&#39;bme280-277321-f53e48a3ec9f.json&#39;, SCOPES)<br>    service = build(&#39;sheets&#39;, &#39;v4&#39;, http=creds.authorize(Http()))<br><br>    # Call the Sheets API, append the next row of sensor data<br>    # values is the array of rows we are updating, its a single row<br>    values = [ [ str(datetime.datetime.now()), temperature, pressure, humidity, pm25, pm10 ] ] # &#39;Temperature&#39;, temperature, &#39;Pressure&#39;, pressure, &#39;Humidity&#39;, humidity ] ]<br>    body = { &#39;values&#39;: values }<br>    # call the append API to perform the operation<br>    result = service.spreadsheets().values().append(<br>                spreadsheetId=MY_SPREADSHEET_ID, <br>                range=sheetname + &#39;!A1:G1&#39;,<br>                valueInputOption=&#39;USER_ENTERED&#39;, <br>                insertDataOption=&#39;INSERT_ROWS&#39;,<br>                body=body).execute()                     <br><br><br>def readPMLog(file_path):<br>    try:<br>        with open(file_path) as f:<br>          data = json.load(f)<br>          return data[&#39;pm25&#39;], data[&#39;pm10&#39;]<br>        os.remove(pm25_db_path)<br>    except:<br>        return None, None<br><br><br>def main():  <br>    &quot;&quot;&quot;main method:<br>       reads the BME280 chip to read the three sensors, then<br>       call update_sheets method to add that sensor data to the spreadsheet<br>    &quot;&quot;&quot;<br>    bme = bme280.Bme280()<br>    bme.set_mode(bme280.MODE_FORCED)<br>    tempC, pressure, humidity = bme.get_data()<br>    pressure = pressure/100.<br>    <br>    pm25_db_path = &#39;/home/pi/pm25.json&#39;<br>    pm25, pm10 = readPMLog(pm25_db_path)<br><br>    # print(str(datetime.datetime.now()))<br>    # print (&#39;Temperature: %f °C&#39; % tempC)<br>    # print (&#39;Pressure: %f hPa&#39; % pressure)<br>    # print (&#39;Humidity: %f %%rH&#39; % humidity)<br>    print(str(datetime.datetime.now()), &#39;,&#39;, str(tempC), &#39;,&#39;, str(pressure), &#39;,&#39;, str(humidity),<br>        &#39;,&#39;, str(pm25), &#39;,&#39;, str(pm10))<br>    # # alert to line bot (You need to setup your own line bot webhook)<br>    # if pm25 &gt; 10:<br>    #     alert_msg = &quot;PM2.5 Alert: &quot; + str(pm25) + &quot; µg/m³&quot;<br>    #     lineid = &quot;XXXXXXXXXXXXXXXXXXXXXXX&quot;<br>    #     url = &#39;http://your_line_bot_webhook.com/push.php?lineid=&#39;+lineid+&#39;&amp;msg=&#39;+alert_msg<br>    #     requests.get(url)<br>    # send log to google sheet<br>    update_sheet(&quot;Sheet1&quot;, tempC, pressure, humidity, pm25, pm10)<br><br><br>if __name__ == &#39;__main__&#39;:  <br>    main()</pre><p><strong>3. Set up crontab schedule to run the scripts automatically</strong></p><ul><li>Run “crontab -e” to create/edit crontab</li><li>Change the path and how you want to run it all you want, and put the code below in your crontab setting.</li><li>“&gt;&gt; log.txt 2&gt;&amp;1” at the end mean save the log as well when the script get run</li><li>In this example, the cron jobs will run <strong>log_pm25_sample.py </strong>every 9th minute and <strong>update_google_sheet.py</strong> every 10th minute.</li></ul><pre>*/9 * * * * python log_pm25_sample.py<br>*/10 * * * * (cd /home/pi/bme280-project/python-bme280/; python update_google_sheet.py &gt;&gt; log.txt 2&gt;&amp;1)</pre><h4>PM2.5 prediction API</h4><p>You can also use some air quality API to get the current value and the forecast as well. In this case, I use Tomorrow.io API and connected to my LINE chat bot to send me an alert when the current/future PM2.5 value exceed the threshold I set. The PM2.5 value from the API doesn’t really match with the real local pm2.5 values, but the up/down trends are pretty reliable.</p><p><a href="https://www.tomorrow.io/air-quality/">Air Quality</a></p><p>API: <a href="https://www.tomorrow.io/weather-api/">https://www.tomorrow.io/weather-api/</a> Free 500 calls/day, 25 calls/hr, 3 calls/s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GMI-ecjxA3AEORVPk7adBA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db2ccc8a24ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My 2019 Idea List]]></title>
            <link>https://gainsira.medium.com/my-2019-idea-list-856397eac635?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/856397eac635</guid>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Fri, 03 Feb 2023 07:03:48 GMT</pubDate>
            <atom:updated>2023-02-03T07:03:48.643Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@gaingain/my-2018-idea-list-a4e3664765b7">2018</a>, <a href="https://medium.com/@gaingain/my-idea-list-that-i-never-do-5779e102c20c">2017</a></p><p>1. Chat app by keyword room e.g. your old highschool year, class year <br>2. Angelist for thailand: list startup jobs, invest in startup, startup status update — set.or.th + getlink + producthunt localize<br>3. Thaicheapo like tokyocheapo.com<br>4. Curate list of zero waste resources<br>5. Q&amp;A + freelance from locals app for tourist / location base <br>6. Rainviewer like but use satellite data (GSMap)<br>7. Sales prediction + stock management for small food stall<br>8. A restaurant where they tell you exactly how much the temperature of that dish is right now so it doesn’t burn your toung<br>9. The informal linkedin for your school year. What you do, skill, interest, hobby, goal, etc. With out BS<br>10. Chrome extension chatroom by website. Chatting with people who surf the same website with you<br>11. Chrome extension where show user heatmap of most people go to/click on the website<br>12. A restaurant where you have a projector overhead to show what dish will look like in real size <br>13. Code of america for thai — <a href="https://www.opendream.co.th/">https://www.opendream.co.th/</a></p><p>Capstone idea:<br>identify plant switching location opportunities due to climate change e.g. wine from france to Hokkaido because of soil prone to climate change <a href="http://chateaudebousval.be/en">http://chateaudebousval.be/en</a><br>(Cont.) Predictive plant effect on each location using rain+temp satellite data <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6010887">https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6010887</a><br>Find real company, do optimize, win-win, reduce carbon footprint<br>Ocean profile, observation vs. interpolation data in the model<br>Compare coal vs. renewable like carbonbrief japan<br>Climate change to cloud seeding<br>NDVI across Thailand and climate change <br>Improve transportation ucsd</p><p>Find agriculture company<br>Desalination plan — water</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=856397eac635" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2022 Newsletter]]></title>
            <link>https://gainsira.medium.com/2022-newsletter-ea973bf0272b?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea973bf0272b</guid>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 06:32:14 GMT</pubDate>
            <atom:updated>2023-04-06T16:34:59.598Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s the list of newsletters I subscribed to in 2022.</p><ul><li><a href="https://www.deeplearning.ai/the-batch/">The Batch | DeepLearning.AI | AI News &amp; Insights</a></li><li><a href="https://kp.substack.com/">KP&#39;s Column</a></li><li><a href="https://www.deeplearningweekly.com/">Deep Learning Weekly</a></li><li><a href="https://newsletter.climatenexus.org/hot-news-sign-up">Climate Nexus | Sign up for Hot News for Daily News on Climate Change</a></li><li><a href="https://climatebase.org/">Climatebase</a></li><li><a href="https://www.climatechange.ai/">Climate Change AI</a></li><li><a href="https://climateu.substack.com/">Last Week in Climate-Tech</a></li><li><a href="https://investedinclimate.com/">Invested in Climate - Helping people do more to address climate change through work, investment, learning, lifestyle and activism.</a></li><li><a href="https://hbr.org/?utm_medium=email&amp;utm_source=newsletter_weekly&amp;utm_campaign=weeklyhotlist_not_activesubs&amp;deliveryName=DM247305">Harvard Business Review - Ideas and Advice for Leaders</a></li><li><a href="https://www.ycombinator.com/subscribe">Subscribe to YC&#39;s Newsletter | Y Combinator</a></li><li><a href="https://www.ctvc.co/">Climate Tech VC</a></li><li><a href="https://avc.com/">AVC</a></li><li><a href="https://vcdealslist.com/?ref=topofnewsletter&amp;ck_subscriber_id=1441731747&amp;utm_source=convertkit&amp;utm_medium=email&amp;utm_campaign=VCs%2C+Strategics%2C+Sponsors+Continue+To+Run+the+Score+Up+Into+2023+Headwinds%20-%209897501"></a></li><li><a href="https://www.gsb.stanford.edu/insights/subscribe?ct=t%28Stanford-Business-Issue-253-1-22-2023%29&amp;utm_source=Stanford+Business&amp;utm_campaign=2e2fd4f651-Stanford-Business-Issue-253-1-22-2023&amp;utm_medium=email&amp;utm_term=0_0b5214e34b-2e2fd4f651-73901925">Subscribe to Stanford Business Email</a></li><li><a href="https://justinjackson.ca/">Hi, I&#39;m Justin Jackson</a></li><li><a href="https://innovateclimate.substack.com/welcome">Innovate Climate</a></li><li><a href="https://agfundernews.com/newsletter">Newsletter - AFN</a></li><li><a href="https://www.climatetechcocktails.com/">Climate Tech Cocktails</a></li><li><a href="https://time.com/tag/climate-change/">climate change | Time</a></li></ul><p><a href="https://www.bloomberg.com/citylab">https://www.bloomberg.com/citylab</a></p><p><a href="https://read.first1000.co/">First 1000</a></p><p><a href="https://www.coinbase.com/bytes">https://www.coinbase.com/bytes</a></p><ul><li><a href="https://climateaction.tech/">Home - ClimateAction.Tech</a></li><li><a href="https://workonclimate.org/">Home - Work on Climate</a></li><li><a href="https://climate.mit.edu/">Home</a></li><li><a href="https://www.google.com/alerts">Alerts</a></li><li><a href="https://ocfnews.substack.com/">Open Climate Fix&#39;s Substack</a></li><li><a href="https://datacurious.substack.com/">Data Curious</a></li><li><a href="https://www.aon.com/reinsurance/catastropheinsight/default">default</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea973bf0272b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A list of Public transit advocacy TikTokers]]></title>
            <link>https://gainsira.medium.com/a-list-of-public-transit-advocacy-tiktokers-4f586200e1a6?source=rss-9202e7b016f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f586200e1a6</guid>
            <category><![CDATA[tiktok-app]]></category>
            <category><![CDATA[public-transit]]></category>
            <dc:creator><![CDATA[Gain]]></dc:creator>
            <pubDate>Tue, 19 Apr 2022 06:15:34 GMT</pubDate>
            <atom:updated>2024-12-15T07:27:00.990Z</atom:updated>
            <content:encoded><![CDATA[<p>People first, not cars. Like, Share, Get organize, and Demand change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bq5kk94Kkv589IfwD-lgCg.png" /></figure><h4><strong>1. pedestriandignity</strong> — Centering all who👩🏿‍🦽🚶🚏 for transportation, health &amp; 🌎.</h4><p><a href="https://www.tiktok.com/@pedestriandignity">pedestriandignity (@pedestriandignity) TikTok | Watch pedestriandignity&#39;s Newest TikTok Videos</a></p><h4><strong>2. jake_gotta</strong> — A crash course in housing, transit, and urban development</h4><p><a href="https://www.tiktok.com/@jake_gotta">Jacob Gotta (@jake_gotta) TikTok | Watch Jacob Gotta&#39;s Newest TikTok Videos</a></p><h4><strong>3. traingirlsummer</strong> — San Francisco Trains, mobility, and urban history</h4><p><a href="https://www.tiktok.com/@traingirlsummer">traingirlsummer (@traingirlsummer) TikTok | Watch traingirlsummer&#39;s Newest TikTok Videos</a></p><h4>4. mrbarricade — public transit, bikelanes, civilengineering, lifestyle</h4><p><a href="https://www.tiktok.com/@mrbarricade">MrBarricade (@mrbarricade) TikTok | Watch MrBarricade&#39;s Newest TikTok Videos</a></p><h4>5. 1000streetfilms — We’ve changed the world with 1,000+ yummy transportation films.</h4><p><a href="https://www.tiktok.com/@1000streetfilms">Streetfilms (@1000streetfilms) TikTok | Watch Streetfilms&#39;s Newest TikTok Videos</a></p><h4>6. sfmta_muni — Official TikTok of the SFMTA (Muni). We’ve been moving SF since 1912!</h4><p><a href="https://www.tiktok.com/@sfmta_muni">SFMTA_Muni (@sfmta_muni) TikTok | Watch SFMTA_Muni&#39;s Newest TikTok Videos</a></p><h4>7. cyclista_zine — Decolonial feminist critique of bike culture.</h4><p><a href="https://www.tiktok.com/@cyclista_zine">cyclistazine (@cyclista_zine) TikTok | Watch cyclistazine&#39;s Newest TikTok Videos</a></p><h4>8. safestreetrebel — Organizing to save the Great Walkway, Car Free JFK &amp; the whole dang planet! 📍SF</h4><p><a href="https://www.tiktok.com/@safestreetrebel">safestreetrebel (@safestreetrebel) TikTok | Watch safestreetrebel&#39;s Newest TikTok Videos</a></p><h4>9. bikeedmonton — Supporting people riding bicycles in Edmonton since 1980.</h4><p><a href="https://www.tiktok.com/@bikeedmonton">Bike Edmonton (@bikeedmonton) TikTok | Watch Bike Edmonton&#39;s Newest TikTok Videos</a></p><h4>10. telegraphforpeople — Working to make Telegraph Ave car free in Berkeley, CA.</h4><p><a href="https://www.tiktok.com/@telegraphforpeople">telegraphforpeople (@telegraphforpeople) TikTok | Watch telegraphforpeople&#39;s Newest TikTok Videos</a></p><h4>11. driving_is_a_sin — #chicago #carfree #cyclist</h4><p><a href="https://www.tiktok.com/@driving_is_a_sin">Car Free Chicago (@driving_is_a_sin) TikTok | Watch Car Free Chicago&#39;s Newest TikTok Videos</a></p><h4>12. ibikesafe — 🚴 Improving Bicycle Safety for Kids 🚴‍♂️</h4><p><a href="https://www.tiktok.com/@ibikesafe">UHealth BikeSafe Program (@ibikesafe) TikTok | Watch UHealth BikeSafe Program&#39;s Newest TikTok Videos</a></p><h4>13. protectedbikelane — Biking my way around San Francisco</h4><p><a href="https://www.tiktok.com/@protectedbikelane">Brian Hoang (@protectedbikelane) TikTok | Watch Brian Hoang&#39;s Newest TikTok Videos</a></p><h4>14. Utah DOT — Official account for the Utah Department of Transportation. (not really public transit specific but good PR and public engagement)</h4><p><a href="https://www.tiktok.com/@utahdot">Utah DOT (@utahdot) TikTok | Watch Utah DOT&#39;s Newest TikTok Videos</a></p><h3>And much more at #publictransit</h3><p><a href="https://www.tiktok.com/discover/public-transit">Discover public transit &#39;s popular videos | TikTok</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f586200e1a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>