viewinline 0.1.5__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,203 @@
1
+ Copyright 2026 Keiko Nomura
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: viewinline
3
+ Version: 0.2.1
4
+ Summary: Quick look geospatial viewer for iTerm2 compatible terminals
5
+ Project-URL: Homepage, https://github.com/nkeikon/viewinline
6
+ Project-URL: Repository, https://github.com/nkeikon/viewinline
7
+ Project-URL: Issues, https://github.com/nkeikon/viewinline/issues
8
+ Author: Keiko Nomura
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.9
12
+ Requires-Dist: geopandas
13
+ Requires-Dist: matplotlib
14
+ Requires-Dist: numpy
15
+ Requires-Dist: pandas
16
+ Requires-Dist: pillow
17
+ Requires-Dist: pyogrio
18
+ Requires-Dist: rasterio
19
+ Provides-Extra: all
20
+ Requires-Dist: duckdb; extra == 'all'
21
+ Requires-Dist: h5py; extra == 'all'
22
+ Requires-Dist: pyarrow; extra == 'all'
23
+ Provides-Extra: hdf5
24
+ Requires-Dist: h5py; extra == 'hdf5'
25
+ Provides-Extra: parquet
26
+ Requires-Dist: pyarrow; extra == 'parquet'
27
+ Provides-Extra: sql
28
+ Requires-Dist: duckdb; extra == 'sql'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # viewinline
32
+ [![Downloads](https://static.pepy.tech/badge/viewinline)](https://pepy.tech/project/viewinline)
33
+ [![PyPI version](https://img.shields.io/pypi/v/viewinline)](https://pypi.org/project/viewinline/)
34
+ [![Python version](https://img.shields.io/badge/python-%3E%3D3.9-blue.svg)](https://pypi.org/project/viewinline/)
35
+
36
+ **Quick-look geospatial viewer for compatible terminals.**
37
+ Displays rasters, vectors, and tabular data directly in the terminal with no GUI and no temporary files.
38
+
39
+ Think of it as `ls` for geospatial files — designed for quick visual inspection at the command line, not a replacement for QGIS, ArcGIS, or analytical workflows.
40
+
41
+ Particularly useful on HPC systems and remote servers accessed via SSH. Images render on your local terminal without X11 forwarding, VNC, or file downloads.
42
+
43
+ This tool combines the core display logic of `viewtif` and `viewgeom`, but is **non-interactive**: you can't zoom, pan, or switch colormaps on the fly. Instead, you control everything through command-line options (e.g. --display, --color-by, --colormap).
44
+
45
+ It uses the iTerm2 inline image protocol (OSC 1337) to render previews. In incompatible terminals, the escape codes are silently ignored with no errors or crashes.
46
+
47
+ ## Installation
48
+ Requires Python 3.9 or later.
49
+
50
+ ```bash
51
+ pip install viewinline
52
+ ```
53
+
54
+ ## Usage
55
+ ```bash
56
+ # Rasters
57
+ viewinline path/to/file.tif
58
+ viewinline R.tif G.tif B.tif # RGB composite (also works with --rgbfiles)
59
+ viewinline path/to/multiband.tif --rgb 3 2 1
60
+ viewinline path/to/folder --gallery 4x3 # show image gallery (e.g. 4x3 grid)
61
+
62
+ # NetCDF and HDF
63
+ viewinline file.nc # list variables
64
+ viewinline file.nc --subset 2 # display variable 2
65
+ viewinline file.nc --subset 1 --band 10 # variable 1, timestep 10 --band or --timestep
66
+ viewinline temp.nc --subset 1 --colormap plasma --vmin 273 --vmax 310
67
+
68
+ # Vectors
69
+ viewinline path/to/vector.geojson
70
+ viewinline boundaries.geoparquet --color-by population --colormap viridis
71
+
72
+ # CSV and Parquet
73
+ viewinline data.csv # preview rows and columns
74
+ viewinline data.parquet --describe # summary statistics
75
+ viewinline data.csv --hist # histograms for all numeric columns
76
+ viewinline data.csv --hist area_km2 # histogram for one column
77
+ viewinline data.csv --scatter X Y # scatter plot
78
+ viewinline data.csv --where "year > 2010" # filter rows
79
+ viewinline data.csv --sort population --desc # sort rows
80
+ viewinline data.csv --sql "SELECT * FROM data WHERE area > 100 ORDER BY year" # full SQL
81
+
82
+ # Tabular view of vectors
83
+ viewinline counties.shp --table # view shapefile as table
84
+ viewinline counties.shp --table --describe # summary statistics
85
+ viewinline counties.shp --table --unique STATE_NAME
86
+ viewinline data.geoparquet --table --where "POP > 100000" --sort POP --desc
87
+ ```
88
+
89
+ ## Compatible terminals
90
+
91
+ The iTerm2 inline image protocol (OSC 1337) is supported by:
92
+
93
+ - **iTerm2** (macOS)
94
+ - **WezTerm** (cross-platform)
95
+ - **Konsole** (Linux/KDE)
96
+ - **Rio**, **Contour** (cross-platform)
97
+
98
+ **Not compatible:** Mac Terminal, GNOME Terminal, Kitty (uses different protocol), Ghostty, Alacritty
99
+
100
+ **SSH/HPC usage:** Works over SSH when connecting from a compatible terminal. Images render on your local machine, not the remote server. No X11 forwarding or VNC required.
101
+
102
+ **tmux/screen:** Inline images don't work inside tmux or screen sessions, even with `allow-passthrough on`. Use a plain terminal tab.
103
+
104
+ ## Features
105
+ - Previews rasters, vectors, and tabular data directly in the terminal
106
+ - Non-interactive: everything is controlled through command-line options
107
+ - **NetCDF/HDF Support:** Display variables from NetCDF (.nc) and HDF5 (.h5, .hdf5) files with automatic nodata detection and multi-slice navigation
108
+ - **Parquet/GeoParquet:** Render GeoParquet as vector maps or view as tabular data
109
+ - **Tabular View for Vectors:** Use `--table` to access CSV-style operations (filter, sort, describe, hist) on any vector file
110
+
111
+ ## Supported formats
112
+ **Rasters**
113
+ - GeoTIFF (.tif, .tiff)
114
+ - PNG, JPEG (.png, .jpg, .jpeg)
115
+ - NetCDF (.nc)
116
+ - HDF5 (.h5, .hdf5)
117
+ - HDF4 (.hdf) — requires GDAL with HDF4 support
118
+ - Single-band or multi-band composites
119
+
120
+ **Composite inputs**
121
+ - You can pass three rasters (e.g. `R.tif G.tif B.tif`) or use `--rgbfiles R.tif G.tif B.tif` to create an RGB composite
122
+ - Multi-band files: use `--rgb 3 2 1` to specify band order
123
+
124
+ **Vectors**
125
+ - GeoJSON (`.geojson`)
126
+ - Shapefile (`.shp`)
127
+ - GeoPackage (`.gpkg`)
128
+ - Parquet/GeoParquet (`.parquet`, `.geoparquet`)
129
+
130
+ **Tabular data (CSV and Parquet)**
131
+ - CSV (`.csv`)
132
+ - Parquet (`.parquet`) — requires `pyarrow`
133
+ - All CSV operations work on parquet files
134
+ - Preview file summary (rows, columns, and names)
135
+ - Summary statistics with `--describe`
136
+ - Inline histograms with `--hist`
137
+ - Scatter plots with `--scatter X Y`
138
+ - Filter rows with `--where`, sort with `--sort`, limit output with `--limit`
139
+ - Full SQL queries with `--sql` (DuckDB required) — use `data` as the table name
140
+
141
+ **Tabular view of vectors**
142
+ - Use `--table` flag to view any vector file (shapefiles, GeoPackage, GeoParquet) as tabular data
143
+ - Enables all CSV-style operations: `--describe`, `--hist`, `--scatter`, `--unique`, `--where`, `--sort`
144
+
145
+ **Gallery view**
146
+ - Display all images in a folder with `--gallery 4x4`
147
+
148
+ **NetCDF/HDF notes:**
149
+ - viewinline lists only variables that can be displayed as 2D or 3D arrays
150
+ - Variables with additional dimensions (e.g., vertical levels) may be listed but will fail to display with a clear error message
151
+ - For a complete variable list, use `ncdump -h file.nc` or `viewtif`
152
+
153
+ ## Dependencies
154
+
155
+ **Core dependencies** (installed automatically):
156
+ - `rasterio` — raster reading (includes GDAL)
157
+ - `geopandas`, `pyogrio` — vector reading
158
+ - `matplotlib` — vector rendering
159
+ - `Pillow` — image encoding
160
+ - `numpy`, `pandas` — data handling
161
+
162
+ **Optional dependencies:**
163
+ - `duckdb` — required for `--where`, `--sort`, `--sql`, `--limit` with filtering
164
+ ```bash
165
+ pip install duckdb
166
+ ```
167
+ - `pyarrow` — required for Parquet/GeoParquet files
168
+ ```bash
169
+ pip install pyarrow
170
+ ```
171
+ - `h5py` — fallback for HDF5 files if GDAL lacks HDF5 support (usually not needed)
172
+ ```bash
173
+ pip install h5py
174
+ ```
175
+
176
+ **Note on HDF support:**
177
+ - **HDF5** (.h5, .hdf5): Supported via rasterio if GDAL has HDF5 support (most installations)
178
+ - **HDF4** (.hdf): Requires GDAL compiled with HDF4 support (common in MODIS data)
179
+ - **NetCDF** (.nc): Supported via rasterio (uses GDAL's NetCDF driver)
180
+
181
+ ## Available options
182
+ ```
183
+ General:
184
+ --display DISPLAY Resize only the displayed image (0.5=smaller, 2=bigger). Default: auto-fit to terminal.
185
+
186
+ Raster:
187
+ --band BAND Band number to display (single raster), or slice number for NetCDF. (default: 1)
188
+ --timestep INTEGER Alias for --band when working with NetCDF files.
189
+ --subset INTEGER Variable index for NetCDF/HDF files (e.g., --subset 1).
190
+ --colormap Apply colormap to single-band rasters. Flag without the color scheme → 'terrain'.
191
+ --rgb R G B Three band numbers for RGB display (e.g., --rgb 4 3 2). Overrides default 1 2 3.
192
+ --rgbfiles R G B Three single-band rasters for RGB composite. Can also provide as positional arguments.
193
+ --vmin VMIN Minimum pixel value for raster display scaling.
194
+ --vmax VMAX Maximum pixel value for raster display scaling.
195
+ --nodata NODATA Override nodata value for rasters if dataset metadata is missing or incorrect.
196
+ --gallery [GRID] Display all PNG/JPG/TIF images in a folder as thumbnails (e.g., 5x5 grid).
197
+
198
+ Vector:
199
+ --color-by COLUMN Column to color vector features by.
200
+ --colormap Apply colormap to vector coloring. Flag without value → 'terrain'.
201
+ --width WIDTH Line width for vector boundaries. (default: 0.7)
202
+ --edgecolor COLOR Edge color for vector outlines (hex or named color). (default: white)
203
+ --layer LAYER Layer name for GeoPackage/multi-layer files, or variable name for NetCDF files.
204
+ --table Display vector/parquet file as tabular data instead of rendering geometry.
205
+
206
+ CSV and Parquet:
207
+ --describe [COLUMN] Show summary statistics for all numeric columns or specify one column name.
208
+ --hist [COLUMN] Show histograms for all numeric columns or specify one column name.
209
+ --bins BINS Number of bins for histograms (used with --hist). (default: 20)
210
+ --scatter X Y Plot scatter of two numeric columns (e.g., --scatter area_km2 year).
211
+ --unique COLUMN Show unique values for a categorical column.
212
+ --where EXPR Filter rows using SQL WHERE clause (DuckDB required). Example: --where "year > 2010"
213
+ --sort COLUMN Sort rows by column, ascending by default. Use --desc to reverse.
214
+ --desc Sort in descending order (used with --sort).
215
+ --limit N Limit number of rows shown (e.g., --limit 100).
216
+ --select COLUMNS Select specific columns (space separated). Example: --select Country City
217
+ --sql QUERY Execute full DuckDB SQL query. Use 'data' as table name. Example: --sql "SELECT * FROM data WHERE Poverty > 40"
218
+ ```
219
+
220
+ ## Need help?
221
+ You can ask questions about usage via the documentation-based assistant:
222
+
223
+ 👉 [Ask the viewtif + viewgeom + viewinline Helper](https://chatgpt.com/g/g-698b61c42f788191b884aed1b99dfcd8-viewtif-viewgeom-viewinline-helper)
224
+
225
+ 👉 For NASA staff: find 'viewtif + viewgeom + viewinline Helper' via the ChatGSFC Agent Marketplace
226
+
227
+ ## License
228
+ This project is released under the Apache License 2.0 © 2026 Keiko Nomura.
229
+
230
+ If you find this tool useful, please consider supporting or acknowledging it in your work.
231
+
232
+ ## Useful links
233
+ - [YouTube demo playlist](https://www.youtube.com/playlist?list=PLP9MNCMgJIHj6FvahJ6Tembp1rCyhLtR4)
234
+ - [Demo at the initial release](https://www.linkedin.com/posts/keiko-nomura-0231891_just-released-viewinline-for-those-using-activity-7390643680770023424-8Guu?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)
235
+ - [Demo for the v0.1.3](https://www.linkedin.com/posts/keiko-nomura-0231891_just-released-viewinline-v013-for-iterm2-activity-7391633864798081025-dPbk?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)
236
+ - [Demo with GDAL](https://www.linkedin.com/posts/keiko-nomura-0231891_if-you-use-gdal-heres-a-quick-example-workflow-activity-7390892270847373312-XWZ4?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)
237
+ - [User feedback (thank you!)](https://www.linkedin.com/posts/jamshidsodikov_shout-out-to-keiko-nomura-for-viewinline-activity-7390979602539528192-S8JQ?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)
@@ -0,0 +1,207 @@
1
+ # viewinline
2
+ [![Downloads](https://static.pepy.tech/badge/viewinline)](https://pepy.tech/project/viewinline)
3
+ [![PyPI version](https://img.shields.io/pypi/v/viewinline)](https://pypi.org/project/viewinline/)
4
+ [![Python version](https://img.shields.io/badge/python-%3E%3D3.9-blue.svg)](https://pypi.org/project/viewinline/)
5
+
6
+ **Quick-look geospatial viewer for compatible terminals.**
7
+ Displays rasters, vectors, and tabular data directly in the terminal with no GUI and no temporary files.
8
+
9
+ Think of it as `ls` for geospatial files — designed for quick visual inspection at the command line, not a replacement for QGIS, ArcGIS, or analytical workflows.
10
+
11
+ Particularly useful on HPC systems and remote servers accessed via SSH. Images render on your local terminal without X11 forwarding, VNC, or file downloads.
12
+
13
+ This tool combines the core display logic of `viewtif` and `viewgeom`, but is **non-interactive**: you can't zoom, pan, or switch colormaps on the fly. Instead, you control everything through command-line options (e.g. --display, --color-by, --colormap).
14
+
15
+ It uses the iTerm2 inline image protocol (OSC 1337) to render previews. In incompatible terminals, the escape codes are silently ignored with no errors or crashes.
16
+
17
+ ## Installation
18
+ Requires Python 3.9 or later.
19
+
20
+ ```bash
21
+ pip install viewinline
22
+ ```
23
+
24
+ ## Usage
25
+ ```bash
26
+ # Rasters
27
+ viewinline path/to/file.tif
28
+ viewinline R.tif G.tif B.tif # RGB composite (also works with --rgbfiles)
29
+ viewinline path/to/multiband.tif --rgb 3 2 1
30
+ viewinline path/to/folder --gallery 4x3 # show image gallery (e.g. 4x3 grid)
31
+
32
+ # NetCDF and HDF
33
+ viewinline file.nc # list variables
34
+ viewinline file.nc --subset 2 # display variable 2
35
+ viewinline file.nc --subset 1 --band 10 # variable 1, timestep 10 --band or --timestep
36
+ viewinline temp.nc --subset 1 --colormap plasma --vmin 273 --vmax 310
37
+
38
+ # Vectors
39
+ viewinline path/to/vector.geojson
40
+ viewinline boundaries.geoparquet --color-by population --colormap viridis
41
+
42
+ # CSV and Parquet
43
+ viewinline data.csv # preview rows and columns
44
+ viewinline data.parquet --describe # summary statistics
45
+ viewinline data.csv --hist # histograms for all numeric columns
46
+ viewinline data.csv --hist area_km2 # histogram for one column
47
+ viewinline data.csv --scatter X Y # scatter plot
48
+ viewinline data.csv --where "year > 2010" # filter rows
49
+ viewinline data.csv --sort population --desc # sort rows
50
+ viewinline data.csv --sql "SELECT * FROM data WHERE area > 100 ORDER BY year" # full SQL
51
+
52
+ # Tabular view of vectors
53
+ viewinline counties.shp --table # view shapefile as table
54
+ viewinline counties.shp --table --describe # summary statistics
55
+ viewinline counties.shp --table --unique STATE_NAME
56
+ viewinline data.geoparquet --table --where "POP > 100000" --sort POP --desc
57
+ ```
58
+
59
+ ## Compatible terminals
60
+
61
+ The iTerm2 inline image protocol (OSC 1337) is supported by:
62
+
63
+ - **iTerm2** (macOS)
64
+ - **WezTerm** (cross-platform)
65
+ - **Konsole** (Linux/KDE)
66
+ - **Rio**, **Contour** (cross-platform)
67
+
68
+ **Not compatible:** Mac Terminal, GNOME Terminal, Kitty (uses different protocol), Ghostty, Alacritty
69
+
70
+ **SSH/HPC usage:** Works over SSH when connecting from a compatible terminal. Images render on your local machine, not the remote server. No X11 forwarding or VNC required.
71
+
72
+ **tmux/screen:** Inline images don't work inside tmux or screen sessions, even with `allow-passthrough on`. Use a plain terminal tab.
73
+
74
+ ## Features
75
+ - Previews rasters, vectors, and tabular data directly in the terminal
76
+ - Non-interactive: everything is controlled through command-line options
77
+ - **NetCDF/HDF Support:** Display variables from NetCDF (.nc) and HDF5 (.h5, .hdf5) files with automatic nodata detection and multi-slice navigation
78
+ - **Parquet/GeoParquet:** Render GeoParquet as vector maps or view as tabular data
79
+ - **Tabular View for Vectors:** Use `--table` to access CSV-style operations (filter, sort, describe, hist) on any vector file
80
+
81
+ ## Supported formats
82
+ **Rasters**
83
+ - GeoTIFF (.tif, .tiff)
84
+ - PNG, JPEG (.png, .jpg, .jpeg)
85
+ - NetCDF (.nc)
86
+ - HDF5 (.h5, .hdf5)
87
+ - HDF4 (.hdf) — requires GDAL with HDF4 support
88
+ - Single-band or multi-band composites
89
+
90
+ **Composite inputs**
91
+ - You can pass three rasters (e.g. `R.tif G.tif B.tif`) or use `--rgbfiles R.tif G.tif B.tif` to create an RGB composite
92
+ - Multi-band files: use `--rgb 3 2 1` to specify band order
93
+
94
+ **Vectors**
95
+ - GeoJSON (`.geojson`)
96
+ - Shapefile (`.shp`)
97
+ - GeoPackage (`.gpkg`)
98
+ - Parquet/GeoParquet (`.parquet`, `.geoparquet`)
99
+
100
+ **Tabular data (CSV and Parquet)**
101
+ - CSV (`.csv`)
102
+ - Parquet (`.parquet`) — requires `pyarrow`
103
+ - All CSV operations work on parquet files
104
+ - Preview file summary (rows, columns, and names)
105
+ - Summary statistics with `--describe`
106
+ - Inline histograms with `--hist`
107
+ - Scatter plots with `--scatter X Y`
108
+ - Filter rows with `--where`, sort with `--sort`, limit output with `--limit`
109
+ - Full SQL queries with `--sql` (DuckDB required) — use `data` as the table name
110
+
111
+ **Tabular view of vectors**
112
+ - Use `--table` flag to view any vector file (shapefiles, GeoPackage, GeoParquet) as tabular data
113
+ - Enables all CSV-style operations: `--describe`, `--hist`, `--scatter`, `--unique`, `--where`, `--sort`
114
+
115
+ **Gallery view**
116
+ - Display all images in a folder with `--gallery 4x4`
117
+
118
+ **NetCDF/HDF notes:**
119
+ - viewinline lists only variables that can be displayed as 2D or 3D arrays
120
+ - Variables with additional dimensions (e.g., vertical levels) may be listed but will fail to display with a clear error message
121
+ - For a complete variable list, use `ncdump -h file.nc` or `viewtif`
122
+
123
+ ## Dependencies
124
+
125
+ **Core dependencies** (installed automatically):
126
+ - `rasterio` — raster reading (includes GDAL)
127
+ - `geopandas`, `pyogrio` — vector reading
128
+ - `matplotlib` — vector rendering
129
+ - `Pillow` — image encoding
130
+ - `numpy`, `pandas` — data handling
131
+
132
+ **Optional dependencies:**
133
+ - `duckdb` — required for `--where`, `--sort`, `--sql`, `--limit` with filtering
134
+ ```bash
135
+ pip install duckdb
136
+ ```
137
+ - `pyarrow` — required for Parquet/GeoParquet files
138
+ ```bash
139
+ pip install pyarrow
140
+ ```
141
+ - `h5py` — fallback for HDF5 files if GDAL lacks HDF5 support (usually not needed)
142
+ ```bash
143
+ pip install h5py
144
+ ```
145
+
146
+ **Note on HDF support:**
147
+ - **HDF5** (.h5, .hdf5): Supported via rasterio if GDAL has HDF5 support (most installations)
148
+ - **HDF4** (.hdf): Requires GDAL compiled with HDF4 support (common in MODIS data)
149
+ - **NetCDF** (.nc): Supported via rasterio (uses GDAL's NetCDF driver)
150
+
151
+ ## Available options
152
+ ```
153
+ General:
154
+ --display DISPLAY Resize only the displayed image (0.5=smaller, 2=bigger). Default: auto-fit to terminal.
155
+
156
+ Raster:
157
+ --band BAND Band number to display (single raster), or slice number for NetCDF. (default: 1)
158
+ --timestep INTEGER Alias for --band when working with NetCDF files.
159
+ --subset INTEGER Variable index for NetCDF/HDF files (e.g., --subset 1).
160
+ --colormap Apply colormap to single-band rasters. Flag without the color scheme → 'terrain'.
161
+ --rgb R G B Three band numbers for RGB display (e.g., --rgb 4 3 2). Overrides default 1 2 3.
162
+ --rgbfiles R G B Three single-band rasters for RGB composite. Can also provide as positional arguments.
163
+ --vmin VMIN Minimum pixel value for raster display scaling.
164
+ --vmax VMAX Maximum pixel value for raster display scaling.
165
+ --nodata NODATA Override nodata value for rasters if dataset metadata is missing or incorrect.
166
+ --gallery [GRID] Display all PNG/JPG/TIF images in a folder as thumbnails (e.g., 5x5 grid).
167
+
168
+ Vector:
169
+ --color-by COLUMN Column to color vector features by.
170
+ --colormap Apply colormap to vector coloring. Flag without value → 'terrain'.
171
+ --width WIDTH Line width for vector boundaries. (default: 0.7)
172
+ --edgecolor COLOR Edge color for vector outlines (hex or named color). (default: white)
173
+ --layer LAYER Layer name for GeoPackage/multi-layer files, or variable name for NetCDF files.
174
+ --table Display vector/parquet file as tabular data instead of rendering geometry.
175
+
176
+ CSV and Parquet:
177
+ --describe [COLUMN] Show summary statistics for all numeric columns or specify one column name.
178
+ --hist [COLUMN] Show histograms for all numeric columns or specify one column name.
179
+ --bins BINS Number of bins for histograms (used with --hist). (default: 20)
180
+ --scatter X Y Plot scatter of two numeric columns (e.g., --scatter area_km2 year).
181
+ --unique COLUMN Show unique values for a categorical column.
182
+ --where EXPR Filter rows using SQL WHERE clause (DuckDB required). Example: --where "year > 2010"
183
+ --sort COLUMN Sort rows by column, ascending by default. Use --desc to reverse.
184
+ --desc Sort in descending order (used with --sort).
185
+ --limit N Limit number of rows shown (e.g., --limit 100).
186
+ --select COLUMNS Select specific columns (space separated). Example: --select Country City
187
+ --sql QUERY Execute full DuckDB SQL query. Use 'data' as table name. Example: --sql "SELECT * FROM data WHERE Poverty > 40"
188
+ ```
189
+
190
+ ## Need help?
191
+ You can ask questions about usage via the documentation-based assistant:
192
+
193
+ 👉 [Ask the viewtif + viewgeom + viewinline Helper](https://chatgpt.com/g/g-698b61c42f788191b884aed1b99dfcd8-viewtif-viewgeom-viewinline-helper)
194
+
195
+ 👉 For NASA staff: find 'viewtif + viewgeom + viewinline Helper' via the ChatGSFC Agent Marketplace
196
+
197
+ ## License
198
+ This project is released under the Apache License 2.0 © 2026 Keiko Nomura.
199
+
200
+ If you find this tool useful, please consider supporting or acknowledging it in your work.
201
+
202
+ ## Useful links
203
+ - [YouTube demo playlist](https://www.youtube.com/playlist?list=PLP9MNCMgJIHj6FvahJ6Tembp1rCyhLtR4)
204
+ - [Demo at the initial release](https://www.linkedin.com/posts/keiko-nomura-0231891_just-released-viewinline-for-those-using-activity-7390643680770023424-8Guu?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)
205
+ - [Demo for the v0.1.3](https://www.linkedin.com/posts/keiko-nomura-0231891_just-released-viewinline-v013-for-iterm2-activity-7391633864798081025-dPbk?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)
206
+ - [Demo with GDAL](https://www.linkedin.com/posts/keiko-nomura-0231891_if-you-use-gdal-heres-a-quick-example-workflow-activity-7390892270847373312-XWZ4?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)
207
+ - [User feedback (thank you!)](https://www.linkedin.com/posts/jamshidsodikov_shout-out-to-keiko-nomura-for-viewinline-activity-7390979602539528192-S8JQ?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAA0INsBVIO1f6nS_NkKqFh4Na1ZpoYo2fc)