@@ -133,6 +133,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
133
133
* correct info for `var,return=dset` and dsetnum and dsetpath.
134
134
* V745 4/19 *acm* ticket 1916, special handling getting context for RETURN= outputs
135
135
* V751 6/19 *acm* ticket 1929, don't chop off str_len when testing for reformatting at the end
136
+ * V7.63 9/20 *acm* add `var,RETURN=*coord` to get coordinate variables for DSG datasets
136
137
137
138
IMPLICIT NONE
138
139
#include " netcdf.inc"
@@ -166,6 +167,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
166
167
INTEGER CGRID_SIZE, CGRID_AXIS, TM_LENSTR1, CX_DIM_LEN,
167
168
. FIND_DSET_NUMBER, GET_ABSTRACT_LINE, TM_LENSTR,
168
169
. TM_GET_GRIDNUM, GRID_FROM_NAME, TM_SUBSC, TM_GET_CALENDAR_ID,
170
+ . TM_DSG_DSET_FROM_GRID,
169
171
. str_len, lenbuff, iend, itmp, axis,
170
172
. mr, cx, mr_temp, i, i1, i2, use_digits, true_end,
171
173
. qual_end, brkt, idim, use_width, dset, varid,
@@ -177,7 +179,8 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
177
179
REAL result, val, aval
178
180
REAL * 8 TM_WORLD, TM_WW_AXLEN, ww
179
181
CHARACTER TM_FMT* 48 , LEFINT* 16 , VAR_TITLE* (max_len),
180
- . VAR_UNITS* (max_len), GET_STRING_ELEMENT* (max_len),
182
+ . VAR_UNITS* (max_len), GET_STRING_ELEMENT* (max_len),
183
+ . VAR_CODE* 1024 ,
181
184
. repl* (max_len), bad_str* (max_len), return_errmsg* 256 ,
182
185
. buff* 128 , varname* 512 , attname* 128 , aname* 128 , name* 128
183
186
CHARACTER * 6 typstring(0 :6 )
@@ -795,7 +798,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
795
798
WRITE (return_errmsg,*)
796
799
. ' use RETURN = shape,size,grid,title,bad,t0,f0,units,dset, ' //pCR//
797
800
. ' dsetnum,dsetpath,dsettitle,* size,* start,* end,' //pCR//
798
- . ' * units,* axis,nc_scale,nc_offset,user_scale,user_offset,' //pCR//
801
+ . ' * units,* axis,* coord, nc_scale,nc_offset,user_scale,user_offset,' //pCR//
799
802
. ' calendar,dtype,xmod,tmod,status,isDepth,isReady,defined'
800
803
! . ' calendar,dtype,xmod,tmod,status,isDepth,isReady,isLoaded' ! w isLoaded
801
804
@@ -1156,7 +1159,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
1156
1159
! repl = ' 1 '
1157
1160
! ENDIF
1158
1161
!
1159
- * ... RETURN=*SIZE, *START, *END, *UNITS, *AXIS
1162
+ * ... RETURN=*SIZE, *START, *END, *UNITS, *AXIS, or *COORD for dsg datasets
1160
1163
ELSE
1161
1164
* ... axis specific requests - must start with i,j,k,l,m,n or x,y,z,t,e,f
1162
1165
DO 220 idim = 1, nferdims
@@ -1187,6 +1190,34 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
1187
1190
CALL CHOOSE_LINE_NAME(axis, orig_name, repl)
1188
1191
ENDIF
1189
1192
need_formatting = .FALSE.
1193
+
1194
+ ELSEIF ( repl(2:5) .EQ. "COOR") THEN
1195
+ grid = cx_grid(cx)
1196
+ IF (TM_ITSA_DSG(grid)) THEN
1197
+
1198
+ dset = TM_DSG_DSET_FROM_GRID( grid )
1199
+
1200
+ IF (idim.LE.t_dim) THEN
1201
+ repl = VAR_CODE( cat_file_var, dsg_coord_var(idim,dset))
1202
+
1203
+ ELSE
1204
+ axis = CGRID_AXIS ( idim, cx )
1205
+ IF (axis.EQ.mnormal .OR. axis.EQ.munknown) THEN
1206
+ repl = ' NORMAL'
1207
+ ELSE
1208
+ * Get axis name. If mode upcase is canceled, use original spelling if defined
1209
+ orig_name = .FALSE.
1210
+ CALL CHOOSE_LINE_NAME(axis, orig_name, repl)
1211
+ ENDIF
1212
+ need_formatting = .FALSE.
1213
+ ENDIF
1214
+
1215
+ ELSE ! not dsg
1216
+ GOTO 5530
1217
+ ENDIF
1218
+
1219
+ need_formatting = .FALSE.
1220
+
1190
1221
ELSEIF ( repl(2:5) .EQ. "UNIT" ) THEN
1191
1222
axis = CGRID_AXIS ( idim, cx )
1192
1223
IF (axis.EQ.mnormal .OR. axis.EQ.munknown) THEN
@@ -1415,4 +1446,9 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
1415
1446
5520 risc_buff = cmnd(i:qual_end)
1416
1447
CALL ERRMSG( ferr_invalid_command, status,
1417
1448
. return_errmsg//pCR//risc_buff, *5000)
1449
+
1450
+ 5530 risc_buff = cmnd(i:qual_end)
1451
+ CALL ERRMSG( ferr_invalid_command, status,
1452
+ . ' Variable is not on a DSG grid in a DSG dataset: '
1453
+ . //risc_buff, *5000)
1418
1454
END
0 commit comments