Skip to content

Commit b9f916e

Browse files
committed
updates to 9/25/20
1 parent 9ba96d6 commit b9f916e

11 files changed

+261
-68
lines changed

bench/TEST_SCRIPTS

+2
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ bn_dsg_naming.jnl
347347
bn_profile_from_timeprof.jnl
348348
bn_profile_from_trajprof.jnl
349349
bn_dsg_compound.jnl
350+
bn_dsg_plotalong.jnl
351+
bn_dsg_return_coord.jnl
350352

351353
!
352354
! bn_gif, bn_all_ef, and bn_startupfile at end

bench/TEST_SCRIPTS_NOREMOTE

+2
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ bn_dsg_naming.jnl
347347
bn_profile_from_timeprof.jnl
348348
bn_profile_from_trajprof.jnl
349349
bn_dsg_compound.jnl
350+
bn_dsg_plotalong.jnl
351+
bn_dsg_return_coord.jnl
350352

351353
!
352354
! bn_gif, bn_all_ef, and bn_startupfile at end

bench/genjnls/bn_all.jnl

+6
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,12 @@ GO bn_dsg_reshapefcn
13551355
GO bn_reset bn_dsg_compound
13561356
GO bn_compound_dsg
13571357

1358+
GO bn_reset bn_dsg_plotalong
1359+
GO bn_dsg_plotalong
1360+
1361+
GO bn_reset bn_dsg_return_coord
1362+
GO bn_dsg_return_coord
1363+
13581364
! *********** PyFerret-specific scripts ***********
13591365

13601366
IF ($program_name"0|PyFerret>1|*>0") THEN
13.7 KB
Loading
16.3 KB
Loading

bench/v7jnls/bn_dsg_plotalong.jnl

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
! bn_dsg_plotalong.jnl
2+
! tests of PLOT/ALONG= for DSG datasets
3+
! plot/along-xy will make a map plot for timeseries, profile,
4+
! timeseriesprofile or trajectoryprofile data
5+
! plot/along=t makes a timeseries plot of timeseriesprofile data.
6+
7+
use profile_dsg.nc
8+
set view ul
9+
plot/along=xy sal
10+
11+
use simple_timeseries_dsg
12+
set view ur
13+
plot/along=xy sst
14+
15+
use dsg_trajprofile_example.nc
16+
set view ll
17+
plot/along=xy temperature
18+
19+
use dsg_tserprofile_example.nc
20+
set view lr
21+
plot/along=xy temperature
22+
23+
frame/file=plot_alongxy_dsg.gif
24+
cancel view
25+
26+
! Now test plot/along= giving the native plot type,
27+
! which should do plot as if /along= were not given.
28+
29+
use profile_dsg.nc
30+
set view ul
31+
plot/along=z sal
32+
33+
use simple_timeseries_dsg
34+
set view ur
35+
plot/along=t sst
36+
37+
use dsg_trajprofile_example.nc
38+
set view ll
39+
plot/along=z temperature
40+
41+
use dsg_tserprofile_example.nc
42+
set view lr
43+
plot/along=z temperature
44+
45+
frame/file=plot_along_native_dsg.gif
46+
47+
cancel view
48+
! Intentional errors, specifying /along= for directions
49+
! that are invalid for the data type
50+
51+
set mode ignore
52+
53+
use profile_dsg.nc
54+
plot/along=y sal
55+
plot/along=t sal
56+
57+
use simple_timeseries_dsg
58+
plot/along=y sst
59+
plot/along=z sst
60+
61+
use dsg_trajprofile_example.nc
62+
plot/along=y temperature
63+
plot/along=t temperature
64+
65+
use dsg_point_data.nc
66+
plot/along=y sst
67+
use dsg_point_data.nc
68+
plot/along=z sst
69+
use dsg_point_data.nc
70+
plot/along=t sst
71+
72+
set mode /last ignore

bench/v7jnls/bn_dsg_return_coord.jnl

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
! bn_dsg_return_coord.jnl
2+
! `var,return=xcoord` for DSG variables
3+
4+
use profile_dsg.nc
5+
say `sal,return=xcoord`
6+
say `sal,return=ycoord`
7+
say `sal,return=zcoord`
8+
say `sal,return=tcoord`
9+
say `sal,return=xaxis`
10+
say `sal,return=zaxis`
11+
say `sal,return=eaxis`
12+
13+
14+
use dsg_trajprofile_example.nc
15+
say `temperature,return=xcoord`
16+
say `temperature,return=ycoord`
17+
say `temperature,return=zcoord`
18+
say `temperature,return=tcoord`
19+
say `temperature,return=xaxis`
20+
say `temperature,return=zaxis`
21+
say `temperature,return=eaxis`
22+
23+
! Intentional errors
24+
set mode ignore
25+
26+
! The variable has to be an instance variable or a obs variable
27+
say `trajectory,return=xcoord`
28+
29+
! Desn't apply to gridded datasets
30+
31+
use coads_climatology
32+
say `sst,return=xcoord`
33+
34+
set mode/last ignore

fer/gnl/repl_exprns.F

+39-3
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
133133
* correct info for `var,return=dset` and dsetnum and dsetpath.
134134
* V745 4/19 *acm* ticket 1916, special handling getting context for RETURN= outputs
135135
* 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
136137

137138
IMPLICIT NONE
138139
#include "netcdf.inc"
@@ -166,6 +167,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
166167
INTEGER CGRID_SIZE, CGRID_AXIS, TM_LENSTR1, CX_DIM_LEN,
167168
. FIND_DSET_NUMBER, GET_ABSTRACT_LINE, TM_LENSTR,
168169
. TM_GET_GRIDNUM, GRID_FROM_NAME, TM_SUBSC, TM_GET_CALENDAR_ID,
170+
. TM_DSG_DSET_FROM_GRID,
169171
. str_len, lenbuff, iend, itmp, axis,
170172
. mr, cx, mr_temp, i, i1, i2, use_digits, true_end,
171173
. qual_end, brkt, idim, use_width, dset, varid,
@@ -177,7 +179,8 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
177179
REAL result, val, aval
178180
REAL*8 TM_WORLD, TM_WW_AXLEN, ww
179181
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,
181184
. repl*(max_len), bad_str*(max_len), return_errmsg*256,
182185
. buff*128, varname*512, attname*128, aname*128, name*128
183186
CHARACTER*6 typstring(0:6)
@@ -795,7 +798,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
795798
WRITE (return_errmsg,*)
796799
. 'use RETURN= shape,size,grid,title,bad,t0,f0,units,dset, '//pCR//
797800
. ' 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//
799802
. ' calendar,dtype,xmod,tmod,status,isDepth,isReady,defined'
800803
! . ' calendar,dtype,xmod,tmod,status,isDepth,isReady,isLoaded' ! w isLoaded
801804
@@ -1156,7 +1159,7 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
11561159
! repl = '1'
11571160
! ENDIF
11581161
!
1159-
* ... RETURN=*SIZE, *START, *END, *UNITS, *AXIS
1162+
* ... RETURN=*SIZE, *START, *END, *UNITS, *AXIS, or *COORD for dsg datasets
11601163
ELSE
11611164
* ... axis specific requests - must start with i,j,k,l,m,n or x,y,z,t,e,f
11621165
DO 220 idim = 1, nferdims
@@ -1187,6 +1190,34 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
11871190
CALL CHOOSE_LINE_NAME(axis, orig_name, repl)
11881191
ENDIF
11891192
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+
11901221
ELSEIF ( repl(2:5) .EQ. "UNIT" ) THEN
11911222
axis = CGRID_AXIS ( idim, cx )
11921223
IF (axis.EQ.mnormal .OR. axis.EQ.munknown) THEN
@@ -1415,4 +1446,9 @@ SUBROUTINE REPL_EXPRNS( cmnd, lencmnd, cmnd_num,
14151446
5520 risc_buff = cmnd(i:qual_end)
14161447
CALL ERRMSG( ferr_invalid_command, status,
14171448
. 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)
14181454
END

fer/plt/dsg_pltalong_setup.F

+61-56
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ SUBROUTINE DSG_PLTALONG_SETUP (dset, plot_orient, its_traj,
4545
IF (dset .LE. pdset_irrelevant) RETURN
4646

4747
its_traj = dsg_feature_type(dset).EQ.pfeatureType_Trajectory .OR.
48-
. dsg_feature_type(dset).EQ.pfeatureType_Point
48+
. dsg_feature_type(dset).EQ.pfeatureType_Point
4949

5050
* dataset orientation.
5151

@@ -56,102 +56,107 @@ SUBROUTINE DSG_PLTALONG_SETUP (dset, plot_orient, its_traj,
5656
along_dim = no_dim
5757
loc = qual_given(slash_plot_along)
5858
IF ( loc .GT. 0. ) THEN
59-
59+
6060
CALL EQUAL_STRING( cmnd_buff(qual_start(loc):qual_end(loc)),
6161
. buff1, status )
6262
IF (status .NE. ferr_ok) THEN
63-
plot_orient = orientation
64-
GOTO 4000
63+
plot_orient = orientation
64+
GOTO 4000
6565
ENDIF
6666

6767
DO along_dim = 1, nferdims
68-
IF ( buff1 .EQ. ww_dim_name(along_dim) ) EXIT
68+
IF ( buff1 .EQ. ww_dim_name(along_dim) ) EXIT
6969
ENDDO
7070

7171
ENDIF
7272

7373
IF (along_dim .EQ. no_dim) GOTO 4000
7474

75-
* Check valid setings for PLOT/ALONG= for each Feature Type
75+
* Check valid setings for PLOT/ALONG= for each Feature Type.
76+
* When the setting agrees with the default plot direction, ignore
77+
* the /along= setting.
7678

7779
IF (orientation .EQ. pfeatureType_Point) THEN
7880

79-
plot_orient = orientation
80-
IF (along_dim .NE. x_dim)
81-
. message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
82-
. ' : Point data can only be plotted along XY'
83-
81+
plot_orient = orientation
82+
IF (along_dim .EQ. x_dim) THEN
83+
GOTO 5000
84+
ELSE
85+
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
86+
. ' : Point data can only be plotted along XY'
87+
ENDIF
8488
ELSE IF (orientation .EQ. pfeatureType_Trajectory) THEN
8589

86-
IF (along_dim .EQ. x_dim) THEN
87-
plot_orient = orientation
88-
ELSE IF (along_dim.EQ.t_dim) THEN
89-
plot_orient = pfeatureType_TimeSeries
90-
ELSE
91-
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
92-
. ' : Trajectory data can only be plotted along XY or T'
93-
ENDIF
90+
IF (along_dim .EQ. x_dim) THEN
91+
GOTO 5000
92+
ELSE IF (along_dim.EQ.t_dim) THEN
93+
plot_orient = pfeatureType_TimeSeries
94+
ELSE
95+
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
96+
. ' : Trajectory data can only be plotted along XY or T'
97+
ENDIF
9498

9599

96100
ELSE IF (orientation .EQ. pfeatureType_Profile) THEN
97101

98-
IF (along_dim .EQ. z_dim) THEN
99-
plot_orient = orientation
100-
ELSE IF (along_dim .EQ. x_dim) THEN
101-
plot_orient = pfeatureType_Point
102-
ELSE
103-
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
104-
. ' : Profile data can only be plotted along XY or Z'
105-
ENDIF
102+
IF (along_dim .EQ. z_dim) THEN
103+
GOTO 5000
104+
ELSE IF (along_dim .EQ. x_dim) THEN
105+
plot_orient = pfeatureType_Point
106+
dsg_as_traj = .TRUE.
107+
ELSE
108+
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
109+
. ' : Profile data can only be plotted along XY or Z'
110+
ENDIF
106111

107112
ELSE IF (orientation .EQ. pfeatureType_TimeSeries) THEN
108113

109-
IF (along_dim .EQ. t_dim) THEN
110-
plot_orient = orientation
111-
ELSE IF (along_dim .EQ. x_dim) THEN
112-
plot_orient = pfeatureType_Point
113-
ELSE
114-
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
115-
. ' : Timeseries data can only be plotted along XY or Z'
116-
ENDIF
114+
IF (along_dim .EQ. t_dim) THEN
115+
GOTO 5000
116+
ELSE IF (along_dim .EQ. x_dim) THEN
117+
plot_orient = pfeatureType_Point
118+
dsg_as_traj = .TRUE.
119+
ELSE
120+
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
121+
. ' : Timeseries data can only be plotted along XY or Z'
122+
ENDIF
117123

118124
ELSE IF (orientation .EQ. pfeatureType_TrajectoryProfile ) THEN
119125

120126
IF (along_dim .EQ. x_dim) THEN
121127
plot_orient = pFeatureType_Trajectory
122128
dsg_as_traj = .TRUE.
123-
ELSE IF (along_dim .EQ. z_dim) THEN
124-
plot_orient = pfeatureType_Profile
125-
ELSE
126-
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
127-
. ' : TrajectoryProfile data'//
128-
. ' can only be plotted along XY or Z'
129-
ENDIF
130-
129+
ELSE IF (along_dim .EQ. z_dim) THEN
130+
GOTO 5000
131+
ELSE
132+
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
133+
. ' : TrajectoryProfile data'//
134+
. ' can only be plotted along XY or Z'
135+
ENDIF
136+
131137
ELSE IF (orientation .EQ. pfeatureType_TimeseriesProfile ) THEN
132138

133139
IF (along_dim .EQ. x_dim) THEN
134140
plot_orient = pFeatureType_Point
135141
dsg_as_traj = .TRUE.
136-
ELSE IF (along_dim .EQ. z_dim) THEN
137-
plot_orient = pfeatureType_Profile
138-
dsg_as_traj = .TRUE.
139-
ELSE IF (along_dim .EQ. t_dim) THEN
140-
plot_orient = pfeatureType_Timeseries
141-
dsg_as_time = .TRUE.
142-
ELSE
143-
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
144-
. ' : pfeatureType_TimeseriesProfile data'//
145-
. ' can only be plotted along XY, Z, or T'
146-
ENDIF
142+
ELSE IF (along_dim .EQ. z_dim) THEN
143+
GOTO 5000
144+
ELSE IF (along_dim .EQ. t_dim) THEN
145+
plot_orient = pfeatureType_Timeseries
146+
dsg_as_time = .TRUE.
147+
ELSE
148+
message = 'PLOT/ALONG='//ww_dim_name(along_dim)//
149+
. ' : pfeatureType_TimeseriesProfile data'//
150+
. ' can only be plotted along XY, Z, or T'
151+
ENDIF
147152

148153
ENDIF
149154

150155
4000 CONTINUE
151156

152157
its_traj = plot_orient.EQ.pfeatureType_Trajectory .OR.
153-
. plot_orient.EQ.pfeatureType_Point .OR.
154-
. dsg_as_traj
158+
. plot_orient.EQ.pfeatureType_Point .OR.
159+
. dsg_as_traj
155160

156161
IF (message .NE. 'none') THEN
157162
CALL ERRMSG (ferr_invalid_command, status, message, *5000)

0 commit comments

Comments
 (0)