Skip to content

Commit

Permalink
+post on documenting the file format
Browse files Browse the repository at this point in the history
  • Loading branch information
rjoberon committed Jun 27, 2024
1 parent 452ec9c commit a74b069
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
23 changes: 23 additions & 0 deletions _posts/2024-06-27-documenting-the-file-format.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Documenting the file format
description: Understanding how the tile index works and how tiles are arranged in the file.
image: /img/dsat_kaitai.png
---

Since [the first post on decoding the city
database](/2005/03/26/decoding-the-city-database.html) I have learned
so much more about the structure of the D-Sat file format: [where the
image tiles are
located](https://dsat.igada.de/2024/04/02/finding-the-tiles.html),
[how they are
indexed](https://dsat.igada.de/2024/05/11/visualising-entropy.html)
and [which information the image header
reveals](https://dsat.igada.de/2024/04/20/understanding-the-image-header.html),
as well as [that the file also contains points describing borders and
highways](https://dsat.igada.de/2024/05/06/finding-somehing-unexpected.html). It
is time to document this knowledge and with [Kaitai
Struct](http://kaitai.io/) I found a solution for that: I can describe
the file format [in a simple YAML file](/src/dsat.ksy), automatically
generate code to parse files, and also visualize the structure:

![Visualization of the D-Sat file structure](/img/dsat_kaitai.png)
Binary file added img/dsat_kaitai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/thumbs/dsat1_kaitai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions src/Searching_the_Index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
"plt.rcParams['figure.figsize'] = (10, 10)\n",
"plt.rcParams['figure.dpi'] = 140\n",
"\n",
"#plt.plot(df.i1, df.i2, \"o\", label=\"\")\n",
"c(df, diag_kind=None)\n",
"plt.plot(df.i1, df.i2, \"o\", label=\"\")\n",
"#c(df, diag_kind=None)\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -182,20 +182,20 @@
"metadata": {},
"outputs": [],
"source": [
" import statsmodels.tsa.stattools as smtsa\n",
" import numpy as np\n",
"import statsmodels.tsa.stattools as smtsa\n",
"import numpy as np\n",
"\n",
" acf = smtsa.acf(df.ints, nlags=300, adjusted=False, fft=False)\n",
"acf = smtsa.acf(df.ints, nlags=50, adjusted=False, fft=False)\n",
"\n",
" lags = np.arange(len(acf))\n",
" plt.rcParams['figure.figsize'] = (10, 5)\n",
"lags = np.arange(len(acf))\n",
"plt.rcParams['figure.figsize'] = (10, 5)\n",
"\n",
" plt.vlines([6, 10, 16], -0.2, 0.8, color=\"lightgrey\")\n",
" plt.plot(lags[1:], acf[1:])\n",
" plt.xlabel(\"bytes\")\n",
" plt.xlim(xmin=0)\n",
" plt.ylabel(\"correlation\")\n",
" plt.show()"
"plt.vlines([6, 10, 16], -0.2, 0.8, color=\"lightgrey\")\n",
"plt.plot(lags[1:], acf[1:])\n",
"plt.xlabel(\"bytes\")\n",
"plt.xlim(xmin=0)\n",
"plt.ylabel(\"correlation\")\n",
"plt.show()"
]
},
{
Expand Down

0 comments on commit a74b069

Please sign in to comment.