1 /* -*-Mode: C;-*- 2 * Module: LATS include file 3 * 4 * Copyright: 1996, Regents of the University of California 5 * This software may not be distributed to others without 6 * permission of the author. 7 * 8 * Author: Bob Drach, Lawrence Livermore National Laboratory 9 * drach@llnl.gov 10 * 11 * Version: $Id: lats.h,v 1.1.1.1 2002/06/27 19:44:13 cvsadmin Exp $ 12 * 13 * Revision History: 14 * 15 * $Log: lats.h,v $ 16 * Revision 1.1.1.1 2002/06/27 19:44:13 cvsadmin 17 * initial GrADS CVS import - release 1.8sl10 18 * 19 * Revision 1.1.1.1 2001/10/18 02:00:57 Administrator 20 * Initial repository: v1.8SL8 plus slight MSDOS mods 21 * 22 * Revision 1.12 1997/10/15 17:53:14 drach 23 * - remove name collisions with cdunif 24 * - only one vertical dimension with GrADS/GRIB 25 * - in sync with Mike's GrADS src170 26 * - parameter table in sync with standard model output listing 27 * 28 * Revision 1.11 1996/11/11 22:39:19 drach 29 * - Added function to set the basetime (lats_basetime) 30 * 31 * Revision 1.10 1996/10/22 19:05:03 fiorino 32 * latsgrib bug in .ctl creator 33 * 34 * Revision 1.9 1996/10/10 23:15:43 drach 35 * - lats_create filetype changed to convention, with options LATS_PCMDI, 36 * LATS_GRADS_GRIB, and LATS_COARDS. 37 * - monthly data defaults to 16-bit compression 38 * - LATS_MONTHLY_TABLE_COMP option added to override 16-bit compression 39 * - AMIP II standard parameter file 40 * - parameter file incorporates GRIB center and subcenter 41 * - if time delta is positive, check that (new_time - old_time)=integer*delta 42 * 43 * Revision 1.8 1996/08/20 18:34:07 drach 44 * - lats_create has a new argument: calendar 45 * - lats_grid: longitude, latitude dimension vectors are now double 46 * precision (double, C). 47 * - lats_vert_dim: vector of levels is now double precision (double, 48 * C). lats_vert_dim need not be called for single-value/surface 49 * dimensions, if defined in the parameter table. Multi-valued vertical 50 * dimensions, such as pressure levels, must be defined with 51 * lats_vert_dim. 52 * - lats_var: set level ID to 0 for implicitly defined surface 53 * dimension. 54 * - lats_write: level value is double precision (double, C). 55 * - lats_parmtab: replaces routine lats_vartab. 56 * - FORTRAN latserropt added: allows program to set error handling 57 * options. 58 * - The parameter file format changed. 59 * 60 * Revision 1.7 1996/06/27 01:11:36 drach 61 * - Remove timestats table 62 * 63 * Revision 1.6 1996/05/25 00:27:48 drach 64 * - Added tables for vertical dimension types, time statistics, originating 65 * centers, and quality control marks 66 * - Modified signatures of lats_create and lats_vert_dim 67 * 68 * Revision 1.5 1996/05/10 22:44:38 drach 69 * - Initial version before GRIB driver added: 70 * - Made grids, vertical dimensions file-independent 71 * 72 * Revision 1.4 1996/05/04 01:11:10 drach 73 * - Added name, units to lats_vert_dim 74 * - Added missing data attribute (latsnc.c) 75 * 76 * Revision 1.3 1996/05/03 18:59:23 drach 77 * - Moved vertical dimension definition from lats_var to lats_vert_dim 78 * - Changed lats_miss_double to lats_miss_float 79 * - Made time dimension file-dependent, revised lats_write accordingly 80 * - Added lats_var_nc, lats_vert_dim_nc 81 * - Allow GRIB-only compilation 82 * - Added FORTRAN interface 83 * 84 * Revision 1.2 1996/04/25 23:32:04 drach 85 * - Added checks for correct number of times, levels written 86 * - Stubbed in statistics routines 87 * 88 * Revision 1.1 1996/04/25 00:53:00 drach 89 * Initial repository version 90 * 91 * 92 */ 93 94 #ifndef _LATS_H 95 #define _LATS_H 96 97 /* 98 * ================================================================= 99 * Macros and Enums 100 * 101 * Note: modifications should be mirrored in lats.inc 102 * ================================================================= 103 */ 104 105 #define LATS_MAX_CENTERS 256 /* Max number of originating centers */ 106 #define LATS_MAX_COMMENTS 256 /* Max length of comment arguments */ 107 #define LATS_MAX_GRIDS 32 /* Max number of grids */ 108 #define LATS_MAX_NAME 128 /* Max name/units length */ 109 #define LATS_MAX_PARMS 512 /* Max number of parameters */ 110 #define LATS_MAX_PARM_LINE 512 /* Max characters in parameter file entry (one line) */ 111 #define LATS_MAX_PATH 256 /* Max file pathname length */ 112 #define LATS_MAX_RELUNITS 64 /* Max relative time units length */ 113 #define LATS_MAX_VAR_DIMS 4 /* Max number of dimensions in a variable */ 114 #define LATS_MAX_VERT_DIMS 32 /* Max number of level dimensions */ 115 #define LATS_MAX_VERT_TYPES 64 /* Max number of vertical dimension types */ 116 117 #define LATS_EXIT_ON_ERROR 0x1 /* Error flag: exit on error (lats.inc: LATS_FATAL) */ 118 #define LATS_REPORT_ERRORS 0x2 /* Error flag: report errors (verbose) (lats.inc: LATS_VERBOSE) */ 119 #define LATS_QC_ON 0x1 /* Quality control flag */ 120 #define LATS_FIXED_COMPRESSION_NBITS 16 /* Default bit length for compression of monthly mean data */ 121 122 typedef enum latsCloudLevels {LATS_LOW_LEVEL = 1, LATS_MEDIUM_LEVEL, LATS_HIGH_LEVEL} latsCloudLevels; 123 typedef enum latsConvention {LATS_PCMDI = 1, LATS_GRIB_ONLY, LATS_GRADS_GRIB, LATS_COARDS} latsConvention; 124 typedef enum latsFileType {LATS_NETCDF = 1, LATS_GRIB} latsFileType; 125 typedef enum latsGridType {LATS_GAUSSIAN = 1, LATS_LINEAR, LATS_GENERIC} latsGridType; 126 typedef enum latsMonotonicity {LATS_SINGLE = 1, LATS_INCREASING, LATS_DECREASING} latsMonotonicity; 127 typedef enum latsPositive {LATS_UP = 1, LATS_DOWN} latsPositive; 128 typedef enum latsTimeFreq {LATS_HOURLY = 1, LATS_DAILY, LATS_WEEKLY, LATS_MONTHLY, LATS_YEARLY, LATS_FIXED, LATS_MONTHLY_TABLE_COMP, LATS_FORECAST_HOURLY} latsTimeFreq; 129 typedef enum latsTimeStat {LATS_AVERAGE = 1, LATS_INSTANT, LATS_ACCUM, LATS_OTHER_TIME_STAT} latsTimeStat; 130 typedef enum latsType {LATS_FLOAT = 1, LATS_INT} latsType; 131 typedef enum latsVerticality {LATS_SINGLE_LEVEL = 1, LATS_MULTI_LEVEL} latsVerticality; 132 133 #define cdStandardCal 0x11 134 #define cdClimCal 0x0 135 #define cdHasLeap 0x100 136 #define cdHasNoLeap 0x000 137 #define cd365Days 0x1000 138 #define cd360Days 0x0000 139 #define cdJulianCal 0x10000 140 141 typedef enum latsCalenType { 142 LATS_STANDARD = ( cdStandardCal | cdHasLeap | cd365Days), 143 LATS_JULIAN = ( cdStandardCal | cdHasLeap | cd365Days | cdJulianCal), 144 LATS_NOLEAP = ( cdStandardCal | cdHasNoLeap | cd365Days), 145 LATS_360 = ( cdStandardCal | cdHasNoLeap | cd360Days), 146 LATS_CLIM = ( cdClimCal | cdHasNoLeap | cd365Days), 147 LATS_CLIMLEAP = ( cdClimCal | cdHasLeap | cd365Days), 148 LATS_CLIM360 = ( cdClimCal | cdHasNoLeap | cd360Days) 149 } latsCalenType; 150 151 /* 152 * ================================================================= 153 * Function Prototypes 154 * ================================================================= 155 */ 156 157 extern int lats_basetime(int fileid, int year, int month, int day, int hour); 158 extern int lats_close(int fileid); 159 extern int lats_create(char* path, int filetype, int calendar, int frequency, int delta, char* center, char* model, char* comment); 160 extern int lats_grid(char *name, int gridtype, int nlon, double lons[], int nlat, double lats[]); 161 extern int lats_miss_float(int fileid, int varid, float missing, float delta); 162 extern int lats_miss_int(int fileid, int varid, int missing); 163 extern int lats_var(int fileid, char* varname, int datatype, int timestat, int gridid, int levid, char* comments); 164 extern int lats_parmtab(char* table_path); 165 extern int lats_vert_dim(char* name, char* type, int nlev, double levs[]); 166 extern int lats_write(int fileid, int varid, double lev, int year, int month, int day, int hour, void* data); 167 168 /* 169 * ================================================================= 170 * Globals 171 * ================================================================= 172 */ 173 174 extern int lats_fatal; /* If set to 1, exit on error (default 0) */ 175 extern int lats_verbose; /* If set to 1, errors are reported (default 1) */ 176 extern int lats_qc; /* If set to 1, execute quality control (default 1) */ 177 178 #endif 179