<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vidya Krishnan</title>
    <description>The latest articles on DEV Community by Vidya Krishnan (@anavidya).</description>
    <link>https://dev.to/anavidya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4208971%2F055749f9-f899-48f0-8579-c7e27ea6073e.jpg</url>
      <title>DEV Community: Vidya Krishnan</title>
      <link>https://dev.to/anavidya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anavidya"/>
    <language>en</language>
    <item>
      <title>Teaching an AI to Speak Oceanography: Building an MCP Server for the NERC Vocabulary Server</title>
      <dc:creator>Vidya Krishnan</dc:creator>
      <pubDate>Sun, 15 Nov 2026 19:34:42 +0000</pubDate>
      <link>https://dev.to/anavidya/teaching-an-ai-to-speak-oceanography-building-an-mcp-server-for-the-nerc-vocabulary-server-2c85</link>
      <guid>https://dev.to/anavidya/teaching-an-ai-to-speak-oceanography-building-an-mcp-server-for-the-nerc-vocabulary-server-2c85</guid>
      <description>&lt;h1&gt;
  
  
  Teaching an AI to Speak Oceanography: Building an MCP Server for the NERC Vocabulary Server
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;By Vidya · 26 October 2026&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: confident, plausible, wrong
&lt;/h2&gt;

&lt;p&gt;Ask a general-purpose AI assistant for the vocabulary code of a 'Sea-Bird SBE 911plus CTD' and you will usually get an answer. It will look right. It will often be invented.&lt;/p&gt;

&lt;p&gt;In ocean data, that matters. Controlled vocabularies are how datasets from different ships, countries and decades stay comparable. A parameter code says exactly what was measured and how; a device code says exactly which instrument did it. One hallucinated identifier in a metadata record quietly breaks discovery, aggregation and every downstream user who trusts it.&lt;/p&gt;

&lt;p&gt;So here is a small bridge: an MCP server that lets an AI assistant query the NERC Vocabulary Server directly, in plain English, and answer with real identifiers straight from the source.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the NVS is
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://vocab.nerc.ac.uk/" rel="noopener noreferrer"&gt;NERC Vocabulary Server&lt;/a&gt; (NVS) is the authoritative home for many of the controlled vocabularies used in marine science. It is run by the &lt;a href="https://www.bodc.ac.uk/" rel="noopener noreferrer"&gt;British Oceanographic Data Centre (BODC)&lt;/a&gt;  at the National Oceanography Centre, and it serves SeaDataNet, SeaVoX, CF and many more.&lt;/p&gt;

&lt;p&gt;Under the hood it uses the W3C &lt;a href="https://www.w3.org/2004/02/skos/" rel="noopener noreferrer"&gt;SKOS&lt;/a&gt; model, which has three ideas worth knowing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Collections&lt;/strong&gt; are whole vocabularies, such as L22 (the SeaVoX Device Catalogue), P01 (parameters) or P06 (units).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concepts&lt;/strong&gt; are single terms inside a collection, such as TOOL0058 in L22.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relations&lt;/strong&gt; link concepts: &lt;code&gt;broader&lt;/code&gt; and &lt;code&gt;narrower&lt;/code&gt; for hierarchy, &lt;code&gt;related&lt;/code&gt; for associations, and &lt;code&gt;exactMatch&lt;/code&gt; or &lt;code&gt;closeMatch&lt;/code&gt; for mappings across vocabularies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That graph of relations is the real value. It is also exactly what an AI cannot guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why MCP fits this problem
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://modelcontextprotocol.io" rel="noopener noreferrer"&gt;Model Context Protocol&lt;/a&gt; (MCP) is an open standard for connecting AI assistants to external tools and data. You write a server that exposes a few well-described tools; any MCP-capable client (Claude Desktop, IDE agents and others) can discover and call them.&lt;/p&gt;

&lt;p&gt;That changes the job of the model. It no longer has to &lt;em&gt;remember&lt;/em&gt; vocabulary codes. It has to &lt;em&gt;look them up&lt;/em&gt;, which is something it does well when given the right tool.&lt;/p&gt;

&lt;p&gt;Three properties made MCP the right choice over a bespoke chatbot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reusable.&lt;/strong&gt; One server works across every MCP client, with no front end to maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grounded.&lt;/strong&gt; Every identifier in an answer comes from a live query, so it can be traced back to the NVS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Composable.&lt;/strong&gt; The vocabulary tools sit alongside whatever else the assistant can do, such as reading a NetCDF header and suggesting the right P01 codes for each variable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The design: seven tools, one endpoint
&lt;/h2&gt;

&lt;p&gt;The server is written in Python with &lt;a href="https://github.com/jlowin/fastmcp" rel="noopener noreferrer"&gt;FastMCP&lt;/a&gt; and &lt;code&gt;httpx&lt;/code&gt;. It talks to the NVS &lt;a href="https://vocab.nerc.ac.uk/sparql/" rel="noopener noreferrer"&gt;SPARQL endpoint&lt;/a&gt; for search and graph traversal. No API key is needed.&lt;/p&gt;

&lt;p&gt;![nvs-mcp-diagram]&lt;/p&gt;

&lt;p&gt;The assistant never guesses a code: it calls a tool, the server queries the NVS, and the answer comes back with identifiers the reader can click through to verify.&lt;/p&gt;

&lt;p&gt;The tools are designed around the questions people actually ask, not around the endpoint:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Question it answers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;search_concepts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;"What is the code for X?" Searches labels and definitions, optionally inside one collection.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;list_collections&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;"Which vocabulary should I even be looking in?"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get_collection_info&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;"What is L22, who maintains it and how big is it?"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get_collection_concepts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;"Show me what is in P06." Paginated, because P01 alone is huge.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get_concept_info&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;"Tell me everything about this term." Labels, definition, status and mappings.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get_concept_mappings&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;"What is this connected to?" Broader, narrower, related and cross-vocabulary matches.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sparql_query&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The escape hatch for anything the other six do not cover.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few deliberate choices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scope by collection.&lt;/strong&gt; Searching inside L22 or P01 is faster and far more precise than searching everything, and the tool description tells the model so.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hide deprecated terms by default.&lt;/strong&gt; The model should recommend current codes unless asked otherwise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return structured JSON&lt;/strong&gt; built from Pydantic models, so the model gets consistent fields every time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cap result sizes.&lt;/strong&gt; Even the raw SPARQL tool trims to 200 rows, to protect the model's context window.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accept friendly references.&lt;/strong&gt; A concept can be a full URI or shorthand such as &lt;code&gt;L22:TOOL0058&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  See it in action
&lt;/h2&gt;

&lt;p&gt;Here is a real exchange, run against the live NVS while writing this post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt; &lt;em&gt;"Find the NVS device code for a Sea-Bird SBE 911plus CTD."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The assistant chose &lt;code&gt;search_concepts&lt;/code&gt; with &lt;code&gt;query="SBE 911"&lt;/code&gt; and &lt;code&gt;collection="L22"&lt;/code&gt;. The server returned two current concepts:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Label&lt;/th&gt;
&lt;th&gt;Note from the definition&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://vocab.nerc.ac.uk/collection/L22/current/TOOL0058/" rel="noopener noreferrer"&gt;L22:TOOL0058&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Sea-Bird SBE 911plus CTD&lt;/td&gt;
&lt;td&gt;The off-the-shelf production version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://vocab.nerc.ac.uk/collection/L22/current/TOOL0035/" rel="noopener noreferrer"&gt;L22:TOOL0035&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Sea-Bird SBE 911 CTD&lt;/td&gt;
&lt;td&gt;The earlier custom-built unit, replaced by the 911plus in 1997&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That second row is the point. Without grounding, a model has no reason to know the 911 and the 911plus are separate catalogue entries. With grounding, it can explain the difference and pick the right one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow-up:&lt;/strong&gt; &lt;em&gt;"What is TOOL0058 connected to?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;get_concept_mappings&lt;/code&gt; returned 21 relations. In plain English, the answer reads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It is a kind of&lt;/strong&gt; CTD, salinity sensor and water temperature sensor (L05 device categories).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It is made by&lt;/strong&gt; Sea-Bird Scientific (B75 and L35).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It typically produces&lt;/strong&gt; parameters such as PSALST01 (practical salinity by CTD), TEMPS901 (ITS-90 temperature), CNDCST01 (conductivity) and PRESPR01 (pressure) from P01.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One natural-language question moved from an instrument name, to its catalogue code, to the parameter codes a data manager would put in the metadata. Every identifier came from the NVS itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned building it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tool descriptions are the user interface.&lt;/strong&gt; The model reads the docstring and argument annotations to decide what to call. Writing "use &lt;code&gt;collection&lt;/code&gt; to scope the search, e.g. P01 parameters, L22 devices" changed behaviour more than any code did.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design for questions, not endpoints.&lt;/strong&gt; A single raw SPARQL tool would technically cover everything. In practice the model writes better queries when it has six narrow tools and one escape hatch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Protect the context window.&lt;/strong&gt; Vocabularies are big. Pagination, limits and trimmed results keep answers fast and keep the model focused.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identifiers must be exact, even inside your own server.&lt;/strong&gt; While writing this post, the shorthand &lt;code&gt;L22:TOOL0058&lt;/code&gt; returned zero mappings, but the full URI returned 21. The NVS triple store keys concepts on &lt;code&gt;http://&lt;/code&gt; URIs, while my shorthand expanded to &lt;code&gt;https://&lt;/code&gt;. A single letter turned a correct answer into silence. It is the same lesson the project exists to teach, and the fix is to normalise to the scheme the store actually uses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test offline and live.&lt;/strong&gt; Mocked HTTP tests keep CI fast and network-free. A separate live smoke test against vocab.nerc.ac.uk catches the things mocks cannot, like the one above.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;The bigger opportunity is metadata authoring. Picture an assistant that reads a NetCDF or CSV header, proposes P01 parameter codes and P06 units for each variable, explains each choice, and flags anything ambiguous for a human to confirm. The vocabulary server already holds the knowledge; MCP makes it usable in a conversation.&lt;/p&gt;

&lt;p&gt;If you work with marine data, controlled vocabularies or MCP, I would love to hear how you would use this, or what tool you would add next.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Built with Python, FastMCP and the NERC Vocabulary Server. Thanks to BODC for maintaining the vocabularies, and to &lt;a href="https://github.com/seandavi/ols-mcp-server" rel="noopener noreferrer"&gt;ols-mcp-server&lt;/a&gt; for the reference design.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>oceanography</category>
      <category>controlledvocab</category>
      <category>sparql</category>
    </item>
    <item>
      <title>AI-native SDLC</title>
      <dc:creator>Vidya Krishnan</dc:creator>
      <pubDate>Sun, 15 Nov 2026 19:19:34 +0000</pubDate>
      <link>https://dev.to/anavidya/ai-native-sdlc-3nge</link>
      <guid>https://dev.to/anavidya/ai-native-sdlc-3nge</guid>
      <description>&lt;h2&gt;
  
  
  My experience with an AI-native SDLC: a working diary
&lt;/h2&gt;

&lt;p&gt;I wanted to explore how the software development lifecycle (SDLC) changes when a new player joins it: AI. I think AI will eventually be a mandatory part of how we build software. So why not embrace it now, start preparing, and work out how we keep our own role in the lifecycle? I decided to try Anthropic's &lt;a href="https://academy.claude.com/courses/ai-native-sdlc-playbook" rel="noopener noreferrer"&gt;AI-native SDLC playbook&lt;/a&gt; while building my next hobby project, and to keep a diary as I went.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The short version is on this page. Click any "Read more" to open the details.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The project
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GhostGearFinder&lt;/strong&gt; scores 1 km patches of UK seabed by how likely they are to hold lost fishing gear (gillnets, trawls and longlines), using open data on fishing, seabed and currents. It then checks those scores against places where gear was actually found, so recovery teams know where to look first.&lt;/p&gt;

&lt;h2&gt;
  
  
  The stages of an AI-native SDLC
&lt;/h2&gt;

&lt;p&gt;The playbook's premise is that agents now write code far faster than teams can plan, review and approve it. So the slow human steps move into short files in git that both people and the agent read. It has six stages:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;th&gt;File it lives in&lt;/th&gt;
&lt;th&gt;My job&lt;/th&gt;
&lt;th&gt;Claude's job&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Plan&lt;/td&gt;
&lt;td&gt;Agree what to build and why&lt;/td&gt;
&lt;td&gt;&lt;code&gt;intent.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Write the what, why and constraints&lt;/td&gt;
&lt;td&gt;Ask questions, tighten the wording&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Design&lt;/td&gt;
&lt;td&gt;Turn the intent into a spec&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;requirements.md&lt;/code&gt;, &lt;code&gt;design.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Review and correct&lt;/td&gt;
&lt;td&gt;Draft numbered requirements and a design&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Build&lt;/td&gt;
&lt;td&gt;Plan the work, then write the code&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;plan.md&lt;/code&gt;, &lt;code&gt;CLAUDE.md&lt;/code&gt;, code&lt;/td&gt;
&lt;td&gt;Approve the plan&lt;/td&gt;
&lt;td&gt;Plan first, then build against the plan&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4. Test&lt;/td&gt;
&lt;td&gt;Show the build does what was planned&lt;/td&gt;
&lt;td&gt;tests, &lt;code&gt;build-log.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Decide what "good" means&lt;/td&gt;
&lt;td&gt;Run the tests after every change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5. Deploy&lt;/td&gt;
&lt;td&gt;Ship it&lt;/td&gt;
&lt;td&gt;pull requests, CI&lt;/td&gt;
&lt;td&gt;Review the parts that matter&lt;/td&gt;
&lt;td&gt;First-pass review; checks that block unapproved actions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6. Maintain&lt;/td&gt;
&lt;td&gt;Watch it in use&lt;/td&gt;
&lt;td&gt;metrics&lt;/td&gt;
&lt;td&gt;Set what "healthy" looks like&lt;/td&gt;
&lt;td&gt;Watch the metrics; a problem becomes a new intent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Gates
&lt;/h2&gt;

&lt;p&gt;A gate is a checkpoint at the end of a stage. The developer reviews the stage's file, resolves every question in it, adds any other relevant information, and approves it only when the stage has everything it needs to proceed. The agent can draft, but only a human can pass a gate: in my repo, &lt;code&gt;CLAUDE.md&lt;/code&gt; says Claude never marks a gate approved.&lt;/p&gt;

&lt;p&gt;Why bother? In scientific data work, the costly mistakes are rarely bugs. They are quiet method errors, like testing a model on the same data you tuned it on. A gate is where someone stops and asks whether the plan is right before the agent builds on it.&lt;/p&gt;
&lt;h2&gt;
  
  
  How stages and gates work together
&lt;/h2&gt;

&lt;p&gt;Each stage produces a file, each file passes a gate, and the approved file becomes the input to the next stage:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6eh53zz7ocb76kibnt1o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6eh53zz7ocb76kibnt1o.png" alt="Every stage hands its file through a human gate: intent, G1, requirements and design, G2, plan, G3, code and tests, G4" width="800" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two things stop this from becoming a rigid waterfall:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Change requests.&lt;/strong&gt; When I change my mind, I don't edit an approved file directly. I write a short change request (the problem, the proposal, the evidence), and it's decided at the gate of the file it changes. If it's approved, that gate re-opens until the change is folded in and approved again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The loop.&lt;/strong&gt; In the maintain stage, a problem spotted in the metrics becomes a new intent, and the cycle starts again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Change requests aren't one of the playbook's stages. They're how I learned to change my mind safely, and they became the heart of the process.&lt;/p&gt;
&lt;h2&gt;
  
  
  How the tracker keeps track
&lt;/h2&gt;

&lt;p&gt;I keep a tracker: a spreadsheet in the repo that gives the overview, so I don't have to read the git log to know where things stand. The official record is still git, where each decision is one commit, with who made it and when.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  Read more: the tracker's five tabs
  &lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tab&lt;/th&gt;
&lt;th&gt;What it shows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Counts of each status, calculated from the other tabs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Gates&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The four gates, with status, approval date and commit ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Change requests&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Every CR, with status, decision date and a link to its write-up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Data access&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Every dataset, its licence, and whether it has been requested, granted or refused&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Open questions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Each question from the intent and change requests, with its answer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Status cells are dropdowns, colour-coded, and the cells I'm meant to edit are yellow. After each commit, the tracker is updated to match, including the commit ID.&lt;/p&gt;



&lt;br&gt;
&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Entry 1: From idea to running code in an afternoon
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Lesson:&lt;/strong&gt; gates are cheap only if you pass them before building.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  Read more: what we built, my first mistake and how I fixed it
  &lt;p&gt;I started with a rough proposal and asked Claude to follow the playbook. By the end of the afternoon we had:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;What it holds&lt;/th&gt;
&lt;th&gt;Why it mattered&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;intent.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;One page: what we want, why, who it's for, constraints and open questions&lt;/td&gt;
&lt;td&gt;Two constraints did a lot of work later: "software only, open data" and "no accuracy number before it is measured against baselines on held-out areas"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;requirements.md&lt;/code&gt;, &lt;code&gt;design.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Twelve numbered requirements, each with an acceptance check, and a design&lt;/td&gt;
&lt;td&gt;Every test now names the requirement it covers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;plan.md&lt;/code&gt;, &lt;code&gt;CLAUDE.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Milestones, a task list, and the repo's standing rules&lt;/td&gt;
&lt;td&gt;Every Claude session reads the rules first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A tested prototype pipeline&lt;/td&gt;
&lt;td&gt;Code running on a synthetic region with gear planted in it&lt;/td&gt;
&lt;td&gt;Every metric had a known right answer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;My first mistake:&lt;/strong&gt; I asked for the build straight away, before approving anything. Every file said "DRAFT, awaiting gate approval", and the code existed anyway. It worked out, but I had skipped the point of the playbook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I fixed it:&lt;/strong&gt; I relabelled the code as a prototype, froze it, and let the design and plan gates decide what survives. &lt;code&gt;CLAUDE.md&lt;/code&gt; now says no new feature code until gate 3 is approved; only bug fixes and tests are allowed. Spikes are fine, but only when the intent says it's a spike.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My first lesson:&lt;/strong&gt; the very first run showed a dumb rule, &lt;em&gt;gear is near the port&lt;/em&gt;, beating the model. It won because people search near port, so that's where gear gets found. We wrote it into &lt;code&gt;CLAUDE.md&lt;/code&gt; as a rule: only score places where people actually looked. A surprise became a guardrail instead of a footnote.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Entry 2: A review question becomes a change request
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What changed in my process:&lt;/strong&gt; a change request is not paperwork. It's the place where a hunch gets written down, tested and decided, and it leaves a trail of &lt;em&gt;why&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  Read more: the question, the flaw and what the evidence showed
  &lt;p&gt;While reviewing the config, I asked something that felt almost too basic: &lt;em&gt;a patch of seabed can be rocky and steep but never fished, so what do the weights actually mean?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The answer exposed a real flaw. The score added the factors together: 0.6 × fishing + 0.3 × rock + 0.1 × slope. That meant a rocky, steep cell that no one had ever fished scored 0.40, almost as high as a fished one. Gear cannot be lost where no gear is set, so fishing should be the driver and the ground factors should multiply it.&lt;/p&gt;

&lt;p&gt;In a code-first workflow, I'd probably have changed the formula in place and moved on. Here it went through the process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a change request, &lt;strong&gt;CR-001&lt;/strong&gt;, with the worked example, the proposal and the evidence;&lt;/li&gt;
&lt;li&gt;the design and requirements documents marked as re-opened, with the gate pending;&lt;/li&gt;
&lt;li&gt;the new scoring added behind a config switch, so nothing changes until a human approves it;&lt;/li&gt;
&lt;li&gt;new tests, including one that pins the original question: a rocky, never-fished cell must score exactly 0.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The evidence held a second surprise. Multiplying alone barely helped. The way each layer was rescaled to 0–1 spread the many almost-unfished cells across the whole range, so "no fishing" never actually reached zero. Only multiplying &lt;em&gt;and&lt;/em&gt; switching to min-max scaling beat the fishing-effort baseline. A one-line fix would have shipped the half that doesn't work.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Entry 3: Research reshapes the design
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What changed in my process:&lt;/strong&gt; the intent's open questions became my research agenda. Each answer went back into &lt;code&gt;intent.md&lt;/code&gt; as a proposed answer, to be confirmed when I approved it.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  Read more: the change requests that came out of the research
  &lt;p&gt;The intent had three open questions: which UK region and data, whether fishing data exists by gear type, and whether anyone records where they searched. Answering them took a few evenings of reading, and every answer changed the design.&lt;/p&gt;

&lt;p&gt;Without the process, I'd have folded each finding straight into the code. Instead, each one became a change request with its own reason and evidence:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Change request&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CR-004&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Test the model against survey data that records where people looked, including searches that found nothing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CR-005&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Narrow the scope to gillnets, trawls and longlines, add missing causes of gear loss, and add a separate "harm" layer for wildlife&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CR-006 to CR-008&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Three ideas from reading earlier projects, including a baseline that rebuilds today's common method so we can show whether ours does better&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two ideas from the first week were also written up, then rejected or parked. A rejected change request with a reason is useful history: it stops the same idea coming back without new evidence.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Entry 4: Checking every claim
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What changed in my process:&lt;/strong&gt; nothing goes into a file on trust, so the playbook's review step covers research as well as code.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  Read more: what the checks caught
  &lt;p&gt;Research questions came up all the time: which datasets exist, what their licences allow, what earlier projects found. Some answers came from my own reading, some from Claude's searches, some from other sources. Whatever the source, I asked Claude to cross-check every claim against an original source (a government page, a dataset record, a paper) before anything went into a file, and we decided together what to keep.&lt;/p&gt;

&lt;p&gt;Most claims held up, but the checks caught several that would have caused trouble later:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A European fishing dataset was said to have no data for static gear. Its own catalogue page lists a "static gears" group.&lt;/li&gt;
&lt;li&gt;Scottish small-boat maps were described as fishing effort. They show catch value in pounds, from one position per fishing day.&lt;/li&gt;
&lt;li&gt;Gear-level logbook data was said to be "completely" usable. It is, but it isn't public, so it needs a formal data request.&lt;/li&gt;
&lt;li&gt;A regulator's decision was cited by a reference number that couldn't be found anywhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rule we settled on: confirmed facts go in with their source; unconfirmed ones go in marked "to verify"; anything that can't be found is marked "do not cite".&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Entry 5: Running the gates for real
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What changed in my process:&lt;/strong&gt; the git history now reads like minutes of a meeting. Each commit is one decision, with who made it and when.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  Read more: the review rhythm I settled on
  &lt;p&gt;By now I had eight change requests and four gates, all pending, and I was confused. What untangled it was giving each its own status: a change request goes &lt;em&gt;proposed → approved or rejected → done&lt;/em&gt;; a gate goes &lt;em&gt;pending → approved&lt;/em&gt;, and back to &lt;em&gt;re-opened&lt;/em&gt; if a later change touches it.&lt;/p&gt;

&lt;p&gt;For each document, the rhythm became:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read one document.&lt;/li&gt;
&lt;li&gt;Make sure every question and doubt in it is resolved.&lt;/li&gt;
&lt;li&gt;Set its status: approved, rejected, or changes requested (it stays in review until the changes are made).&lt;/li&gt;
&lt;li&gt;Commit that one decision in git, with a clear message.&lt;/li&gt;
&lt;li&gt;Update the tracker, move to next step.&lt;/li&gt;
&lt;/ol&gt;



&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision log so far
&lt;/h2&gt;

&lt;p&gt;Gate 1 (the intent) is approved. Seven of eight change requests are decided; gate 2 (the design) is next.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  Read more: every gate and change request, with its status
  &lt;h3&gt;
  
  
  The gates
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Gate&lt;/th&gt;
&lt;th&gt;Approves&lt;/th&gt;
&lt;th&gt;The question it answers&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;intent.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Are we solving the right problem?&lt;/td&gt;
&lt;td&gt;Approved, 14 Nov 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;requirements.md&lt;/code&gt; + &lt;code&gt;design.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Is this the right solution?&lt;/td&gt;
&lt;td&gt;Pending (next)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;code&gt;plan.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Is this the right next piece of work?&lt;/td&gt;
&lt;td&gt;Pending&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Test results&lt;/td&gt;
&lt;td&gt;Did the build do what was planned?&lt;/td&gt;
&lt;td&gt;Pending&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A gate goes &lt;em&gt;pending → approved&lt;/em&gt;. If an approved change request later alters a document it covers, the gate goes back to &lt;em&gt;re-opened&lt;/em&gt; until that change is folded in and approved again.&lt;/p&gt;
&lt;h3&gt;
  
  
  The change requests
&lt;/h3&gt;

&lt;p&gt;A change request (CR) is a written proposal to change a document behind a gate: the problem, the proposal, the evidence and the risks. It doesn't create a new gate; it is decided at the gate of the document it changes. A gate can't be approved while a change request touching it is still undecided.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CR&lt;/th&gt;
&lt;th&gt;What it changes&lt;/th&gt;
&lt;th&gt;Gate&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CR-001&lt;/td&gt;
&lt;td&gt;Score by multiplying, not adding; min-max scaling&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Approved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CR-002&lt;/td&gt;
&lt;td&gt;Log-scale fishing effort&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Candidate, after real data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CR-003&lt;/td&gt;
&lt;td&gt;Drift term for nets&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Rejected, folded into CR-005&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CR-004&lt;/td&gt;
&lt;td&gt;Test against survey effort, including empty searches&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Approved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CR-005&lt;/td&gt;
&lt;td&gt;Three gear models, new loss causes, harm layer&lt;/td&gt;
&lt;td&gt;1 and 2&lt;/td&gt;
&lt;td&gt;Approved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CR-006&lt;/td&gt;
&lt;td&gt;Vessel traffic and offshore structures&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Approved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CR-007&lt;/td&gt;
&lt;td&gt;Warn when input layers come from different years&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Approved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CR-008&lt;/td&gt;
&lt;td&gt;"Current practice" baseline&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Approved&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A change request goes &lt;em&gt;candidate → proposed → approved or rejected → done&lt;/em&gt; (done means built and tested). Rejected ones stay in the repo with their reason.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I'd roll this out in a team
&lt;/h2&gt;

&lt;p&gt;Running the playbook alone on a side project is one thing. Here is how I would bring it into a team:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start small and real.&lt;/strong&gt; One repo, one team, and the next real feature, not a demo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agree who approves what.&lt;/strong&gt; Each gate needs a named owner: for example, the product owner or lead scientist for the intent, a senior developer for requirements and design, the tech lead for the plan, and whoever owns quality for the test results. The agent drafts at every stage but approves nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write a shared &lt;code&gt;CLAUDE.md&lt;/code&gt; for each repo.&lt;/strong&gt; Commands, conventions and guardrails, kept under a page, because every session reads it first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn repeated know-how into skills.&lt;/strong&gt; Things the team explains again and again, such as how we write a data ingest or our quality-control conventions, become skills that every session starts with.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep the gates in git.&lt;/strong&gt; An approval is a commit that changes a status line. It's auditable and needs no new tool; a tracker gives the overview.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put hard rules in settings, not prompts.&lt;/strong&gt; Claude Code reads a settings file kept in each repo (&lt;code&gt;.claude/settings.json&lt;/code&gt;). Permission rules there can stop the agent from, say, editing raw data or pushing to the main branch. Hooks, small scripts that run before or after an action, can block it outright, for example a commit when the tests fail. A prompt can be forgotten; a setting is enforced.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make fast tests the feedback loop.&lt;/strong&gt; The agent is only as good as the signal it gets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Save human review for what matters.&lt;/strong&gt; People review critical or regulated code closely; agent review takes the first pass on the rest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure it.&lt;/strong&gt; Track the time from intent to merge, review time, and defects that slip through. A metric outside its agreed range becomes a new intent, and the loop starts again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grow by example.&lt;/strong&gt; Once one team has a few gates and change requests behind it, its repo becomes the template, and its people coach the next team.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What I'd tell a team trying this
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pass the gates before you build.&lt;/strong&gt; It's tempting to let the agent run ahead. The gates only save time if the decisions come first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your job becomes asking good questions.&lt;/strong&gt; The agent wrote most of the code. The most valuable thing I did was read the code and config and asked what a number meant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put guardrails in files, not in your head.&lt;/strong&gt; Rules like "baselines next to every result" live in &lt;code&gt;CLAUDE.md&lt;/code&gt;, so every session follows them without reminders.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write constraints down early, in the intent.&lt;/strong&gt; "Software only" and "open data only" went into &lt;code&gt;intent.md&lt;/code&gt; on day one, and settled later debates in minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Change requests are cheap, and that's the point.&lt;/strong&gt; Writing one up takes minutes and catches the half of a fix that doesn't work. Rejected ones are useful history.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-check every claim, whoever found it.&lt;/strong&gt; Check it against an original source, mark what you can't confirm, and decide together what goes in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One decision per commit.&lt;/strong&gt; The git log becomes your audit trail; a spreadsheet tracker gives the overview.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast tests are the feedback loop.&lt;/strong&gt; Even before any real data, the prototype pipeline runs on a synthetic region with gear planted in it, so every result has a known right answer. Its 19 tests run in about a second, so the agent checks itself after every change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask for one step at a time when it gets busy.&lt;/strong&gt; The process has many moving parts; you only need to see the next one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;The next entries in this diary will cover the second half of the playbook: approving the design and the plan, then building with real UK data, testing the model on areas it has never seen, and keeping the process honest once real results arrive. I'm also going to request data from several organisations, which is its own lesson in lead times.&lt;/p&gt;

&lt;p&gt;If you're trying an AI-native workflow in a research or data team, I'd love to compare notes.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Views in this post are my own and do not necessarily represent BODC or NOC.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://academy.claude.com/courses/ai-native-sdlc-playbook" rel="noopener noreferrer"&gt;AI-native SDLC playbook, Anthropic Academy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>softwareengineering</category>
      <category>codereview</category>
      <category>aitransformation</category>
    </item>
    <item>
      <title>Same Water, Different Robots: Cross-Checking Ocean Sensors with PostGIS</title>
      <dc:creator>Vidya Krishnan</dc:creator>
      <pubDate>Sat, 07 Nov 2026 20:04:43 +0000</pubDate>
      <link>https://dev.to/anavidya/same-water-different-robots-cross-checking-ocean-sensors-with-postgis-16nm</link>
      <guid>https://dev.to/anavidya/same-water-different-robots-cross-checking-ocean-sensors-with-postgis-16nm</guid>
      <description>&lt;p&gt;As a personal project to learn PostGIS, I started building a small app to check whether ocean gliders and Argo floats were profiling the same waters, using the data they collect. When a glider is selected, it finds, within seconds, the Argo float profiles close enough to it in place, time and depth. I wanted to test a theory: if the glider and the float are sampling the same water, the values recorded by their sensors should be roughly the same. I set up the PostGIS tables to store only metadata, and wrote the code to cache it and compare the profiles. Then I plotted the values recorded by both and, lo and behold, they matched almost perfectly. Most of the work happens in one PostGIS query, and no data file is ever saved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Apples and Mangoes
&lt;/h2&gt;

&lt;p&gt;My first question was a wrong one: "where and when did a glider and an Argo float sample the same water?"&lt;/p&gt;

&lt;p&gt;I drew boxes on a map, pulled in every glider and float inside, and looked for encounters within 50 km, 100 m of depth and 10 days.&lt;br&gt;
The first real glider I opened was a Slocum off New York, diving to about 90 m on the continental shelf. Argo floats don't go there: they live in the open ocean, parking at 1000 m and profiling up from 2000 m.&lt;/p&gt;

&lt;p&gt;A shelf glider and a float were never going to meet, and when they did come near each other, they were sampling different oceans. I was comparing apples and mangoes.&lt;/p&gt;

&lt;p&gt;An analogy helped me reset. Argo floats are like long-haul lorries on a fixed timetable: sparse, slow, one report every ten days. Gliders are local cars: piloted, sampling densely, on short trips. &lt;/p&gt;

&lt;p&gt;When a lorry and a car pass close by, you can learn three different things:&lt;br&gt;
• &lt;strong&gt;Calibration&lt;/strong&gt;: whether the car's speedometer is right, by checking it against the lorry's while they drive side by side.&lt;br&gt;
• &lt;strong&gt;Representativeness&lt;/strong&gt;: what the lorry's sparse report missed, which the car saw in between.&lt;br&gt;
• &lt;strong&gt;Coverage&lt;/strong&gt;: which roads the lorries never use at all.&lt;/p&gt;

&lt;p&gt;I chose calibration. Glider conductivity and oxygen sensors may drift over a mission, and I assume nothing on board can check them. Argo profiles, especially the delayed-mode ones that experts have quality-checked, are the most widely available trusted reference. Finding the right ones for a deployment is usually done by hand, one deployment at a time.&lt;br&gt;
The problem is close to home. &lt;/p&gt;

&lt;p&gt;As part of BODC, I see the effort data managers and scientists put into setting up, processing, and monitoring every float and glider, carefully, one platform at a time. &lt;br&gt;
The question, precisely&lt;br&gt;
&lt;em&gt;For a glider deployment, which Argo profiles lie within 50 km and 10 days of one of its dives, with depth ranges that share at least 100 m below 150 m? Keep the 5 best.&lt;/em&gt;&lt;br&gt;
Each number has a reason:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Limit&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Distance&lt;/td&gt;
&lt;td&gt;50 km&lt;/td&gt;
&lt;td&gt;A common matchup scale in the open ocean, where the deep water changes slowly across that distance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time&lt;/td&gt;
&lt;td&gt;10 days&lt;/td&gt;
&lt;td&gt;Argo surfaces every 10 days; deep water changes over weeks, not hours&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Comparison layer&lt;/td&gt;
&lt;td&gt;below 150 m&lt;/td&gt;
&lt;td&gt;Surface water changes within hours (sun, wind, mixing); deeper water is stable enough to compare days apart&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shared depth&lt;/td&gt;
&lt;td&gt;at least 100 m&lt;/td&gt;
&lt;td&gt;Enough water column for a meaningful comparison&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;References kept&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;A handful to compare, ranked by distance/50 km + time/10 days&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I started stricter: 200 m shared below 200 m, so a glider had to reach 400 m. The first live run showed every glider then working off the US Northeast was a shelf glider under about 100 m deep, so I loosened it. A glider now has to reach 250 m to qualify, at the cost of a less stable comparison layer. All five values live in .env, so changing the rule needs no code change.&lt;/p&gt;

&lt;p&gt;A shelf glider that never reaches the layer gets a clear answer instead of an empty list: "no deep overlap possible". That is a coverage finding in its own right.&lt;/p&gt;
&lt;h2&gt;
  
  
  Data without downloads
&lt;/h2&gt;

&lt;p&gt;One rule from the start: never save a NetCDF file or raw measurements. Everything is read into memory, summarised, and only the summary is kept.&lt;/p&gt;

&lt;p&gt;Gliders come from ERDDAP servers: the US IOOS Glider DAC and Fisheries and Oceans Canada's CNODC ERDDAP, which serves deep Seagliders. They publish glider data in two different layouts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Dive-numbered (IOOS): every row carries a profile_id, one per dive or climb. Asking for profile_id,time,latitude,longitude with &amp;amp;distinct() is answered from ERDDAP's cached subset table without reading the measurements. ERDDAP's orderByMinMax("profile_id,depth") returns only the shallowest and deepest row of each dive, so the full data never leaves the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Continuous trajectory (DFO, European EGO style): no dive numbers, &lt;br&gt;
one long series. orderByClosest("time/5minutes") thins it on the server to one row every 5 minutes, and I group those into 6-hour pseudo-profiles, each with its depth range, mean position and mid time.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Argo comes through argopy from Ifremer's ERDDAP, which serves the Coriolis GDAC data. I chose its erddap source over gdac because the gdac source did not seem to show the biogeochemical data (no oxygen or nitrate), and ERDDAP filters the box, depth and dates on the server.&lt;/p&gt;

&lt;p&gt;The slow part was finding gliders. Searching the IOOS server for deployments in a box took about a minute and timed out. The fix was to stop searching it live: a background thread loads each server's list of active deployments into my own PostGIS table every hour, and every search becomes an indexed query against that table, answered in milliseconds.&lt;/p&gt;
&lt;h2&gt;
  
  
  How it fits together
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fne9460cxk9327pn0v94n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fne9460cxk9327pn0v94n.png" alt="Architecture · 3 data servers, the FastAPI backend, 3 PostGIS tables" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Architecture · 3 data servers, the FastAPI backend, 3 PostGIS tables&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The browser only talks to the backend. The backend reads every server in memory and writes small summaries to three PostGIS tables; the sensor check fetches full profiles on demand and stores nothing.&lt;/p&gt;
&lt;h2&gt;
  
  
  Modelling a profile
&lt;/h2&gt;

&lt;p&gt;Calibration compares one vertical column of water with another, so the unit of storage is a &lt;strong&gt;profile&lt;/strong&gt;: a glider dive (or pseudo-profile) or one Argo cycle. Every profile is one row:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;platform_id&lt;/span&gt;    &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                 &lt;span class="c1"&gt;-- GLIDER_&amp;lt;dataset_id&amp;gt; or ARGO_&amp;lt;wmo&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;platform_type&lt;/span&gt;  &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;platform_type&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'GLIDER'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ARGO'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="n"&gt;profile_id&lt;/span&gt;     &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                 &lt;span class="c1"&gt;-- dive id, or &amp;lt;wmo&amp;gt;_&amp;lt;cycle&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;geom&lt;/span&gt;           &lt;span class="n"&gt;geometry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Point&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4326&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt;              &lt;span class="n"&gt;timestamptz&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;depth_range&lt;/span&gt;    &lt;span class="n"&gt;numrange&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;             &lt;span class="c1"&gt;-- e.g. [0.8,958.0]&lt;/span&gt;
    &lt;span class="n"&gt;sensors&lt;/span&gt;        &lt;span class="n"&gt;jsonb&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;'[]'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;-- ["temperature","salinity","oxygen"]&lt;/span&gt;
    &lt;span class="n"&gt;data_mode&lt;/span&gt;      &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                          &lt;span class="c1"&gt;-- Argo: R, A or D&lt;/span&gt;
    &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;platform_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;profile_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;GIST&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;geography&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;platform_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;GIN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sensors&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The column that does the most work is &lt;code&gt;depth_range&lt;/code&gt;, a PostgreSQL &lt;code&gt;numrange&lt;/code&gt;. "Which depths did both profiles cover?" becomes a range intersection, and "how much?" is &lt;code&gt;upper() - lower()&lt;/code&gt;. &lt;br&gt;
The GiST index sits on the &lt;strong&gt;expression&lt;/strong&gt; &lt;code&gt;(geom::geography)&lt;/code&gt;, because the distance test casts to geography; an index on plain &lt;code&gt;geom&lt;/code&gt; would not help it.&lt;/p&gt;

&lt;p&gt;My first design stored one &lt;code&gt;LineStringZM&lt;/code&gt; per platform: longitude, latitude, depth and time packed into a single 4D line. It is a neat PostGIS feature and it suited the encounter question, but calibration needs to reason about whole columns of water, not points along a path. Tracks are now built on the fly for drawing, with &lt;code&gt;ST_MakeLine(geom ORDER BY t)&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  The matching query
&lt;/h2&gt;

&lt;p&gt;The whole search is one SQL statement. It pairs every glider dive with nearby Argo profiles, keeps pairs that share enough deep water, and ranks them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;                                   &lt;span class="c1"&gt;-- the glider's dives&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;profile_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;depth_range&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;platform_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;glider&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="n"&gt;pairs&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;platform_id&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;argo_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile_id&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;argo_profile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data_mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile_id&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;glider_profile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="n"&gt;ST_Distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;geography&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;geography&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;       &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;dist_m&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="k"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;epoch&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;                      &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;dt_s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;depth_range&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;depth_range&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;numrange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;     &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;shared&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt;
    &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
      &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;platform_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'ARGO'&lt;/span&gt;
     &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="k"&gt;BETWEEN&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="s1"&gt;'10 days'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="s1"&gt;'10 days'&lt;/span&gt;
     &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;ST_DWithin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;geography&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;geom&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;geography&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;-- metres&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sensors&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;param&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="n"&gt;scored&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;upper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;shared&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;shared&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;          &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;overlap_m&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="n"&gt;dist_m&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;50000&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;dt_s&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;86400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;      &lt;span class="c1"&gt;-- 0 best, 2 worst&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;pairs&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="n"&gt;isempty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;shared&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;                                     &lt;span class="c1"&gt;-- best glider dive per Argo profile&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;argo_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;argo_profile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;scored&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;overlap_m&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
    &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;argo_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;argo_profile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three details carry it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;::geography&lt;/code&gt;.&lt;/strong&gt; In SRID 4326, &lt;code&gt;ST_Distance&lt;/code&gt; on plain geometry returns degrees. Cast to geography and it returns metres measured on the WGS84 ellipsoid, so &lt;code&gt;50000&lt;/code&gt; really means 50 km at any latitude.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Range intersection.&lt;/strong&gt; &lt;code&gt;g.depth_range * a.depth_range * numrange(150, NULL)&lt;/code&gt; is the depth both profiles covered, below 150 m (&lt;code&gt;NULL&lt;/code&gt; = open-ended, so everything deeper than 150 m). An empty result means no overlap; &lt;code&gt;upper() - lower()&lt;/code&gt; is its thickness.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;DISTINCT ON&lt;/code&gt;.&lt;/strong&gt; An Argo profile can be near dozens of dives; this keeps only its best-scoring dive before the final top 5.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Checking the sensors
&lt;/h2&gt;

&lt;p&gt;Finding references is half the job. "Check sensors" on a reference fetches both full profiles into memory, compares them, and throws them away: nothing is saved. It reports the glider's salinity offset (glider minus Argo) in the shared layer, with a verdict: within 0.01 agrees, up to 0.03 is worth watching, beyond that is possible drift.&lt;/p&gt;

&lt;p&gt;I'm not an oceanographer, so the hard part was deciding which water to compare. The picture that made it click for me is a layered cake.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F33szj87x8ftur32a4nvo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F33szj87x8ftur32a4nvo.png" alt="Why the comparison matches temperature, not depth" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Why the comparison matches temperature, not depth&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Each layer of the ocean has a colour, its temperature, and a flavour, its salinity. The Argo float is the trusted taster. The glider sees colour well (its temperature sensor rarely drifts), but its sense of flavour, the salinity sensor, may be off. And between the two visits, eddies and internal waves push the layers up or down by tens of metres.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Same depth&lt;/strong&gt; compares different layers, so it reports an error that isn't there, or hides one that is.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Same density&lt;/strong&gt; sounds safer, but density is worked out from salinity too, so a drifting salinity sensor picks the wrong layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Same temperature&lt;/strong&gt; works: the temperature sensor is reliable, and a layer keeps its temperature when it is pushed up or down. In the code this is &lt;em&gt;potential&lt;/em&gt; temperature from the TEOS-10 library &lt;code&gt;gsw&lt;/code&gt; (&lt;code&gt;gsw.pt0_from_t&lt;/code&gt;): the temperature the water would have if brought to the surface, which removes the small warming caused by pressure at depth.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how Argo's own experts check float salinity in delayed mode: they compare float salinity with trusted reference data on potential temperature levels (&lt;a href="https://scilit.com/publications/7d38fc969f8978bc068655b41c4b8dcc" rel="noopener noreferrer"&gt;Wong, Johnson &amp;amp; Owens, 2003&lt;/a&gt;; the &lt;a href="https://github.com/ArgoDMQC/matlab_owc" rel="noopener noreferrer"&gt;OWC toolbox&lt;/a&gt; used by Argo data centres; &lt;a href="https://floats.pmel.noaa.gov/node/7" rel="noopener noreferrer"&gt;NOAA PMEL's summary&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing it with a known error
&lt;/h3&gt;

&lt;p&gt;I tested the idea the way you'd test a weighing scale: with a known weight. The test makes up an ocean from two smooth curves, a perfect Argo profile of it, and a glider profile of the same ocean with a salinity error I chose and the water pushed up. It then hands both to the app's real comparison code and checks which method gives the hidden error back. No data is downloaded and no database is touched.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;water&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;                                   &lt;span class="c1"&gt;# the made-up ocean, p = depth in m
&lt;/span&gt;    &lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;     &lt;span class="c1"&gt;# 18 °C at the surface, 4 °C deep
&lt;/span&gt;    &lt;span class="n"&gt;salinity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;34.95&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# 35.85 at the surface, 34.95 deep
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salinity&lt;/span&gt;

&lt;span class="c1"&gt;# Argo: the truth, 200 levels down to 2000 m
&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;water&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p_argo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;argo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pres&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p_argo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;psal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="c1"&gt;# Glider: the same ocean, pushed up by `lift` metres, salinity off by `offset`
&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;water&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p_glider&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;lift&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;glider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pres&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p_glider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;noise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;psal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;noise&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="c1"&gt;# the app's own code, unchanged
&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;compare_profiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;teos10&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;glider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;teos10&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;argo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;950&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;theta_levels&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;salinity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;median&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# should come back as `offset`
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The whole test is in &lt;code&gt;backend/tests/test_synthetic_compare.py&lt;/code&gt;. &lt;code&gt;poetry run pytest tests/test_synthetic_compare.py -v&lt;/code&gt; runs the checks, and &lt;code&gt;poetry run python tests/test_synthetic_compare.py&lt;/code&gt; prints this table:&lt;/p&gt;

&lt;p&gt;How to read it: the first column is the right answer, because I put that error in on purpose. Compare each method's number with it, in the same row. The closer the two, the better the method.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hidden salinity error&lt;/th&gt;
&lt;th&gt;Water pushed up by&lt;/th&gt;
&lt;th&gt;Same temperature&lt;/th&gt;
&lt;th&gt;Same depth&lt;/th&gt;
&lt;th&gt;Same density&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;+0.015&lt;/td&gt;
&lt;td&gt;25 m&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.0145&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+0.0031&lt;/td&gt;
&lt;td&gt;+0.0254&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.000&lt;/td&gt;
&lt;td&gt;25 m&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−0.0005&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−0.0119&lt;/td&gt;
&lt;td&gt;−0.0001&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.000&lt;/td&gt;
&lt;td&gt;0 m&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−0.0002&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.0000&lt;/td&gt;
&lt;td&gt;+0.0003&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+0.040&lt;/td&gt;
&lt;td&gt;60 m&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.0393&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+0.0135&lt;/td&gt;
&lt;td&gt;+0.0679&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;−0.008&lt;/td&gt;
&lt;td&gt;10 m&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−0.0081&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−0.0131&lt;/td&gt;
&lt;td&gt;−0.0139&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Rows 2 and 3 are the control: the glider's sensor is perfect, so I expected every method to report no error, 0.000. With the water still (row 3), they all do. Once the water moves 25 m (row 2), same depth reports −0.012, an error that isn't there. Same density copes with the moving water, but rows 1 and 4 show it exaggerates real errors: +0.068 for a real +0.040.&lt;/p&gt;

&lt;p&gt;Across all five rows, same temperature gives the closest result every time:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Furthest from the right answer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Same temperature&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;0.0007&lt;/strong&gt; (row 4: +0.0393 for +0.040)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same depth&lt;/td&gt;
&lt;td&gt;0.027 (row 4: +0.0135 for +0.040)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same density&lt;/td&gt;
&lt;td&gt;0.028 (row 4: +0.0679 for +0.040)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The verdict only starts to care at 0.01, so same temperature's worst miss is about 15 times too small to matter, while the other two miss by more than that 0.01 line, enough to change the verdict.&lt;/p&gt;

&lt;p&gt;The panel shows the verdict, the offsets and two plots: potential temperature against salinity for the shared layer, and salinity against pressure with the compared layer shaded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The first live match.&lt;/strong&gt; The glider was ng1050-20260713T0000, a deep glider operated by the US Naval Oceanographic Office and served by the IOOS Glider DAC, working in the open Atlantic off the US Southeast coast. For its dive 65100041 (21 July 2026, 32.1°N 76.3°W, 0–958 m), the third-ranked reference was Argo float 6990687, cycle 51 (adjusted mode): &lt;strong&gt;20.9 km&lt;/strong&gt; and &lt;strong&gt;4.7 days&lt;/strong&gt; from the matching glider dive, the two sharing the water column from &lt;strong&gt;150 to 958 m&lt;/strong&gt;. That is about 800 m of stable water in which a good conductivity sensor should agree with the float to within a hundredth of a salinity unit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shelf gliders, correctly refused.&lt;/strong&gt; Every glider I found off the US Northeast in late October was a shelf glider, none deeper than about 100 m. Each one answers "no deep overlap possible" straight from its metadata, without fetching a single Argo profile. That is the coverage result from the analogy: roads the lorries never use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping it small
&lt;/h2&gt;

&lt;p&gt;The database is an index, not an archive. Four mechanisms keep it that way:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;How&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Glider catalogue&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;glider_deployments&lt;/code&gt;: extent &lt;code&gt;Polygon&lt;/code&gt;, active dates as a &lt;code&gt;tstzrange&lt;/code&gt;; refreshed hourly per server&lt;/td&gt;
&lt;td&gt;A one-minute server search becomes a millisecond query&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Argo fetch cache&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;argo_fetch_windows&lt;/code&gt;: each fetch's area and period; reused while &lt;code&gt;ST_Covers(area, box)&lt;/code&gt; and &lt;code&gt;period @&amp;gt; dates&lt;/code&gt; hold, for 7 days&lt;/td&gt;
&lt;td&gt;Reopening a glider no longer re-downloads the same Argo data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retention&lt;/td&gt;
&lt;td&gt;Hourly: drop glider rows not reopened for 30 days, and Argo rows no fresh fetch still relies on&lt;/td&gt;
&lt;td&gt;The table holds roughly what was used last month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shallow-track thinning&lt;/td&gt;
&lt;td&gt;Gliders that can't reach the comparison layer keep one point per 3 hours&lt;/td&gt;
&lt;td&gt;A shelf Slocum dives every 10–20 minutes: 2,500 dives became 161 points&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Matches themselves are never stored. The query takes about 0.05 s on test data, and recomputing means a change to the rule in &lt;code&gt;.env&lt;/code&gt; is never contradicted by stale results. The &lt;code&gt;profiles&lt;/code&gt; table had reached 18,000 rows after a few sessions, mostly shelf dives that could never match, before retention and thinning went in.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ask the right question first.&lt;/strong&gt; The depth layer mattered more than the distance; a working encounter engine for the wrong question was still the wrong tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live data can change your rules.&lt;/strong&gt; One look at October's gliders loosened the depth rule.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ST_ClosestPoint&lt;/code&gt; is 2D.&lt;/strong&gt; My first 4D query compared the depths of two closest points; the point had no Z, so the check was always NULL and nothing ever matched.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Geometry measures degrees, geography measures metres.&lt;/strong&gt; &lt;code&gt;ST_Distance&lt;/code&gt; in SRID 4326 returned 0.0141 for two points 1.3 km apart until I cast to &lt;code&gt;::geography&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Range types are underrated.&lt;/strong&gt; &lt;code&gt;numrange&lt;/code&gt; intersection and &lt;code&gt;isempty()&lt;/code&gt; say "the depth both profiles covered" in one line; &lt;code&gt;tstzrange&lt;/code&gt; with &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; and &lt;code&gt;@&amp;gt;&lt;/code&gt; does the same for time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Index the expression you query.&lt;/strong&gt; A GiST index on &lt;code&gt;(geom::geography)&lt;/code&gt;, not on &lt;code&gt;geom&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compare salinity at equal potential temperature,&lt;/strong&gt; not equal depth or density.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache a slow server's catalogue in your own database,&lt;/strong&gt; and cache fetches by area and period.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pandas 3 can parse times at second resolution.&lt;/strong&gt; &lt;code&gt;astype("int64") / 1e9&lt;/code&gt; silently gave dates in 1970.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;argopy's region order is &lt;code&gt;[lon_min, lon_max, lat_min, lat_max, …]&lt;/code&gt;,&lt;/strong&gt; not the usual bounding-box order.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Limits and next steps
&lt;/h2&gt;

&lt;p&gt;Fifty kilometres and ten days is not "the same water" near fronts and eddies; a wide spread in the offsets is the warning sign. The app only looks at deployments active in the last 30 days, while careful calibration usually happens after a glider is recovered. Real-time data on either side is less certain than delayed-mode, and oxygen is not compared yet because the sources report it in different units and forms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://argopy.readthedocs.io/en/latest/user-guide/fetching-argo-data/data_sources.html" rel="noopener noreferrer"&gt;argopy: data sources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://argopy.readthedocs.io/en/latest/user-guide/fetching-argo-data/data_selection.html" rel="noopener noreferrer"&gt;argopy: data selection&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gliders.ioos.us/erddap/info/bios_jack-20230110T2224/index.html" rel="noopener noreferrer"&gt;IOOS Glider DAC ERDDAP, example deployment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cnodc-cndoc.azure.cloud-nuage.dfo-mpo.gc.ca/erddap/info/SEA019_20241024_R/index.html" rel="noopener noreferrer"&gt;DFO Canada CNODC ERDDAP, example Seaglider deployment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platforms.bodc.ac.uk/" rel="noopener noreferrer"&gt;BODC autonomous platforms and glider deployment catalogue&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://scilit.com/publications/7d38fc969f8978bc068655b41c4b8dcc" rel="noopener noreferrer"&gt;Wong, Johnson &amp;amp; Owens (2003): delayed-mode calibration of float salinity by θ–S climatology&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ArgoDMQC/matlab_owc" rel="noopener noreferrer"&gt;OWC toolbox: Argo's float salinity calibration code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://floats.pmel.noaa.gov/node/7" rel="noopener noreferrer"&gt;NOAA PMEL: float data delayed-mode quality control&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://teos-10.org/pubs/gsw/html/gsw_pt0_from_t.html" rel="noopener noreferrer"&gt;TEOS-10: gsw_pt0_from_t, potential temperature&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>postgis</category>
      <category>oceanobservation</category>
      <category>python</category>
    </item>
  </channel>
</rss>
