{"id":87,"date":"2014-11-16T00:45:42","date_gmt":"2014-11-15T21:45:42","guid":{"rendered":"http:\/\/home.dgrechka.net\/blog\/?p=87"},"modified":"2014-11-16T01:10:10","modified_gmt":"2014-11-15T22:10:10","slug":"ghcn-v3-sql","status":"publish","type":"post","link":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/","title":{"rendered":"GHCN v3 in SQL"},"content":{"rendered":"<p>The <a href=\"http:\/\/www.ncdc.noaa.gov\/ghcnm\/\">Global Historical Climatology Network-Monthly (GHCN-M)<\/a> dataset by <a href=\"http:\/\/www.ncdc.noaa.gov\/\">NCDC\u00a0<\/a>is particularly important data set if your research\u00a0deals with climate data. It is widely accepted. Its major advantage is quality control and a variety\u00a0of data sources combined together. I\u00a0used\u00a0it several times as reference data for\u00a0validation\u00a0of calculated climate surfaces. It is also great for uncertainty\u00a0assessment of climate interpolation methods.<\/p>\n<p>But it is distributed as text files of specific format only. And you will have\u00a0to write a parser to fetch the data.<\/p>\n<p>This week I decided to load the GHCNv3 into MySQL to make it flexible for fetching.\u00a0I can fetch different subsets of the data into CSV files just with composing a proper select query. That made a significant speed up in experiments with interpolation techniques.<\/p>\n<p>I share these SQL scripts to enable others researchers to load GHCN v3 into their own\u00a0SQL servers. You can restore GHCN at your server and perform requests to it. Just download the script, execute it. And you are able to get the data you need. Fast :)<\/p>\n<ul>\n<li><a href=\"\/filestore\/for_blog\/GHCNv3_mssql_db2_oracle_postgre.sql.bz2\"><strong>GHCNv3_ansi.sql<\/strong><\/a> (compatible with PostgreSQL, DB2, Oracle, MsSQL)<\/li>\n<li><a href=\"\/filestore\/for_blog\/GHCNv3_mysql.sql.bz2\"><strong>GHCNv3_mysql.sql<\/strong><\/a> (MySQL specific syntax)<\/li>\n<\/ul>\n<p>The scripts do not contain CREATE DATABASE statements. Thus create an empty database by hand and then execute the proper script.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Global Historical Climatology Network-Monthly (GHCN-M) dataset by NCDC\u00a0is particularly important data set if your research\u00a0deals with climate data. It is widely accepted. Its major advantage is quality control and a variety\u00a0of data sources combined together. I\u00a0used\u00a0it several times as reference data for\u00a0validation\u00a0of calculated climate surfaces. It is also great for uncertainty\u00a0assessment of climate interpolation &hellip; <a href=\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;GHCN v3 in SQL&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":88,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21,10,5],"tags":[26,38,8,22,25,23,24,16],"class_list":["post-87","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-climate","category-data","category-study-research","tag-air-temperature","tag-climate","tag-dataset","tag-ghcn","tag-mysql","tag-ncdc","tag-sql","tag-time-series"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>GHCN v3 in SQL - Dmitry A. Grechka<\/title>\n<meta name=\"description\" content=\"Load the GHCN v3 into your SQL server. Just download and execute the script\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GHCN v3 in SQL - Dmitry A. Grechka\" \/>\n<meta property=\"og:description\" content=\"Load the GHCN v3 into your SQL server. Just download and execute the script\" \/>\n<meta property=\"og:url\" content=\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Dmitry A. Grechka\" \/>\n<meta property=\"article:published_time\" content=\"2014-11-15T21:45:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-11-15T22:10:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1134\" \/>\n\t<meta property=\"og:image:height\" content=\"477\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"dmitry\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dmitry\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/\",\"url\":\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/\",\"name\":\"GHCN v3 in SQL - Dmitry A. Grechka\",\"isPartOf\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png\",\"datePublished\":\"2014-11-15T21:45:42+00:00\",\"dateModified\":\"2014-11-15T22:10:10+00:00\",\"author\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f\"},\"description\":\"Load the GHCN v3 into your SQL server. Just download and execute the script\",\"breadcrumb\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#primaryimage\",\"url\":\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png\",\"contentUrl\":\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png\",\"width\":1134,\"height\":477,\"caption\":\"GHCN v3 mean January temperatures\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/grechka.family\/dmitry\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GHCN v3 in SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#website\",\"url\":\"https:\/\/grechka.family\/dmitry\/blog\/\",\"name\":\"Dmitry A. Grechka\",\"description\":\"Personal blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/grechka.family\/dmitry\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f\",\"name\":\"dmitry\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g\",\"caption\":\"dmitry\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GHCN v3 in SQL - Dmitry A. Grechka","description":"Load the GHCN v3 into your SQL server. Just download and execute the script","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/","og_locale":"en_GB","og_type":"article","og_title":"GHCN v3 in SQL - Dmitry A. Grechka","og_description":"Load the GHCN v3 into your SQL server. Just download and execute the script","og_url":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/","og_site_name":"Dmitry A. Grechka","article_published_time":"2014-11-15T21:45:42+00:00","article_modified_time":"2014-11-15T22:10:10+00:00","og_image":[{"width":1134,"height":477,"url":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png","type":"image\/png"}],"author":"dmitry","twitter_misc":{"Written by":"dmitry","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/","url":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/","name":"GHCN v3 in SQL - Dmitry A. Grechka","isPartOf":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#primaryimage"},"image":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png","datePublished":"2014-11-15T21:45:42+00:00","dateModified":"2014-11-15T22:10:10+00:00","author":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f"},"description":"Load the GHCN v3 into your SQL server. Just download and execute the script","breadcrumb":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#primaryimage","url":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png","contentUrl":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png","width":1134,"height":477,"caption":"GHCN v3 mean January temperatures"},{"@type":"BreadcrumbList","@id":"https:\/\/grechka.family\/dmitry\/blog\/2014\/11\/ghcn-v3-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/grechka.family\/dmitry\/blog\/"},{"@type":"ListItem","position":2,"name":"GHCN v3 in SQL"}]},{"@type":"WebSite","@id":"https:\/\/grechka.family\/dmitry\/blog\/#website","url":"https:\/\/grechka.family\/dmitry\/blog\/","name":"Dmitry A. Grechka","description":"Personal blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/grechka.family\/dmitry\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f","name":"dmitry","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g","caption":"dmitry"}}]}},"jetpack_featured_media_url":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2014\/11\/GHCNv3.png","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":10,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":99,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts\/87\/revisions\/99"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/media\/88"}],"wp:attachment":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}