Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"zod": "^4.1.1"
},
"dependencies": {
"@openmeteo/file-reader": "^0.0.13",
"@poppanator/sveltekit-svg": "^6.0.0",
"@shikijs/transformers": "^3.15.0",
"@sveltejs/enhanced-img": "^0.8.0",
Expand Down
41 changes: 41 additions & 0 deletions src/lib/components/code/om-files/typescript-request.svx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
```js
import {
OmDataType,
OmHttpBackend,
Range,
setupGlobalCache,
} from "@openmeteo/file-reader";

setupGlobalCache();

const backend = new OmHttpBackend({
url: "https://map-tiles.open-meteo.com/data_spatial/dwd_icon/2025/11/11/0000Z/2025-11-11T0000.om",
});

const reader = await backend.asCachedReader();

const variableReader = await reader.getChildByName("temperature_2m");

if (!variableReader) {
throw new Error("Variable 'temperature_2m' not found");
}

const dimensions = variableReader.getDimensions();
const readRanges = [
{ start: 0, end: dimensions[0] },
{ start: 0, end: dimensions[1] },
];

const data = await variableReader.read({
type: OmDataType.FloatArray,
ranges: readRanges,
});

console.log(data);

variableReader.dispose();
reader.dispose();

// for node
process.exit();
```
30 changes: 30 additions & 0 deletions src/lib/components/code/om-files/typescript-result.svx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
```typescript
Float32Array(4148639) [
NaN, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
-44.45000076293945, -44.45000076293945, -44.45000076293945, -44.45000076293945,
... 4148539 more items
]
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const pythonInstallCode = `<pre><code><span class="line"><span style="color:var(--code-preview-token-constant)">pip</span><span style="color:var(--code-preview-token-string-expression)"> install</span><span style="color:var(--code-preview-token-string-expression)"> openmeteo-requests</span></span>
<span class="line"><span style="color:var(--code-preview-token-constant) ">pip</span><span style="color:var(--code-preview-token-string-expression)"> install</span><span style="color:var(--code-preview-token-string-expression)"> requests-cache</span><span style="color:var(--code-preview-token-string-expression)"> retry-requests</span><span style="color:var(--code-preview-token-string-expression)"> numpy</span><span style="color:var(--code-preview-token-string-expression)"> pandas</span></span></code></pre>`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const typescriptInstallCode = `<pre><code><span class="line"><span style="color:var(--code-preview-token-constant)">npm</span><span style="color:var(--code-preview-token-string-expression)"> install</span><span style="color:var(--code-preview-token-string-expression)"> @openmeteo/file-reader</span></span></code></pre>`;
7 changes: 4 additions & 3 deletions src/routes/en/docs/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { onMount } from 'svelte';

import { browser, dev } from '$app/environment';
import { afterNavigate, beforeNavigate } from '$app/navigation';
import { page } from '$app/state';
Expand Down Expand Up @@ -49,7 +47,10 @@
{ title: 'Flood', url: '/en/docs/flood-api' }
];
if (dev) {
links.push({ title: 'Single Runs', url: '/en/docs/single-runs-api' });
links.push(
{ title: 'Single Runs', url: '/en/docs/single-runs-api' },
{ title: 'OM Files', url: '/en/docs/om-files' }
);
}

interface Path {
Expand Down
2 changes: 0 additions & 2 deletions src/routes/en/docs/metno-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@

import {
forecastHoursOptions,
forecastMinutely15Options,
gridCellSelectionOptions,
pastDaysOptions,
pastHoursOptions,
pastMinutely15Options,
temporalResolutionOptions
} from '../options';
import {
Expand Down
9 changes: 9 additions & 0 deletions src/routes/en/docs/om-files/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { LayoutLoad } from './$types';

export const load = (() => {
return {
heroTitle: 'OM Files',
heroDescription: 'Leveraging OM files directly for data processing',
heroImage: '/images/backgrounds/klausenpass.webp'
};
}) satisfies LayoutLoad;
Loading