Skip to content

Instantly share code, notes, and snippets.

View tomkralidis's full-sized avatar
🛠️
geohacking

Tom Kralidis tomkralidis

🛠️
geohacking
View GitHub Profile
@tomkralidis
tomkralidis / README.md
Last active June 5, 2019 13:27
MetPX virtualenv example

Example of MetPX plugin integration in a Python 3 virtualenv.

python3 -m venv bulletins_es_test
cd bulletins_es_test
. bin/activate
pip install elasticsearch
sr_subscribe --version  # Version 2.18.11b6
sr_subscribe bulletins.conf foreground
@tomkralidis
tomkralidis / csvpo.py
Last active September 19, 2022 14:30
Python PO to CSV to PO roundtripping
import unicodecsv as csv
import sys
import polib
def po2csv(po_file):
po = polib.pofile(po_file)
with open('messages.csv', 'wb') as csvfile:
writer = csv.writer(csvfile)
@tomkralidis
tomkralidis / general_servicectl_initd.sh
Last active April 19, 2018 16:39
Generic service controller for init.d
#! /bin/sh
# /etc/init.d/pygeoapi
PROGRAMNAME=pygeoapi
check_service() {
ps cax | grep $PROGRAMNAME > /dev/null
if [ $? -eq 0 ]; then
return 0
else
@tomkralidis
tomkralidis / landsat-aws-es-loader.py
Created April 2, 2018 02:10
Python Landsat AWS Elasticsearch Loader
# load https://aws.amazon.com/public-datasets/landsat/ scene_list into ES index
import csv
from datetime import datetime
import json
from elasticsearch import Elasticsearch
index_name = 'landsat-aws'
type_name = 'FeatureCollection'
@tomkralidis
tomkralidis / 00README.md
Last active June 25, 2017 13:42
pycsw profile plugin example
<?xml version="1.0" encoding="UTF-8"?>
<che:CHE_MD_Metadata xmlns:che="http://www.geocat.ch/2008/che" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" gco:isoType="gmd:MD_Metadata" xsi:schemaLocation="http://www.geocat.ch/2008/che http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd">
<gmd:fileIdentifier>
<gco:CharacterString>8698bf0b-fceb-4f0f-989b-111e7c4af0a4</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language xmlns:comp="http://www.geocat.ch/2003/05/gateway/GM03Comprehensive" xmlns:xalan="http://xml.apache.org/xalan">
<gco:CharacterString>ger</gco:CharacterString>
</gmd:language>
<gmd:characterSet xmlns:comp="http://www.geocat.ch/2003/05/gateway/GM03Co
@tomkralidis
tomkralidis / ogr_repository.py
Last active February 8, 2017 21:45
pycsw bare repository plugin
#-*- coding: utf-8 -*-
# set pycsw configuration like:
# [repository]
# source=ogr_repository.OGRRepository
from pycsw.core.repository import Repository
class OGRRepository(Repository):
''' Class to interact with underlying repository '''
@tomkralidis
tomkralidis / ogc-cat3-12-168r6-request.xml
Last active October 19, 2016 10:48
OGC CAT 3.0 12-168r6 query example update (example after Table 4)
<?xml version="1.0" encoding="UTF-8"?>
<GetRecords
service="CSW"
version="3.0.0"
maxRecords="5"
startPosition="1"
outputFormat="application/xml"
outputSchema="http://www.opengis.net/cat/csw/3.0"
xmlns="http://www.opengis.net/cat/csw/3.0"
xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
@tomkralidis
tomkralidis / GitHub-non-issue-response.md
Created May 18, 2016 01:47
Boilerplate GitHub issue response to things that are not issues

Please post questions to the $PROJECT mailing list. $PROJECT's GitHub issues are for software bugs/enhancements and related tasks.

@tomkralidis
tomkralidis / gdal-netcdf-issues.md
Created December 10, 2015 17:25
GDAL NetCDF issues

GDAL NetCDF Issues

GDAL has some limitation concerning the reading of netCDF4 files.

Most of the tests were done on a personal computer using QGIS 2.12.1 and GDAL 1.11.3.

  • Gdal can't read correctly netCDF lat/long values if there is not an exact spacing between points (pixel). For example: use a exact spacing of 0.2 degrees.
  • Gdal reads misplaced lat/long grid in netCDF4 files. It reads 0 to 360 degrees instead of -180 to 180 degrees. But I think that this can be solved setting a parameter (pm=-180 or pm=180) in projection definition in QGIS or MapServer.
  • Gdal displays netCDF files upside down: http://lagerratrobe.blogspot.ca/2009/02/upside-down-netcdf-created-with-gdal.html
  • Gdal can't detect if data are wrtitten bottom up or bottom down, so when reading netCDF files, to get statistics and pixel values we must change a configuration of Gdal.