From 9e6735dc2997c7758f0d3a22cba952ee56082902 Mon Sep 17 00:00:00 2001 From: kwinkunks Date: Sun, 11 Sep 2022 07:29:17 -0300 Subject: [PATCH] changelog update and some tidying up --- CHANGELOG.md | 30 +++++++++++++++++++++++++++--- gio/{dem.py => esri.py} | 15 +++++++++++++-- gio/xy_to_grid.py | 1 - 3 files changed, 40 insertions(+), 6 deletions(-) rename gio/{dem.py => esri.py} (67%) diff --git a/CHANGELOG.md b/CHANGELOG.md index d752402..88d03da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,32 @@ # CHANGELOG -## 0.1.7, September 2022 +## 0.1.6, 11 September 2022 -- Added `xarray.DataArray` accessor (in `xarray.py`) to save in ZMAP and OpendTect formats. The plan is to add more formats according to need. +The overall plan of `gio` is starting to take shape. In general, the plan is to read specialist subsurace formats of various file types, with either `xarray.Dataset` or `xarray.DataArray` as the target. Then, `gio` will write these same formats via an accessor method on the `xarray` object (and possibly also via ordinary functions). This release implements this pattern for the first time, specifically for the ZMAP format. +- Added the `zmap` module, with functions for reading ZMAP files (`read_zmap()`) and for writing files starting from an `xarray.DataArray` or from a NumPy array. +- Added `xarray.DataArray` accessor (in `xarray.py`) to save in ZMAP and OpendTect formats. The plan is to add more target formats the the accessor, according to need. +- Added tests for the ZMAP components. Removed `run_tests.py` and put the `pytest` options in `setup.cfg`, which seems cleaner. +- Started trying to maintain this file properly! +- Note that there are two 'work in progress' modules: `esri.py` and `usgs.py`, which will eventually read some common DEM formats. -## Early releases, January to June 2022 \ No newline at end of file +In general, everything is a work in progress but if there is a chapter on something in [the User Guide](https://code.agilescientific.com/gio/index.html#user-guide) then it mostly works, at least for the test cases I have. If you have a file that should work but doesn't, please consider [making an issue](https://github.com/agilescientific/gio/issues). + +Feedback is welcome on whether the target format for readers should be `xarray.Dataset` every time, even for singleton files. + + +## 0.1.5, 12 February 2022 + +- Added the `random` module, which generates random surfaces using sums of Perlin noise. The high-level interface is `gio.generate_random_surface()`. Also added a notebook for help on this module. +- Added the `logo` module, which plots gio's logo. Using the logo in the docs. + + +## 0.1.4, 3 February 2022 + +- New module: `surfer`, adapted from Seequent's [`steno3d_surfer`](https://pypi.org/project/steno3d_surfer), for reading Surfer 6 binary and ASCII files, and Surfer 7 binary files. The module does not write files yet. +- Started development on `iesx` module for reading IESX formatted files, eg from Petrel or OpendTect + + +## 0.1.0 to 0.1.3, February 2022 + +- Early development included setting up the package, and adding the `opendtect` and `xy_to_grid` modules. diff --git a/gio/dem.py b/gio/esri.py similarity index 67% rename from gio/dem.py rename to gio/esri.py index e2249b7..c7b5a17 100644 --- a/gio/dem.py +++ b/gio/esri.py @@ -1,7 +1,9 @@ """ -Read 2D ASCII/binary Surfer grid files. +Read E00 format DEM (digital elevation model) files. -:copyright: 2022 Agile Geoscience (this adaptation) +THIS IS A WORK IN PROGRESS. IT DOES NOT WORK YET. + +:copyright: 2022 Agile Geoscience :license: Apache 2.0 """ import numpy as np @@ -30,4 +32,13 @@ def read_e00_text(fname): p = re.compile(r"IFO(.+?)EOI", flags=re.DOTALL) ifo, = p.search(text).groups() + # Unflatten this thing. + values = [] + for row in data: + for col in row: + values.append(float(col)) + + # Convert to an array and reshape. + arr = np.array(values).reshape(ny, nx) + return arr diff --git a/gio/xy_to_grid.py b/gio/xy_to_grid.py index b321c18..2e4472a 100644 --- a/gio/xy_to_grid.py +++ b/gio/xy_to_grid.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Special case: binning data with only (x, y) coords.