<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://thechange.wiki/index.php?action=history&amp;feed=atom&amp;title=Code%3Aconvert-nasa-countries.c</id>
	<title>Code:convert-nasa-countries.c - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://thechange.wiki/index.php?action=history&amp;feed=atom&amp;title=Code%3Aconvert-nasa-countries.c"/>
	<link rel="alternate" type="text/html" href="https://thechange.wiki/index.php?title=Code:convert-nasa-countries.c&amp;action=history"/>
	<updated>2026-04-23T01:09:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://thechange.wiki/index.php?title=Code:convert-nasa-countries.c&amp;diff=344&amp;oldid=prev</id>
		<title>Elie at 04:53, 31 August 2022</title>
		<link rel="alternate" type="text/html" href="https://thechange.wiki/index.php?title=Code:convert-nasa-countries.c&amp;diff=344&amp;oldid=prev"/>
		<updated>2022-08-31T04:53:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:53, 31 August 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Output: [[:File:countries.data-int16-8640x4320]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Output: [[:File:countries.data-int16-8640x4320]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Dependencies: [[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;:File&lt;/del&gt;:stb_image_write.h]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Dependencies: [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Code&lt;/ins&gt;:stb_image_write.h]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==Code==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// Converts NASA GPWv4 data (country indicator) from ASCII format to binary data (64-bit double-precision floating point 2D array)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// Converts NASA GPWv4 data (country indicator) from ASCII format to binary data (64-bit double-precision floating point 2D array)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Elie</name></author>
	</entry>
	<entry>
		<id>https://thechange.wiki/index.php?title=Code:convert-nasa-countries.c&amp;diff=341&amp;oldid=prev</id>
		<title>Elie: Created page with &quot;Input: gpw_v4_national_identifier_grid_rev11_2pt5_min.asc, extracted from :File:gpw-v4-population-count-rev11_2020_2pt5_min_asc.zip  Output: :File:countries.data-int16-8640x4320  Dependencies: :File:stb_image_write.h  &lt;syntaxhighlight lang=&quot;c&quot;&gt; // Converts NASA GPWv4 data (country indicator) from ASCII format to binary data (64-bit double-precision floating point 2D array) // To compile:  gcc convert-nasa-countries.c -O -o convert-nasa-countries  #define IN_F...&quot;</title>
		<link rel="alternate" type="text/html" href="https://thechange.wiki/index.php?title=Code:convert-nasa-countries.c&amp;diff=341&amp;oldid=prev"/>
		<updated>2022-08-31T04:45:47Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Input: gpw_v4_national_identifier_grid_rev11_2pt5_min.asc, extracted from &lt;a href=&quot;/File:gpw-v4-population-count-rev11_2020_2pt5_min_asc.zip&quot; title=&quot;File:gpw-v4-population-count-rev11 2020 2pt5 min asc.zip&quot;&gt;File:gpw-v4-population-count-rev11_2020_2pt5_min_asc.zip&lt;/a&gt;  Output: &lt;a href=&quot;/File:countries.data-int16-8640x4320&quot; title=&quot;File:countries.data-int16-8640x4320&quot;&gt;File:countries.data-int16-8640x4320&lt;/a&gt;  Dependencies: &lt;a href=&quot;/index.php?title=File:stb_image_write.h&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;File:stb image write.h (page does not exist)&quot;&gt;File:stb_image_write.h&lt;/a&gt;  &amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt; // Converts NASA GPWv4 data (country indicator) from ASCII format to binary data (64-bit double-precision floating point 2D array) // To compile:  gcc convert-nasa-countries.c -O -o convert-nasa-countries  #define IN_F...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Input: gpw_v4_national_identifier_grid_rev11_2pt5_min.asc, extracted from [[:File:gpw-v4-population-count-rev11_2020_2pt5_min_asc.zip]]&lt;br /&gt;
&lt;br /&gt;
Output: [[:File:countries.data-int16-8640x4320]]&lt;br /&gt;
&lt;br /&gt;
Dependencies: [[:File:stb_image_write.h]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// Converts NASA GPWv4 data (country indicator) from ASCII format to binary data (64-bit double-precision floating point 2D array)&lt;br /&gt;
// To compile:  gcc convert-nasa-countries.c -O -o convert-nasa-countries&lt;br /&gt;
&lt;br /&gt;
#define IN_FILE  &amp;quot;data/gpw_v4_national_identifier_grid_rev11_2pt5_min.asc&amp;quot;&lt;br /&gt;
#define OUT_FILE &amp;quot;data/countries.data-int16-8640x4320&amp;quot;&lt;br /&gt;
#define INPUT_ASCII_DATA_START 131&lt;br /&gt;
#define INPUT_WIDTH 8640&lt;br /&gt;
#define INPUT_HEIGHT 4320&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
 FILE* in = fopen(IN_FILE, &amp;quot;r&amp;quot;);&lt;br /&gt;
 if (in == NULL) {&lt;br /&gt;
  perror(IN_FILE);&lt;br /&gt;
  return 1;&lt;br /&gt;
 }&lt;br /&gt;
 if (fseek(in, INPUT_ASCII_DATA_START, SEEK_SET)) {&lt;br /&gt;
  perror(IN_FILE);&lt;br /&gt;
  return 2;&lt;br /&gt;
 }&lt;br /&gt;
 FILE* out = fopen(OUT_FILE, &amp;quot;w&amp;quot;);&lt;br /&gt;
 if (out == NULL) {&lt;br /&gt;
  perror(OUT_FILE);&lt;br /&gt;
  return 3;&lt;br /&gt;
 }&lt;br /&gt;
 printf(&amp;quot;Input:  %s\nOutput: %s\n&amp;quot;,IN_FILE,OUT_FILE);&lt;br /&gt;
 int n=0;&lt;br /&gt;
 int value=0;&lt;br /&gt;
 while (!feof(in)) {&lt;br /&gt;
  if (fscanf(in, &amp;quot;%d&amp;quot;, &amp;amp;value) == 0) break;&lt;br /&gt;
  if (!n) printf(&amp;quot;%d\n&amp;quot;,value);&lt;br /&gt;
  if (fwrite(&amp;amp;value, sizeof(short), 1, out) == 0) break;&lt;br /&gt;
  ++n; if (!(n &amp;amp; 524288)) printf(&amp;quot;wrote %d MiB\n&amp;quot;, (n&amp;gt;&amp;gt;19));&lt;br /&gt;
 }&lt;br /&gt;
 fclose(in);&lt;br /&gt;
 fclose(out);&lt;br /&gt;
 printf(&amp;quot;wrote %d numbers to %s\n&amp;quot;, n, OUT_FILE);&lt;br /&gt;
 return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Elie</name></author>
	</entry>
</feed>