1 /*--------------------------------------------------------------------
2  *
3  *      Copyright (c) 1991-2021 by the GMT Team (https://www.generic-mapping-tools.org/team.html)
4  *      See LICENSE.TXT file for copying and redistribution conditions.
5  *
6  *      This program is free software; you can redistribute it and/or modify
7  *      it under the terms of the GNU Lesser General Public License as published by
8  *      the Free Software Foundation; version 3 or any later version.
9  *
10  *      This program is distributed in the hope that it will be useful,
11  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *      GNU Lesser General Public License for more details.
14  *
15  *      Contact info: www.generic-mapping-tools.org
16  *--------------------------------------------------------------------*/
17 
18 /*
19  * Include file for list of data grids available via @earth_relief_*.grd references.
20  *
21  * Author:      Paul Wessel
22  * Date:        19-Oct-2019
23  * Version:     6 API
24  */
25 
26 #ifndef GMT_REMOTE_H
27 #define GMT_REMOTE_H
28 
29 struct GMT_RESOLUTION {	/* Struct to hold information about the various resolutions for a remote data set family */
30 	char inc[GMT_LEN8];	/* Grid spacing in text format. E.g., 30m, 03s, etc. */
31 	char reg;			/* Grid/Image registration (g or p). E.g., g */
32 	double resolution;	/* In number of nodes per degree. E.g, for 01m that is 60 */
33 };
34 
35 struct GMT_DATA_INFO {
36 	int id;						/* Running number 0-(n-1) AFTER array is sorted */
37 	bool used;					/* If true then do not repeat the attribution details */
38 	char dir[GMT_LEN64];		/* Directory of file.  Here, / (root) means /export/gmtserver/gmt/data */
39 	char file[GMT_LEN64];		/* Full file (or tile directory) name. E.g., earth_relief_20m_g.grd or earth_relief_01m_g/ */
40 	char ext[GMT_LEN8];			/* Data file extension. E.g., .grd, *tif, etc. */
41 	char inc[GMT_LEN8];			/* Grid spacing in text format. E.g., 30m */
42 	char reg;					/* Grid/Image registration (g or p). E.g., g */
43 	double d_inc;				/* Grid spacing in floating point degrees (e.g., 0.5) */
44 	double scale;				/* Scale to convert integers to data units */
45 	double offset;				/* Offset to shift to original data range */
46 	char size[GMT_LEN8];		/* Total file/tile set size in text format. E.g., 300M */
47 	double tile_size;			/* Tile size in integer degrees (0 if no tiling) */
48 	char date[GMT_LEN16];		/* Creation date in yyyy-mm-dd (e.g., 2020-06-01) */
49 	char tag[GMT_LEN64];		/* Tag for tiling.  E.g., earth_relief_01m_g, SRTMGL3 */
50 	char coverage[GMT_LEN64];	/* File with tile coverage. E.g., srtm_tiles.nc or - for none */
51 	char filler[GMT_LEN64];		/* File with background filler. E.g., earth_relief_tiles_15s.grd or - for none */
52 	char CPT[GMT_LEN64];		/* Name of default master CPT. E.g., geo or - for none */
53 	char remark[GMT_LEN256];	/* Attribution and information about this data set */
54 };
55 
56 struct GMT_DATA_HASH {			/* Holds file hashes (probably SHA256) */
57 	char name[GMT_LEN64];		/* File name (no leading directory) */
58 	char hash[GMT_LEN128];		/* The file hash */
59 	size_t size;				/* File size in bytes */
60 };
61 
62 enum GMT_tile_coverage {	/* Values in any tile coverage grid (e.g., srtm_tiles.nc) */
63 	GMT_NO_TILE      = 0,	/* No high-resolution data for this tile */
64 	GMT_PARTIAL_TILE = 1,	/* There is data, but part of tile is ocean */
65 	GMT_FULL_TILE    = 2	/* There is complete coverage on land */
66 };
67 
68 #define GMT_SRTM_ONLY	1	/* Mode so that when srtm_relief* is used we do not blend in earth_relief_15s */
69 
70 #define GMT_HASH_SERVER_FILE "gmt_hash_server.txt"
71 #define GMT_INFO_SERVER_FILE "gmt_data_server.txt"
72 
73 #define GMT_HASH_TIME_OUT		10L	/* Not waiting longer than this to time out on getting the hash file */
74 #define GMT_CONNECT_TIME_OUT	10L	/* Not waiting longer than this to time out on getting a response from the server */
75 
76 #define GMT_TILE_EXTENSION_REMOTE  		"jp2"	/* Tile extension of JPEG2000 files to be downloaded */
77 #define GMT_TILE_EXTENSION_REMOTE_LEN	3U		/* Length of JPEG2000 file extension */
78 #define GMT_TILE_EXTENSION_LOCAL		"nc"	/* Tile extension of netCDF nc short int files to be saved */
79 #define GMT_TILE_EXTENSION_LOCAL_LEN	2U		/* Length of nc short int file extension */
80 
81 #define GMT_IMAGE_DPU_VALUE	300	/* 300 dots per inch */
82 #define GMT_IMAGE_DPU_UNIT	'i'	/* 300 dpts per inch */
83 
84 #endif /* GMT_REMOTE_H */
85