Skip to content

Commit 5622260

Browse files
authored
Merge pull request #281 from kentonwho/Projection
Bug fix: station name reading methods
2 parents e5a6ce9 + 7a498c7 commit 5622260

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

@msh/private/readfort15.m

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,13 @@
256256

257257
% STAE location
258258
if ( f15dat.nstae > 0 )
259-
260259
f15dat.elvstaloc = zeros(f15dat.nstae,2) ;
260+
f15dat.elvstaname = strings(f15dat.nstae,1) ;
261261
for k = 1: f15dat.nstae
262-
val = readlinevec( fid ) ;
263-
262+
[val,name] = readlinevecname( fid ) ;
263+
264264
f15dat.elvstaloc(k,1:2) = val(1:2)' ;
265+
f15dat.elvstaname(k) = name;
265266
end
266267
end
267268

@@ -274,11 +275,13 @@
274275

275276
% STAV location
276277
if ( f15dat.nstav > 0 )
277-
f15dat.velstaloc = zeros(f15dat.nstav,2) ;
278+
f15dat.velstaloc = zeros(f15dat.nstav,2) ;
279+
f15dat.velstaname = strings(f15dat.nstav,1) ;
278280
for k = 1: f15dat.nstav
279-
val = readlinevec( fid ) ;
280-
281+
[val,name] = readlinevecname( fid ) ;
282+
281283
f15dat.velstaloc(k,1:2) = val ;
284+
f15dat.velstaname(k) = name ;
282285
end
283286
end
284287

@@ -317,7 +320,6 @@
317320
f15dat.outgm = readlinevec( fid ) ;
318321
end
319322

320-
321323
% NFREQ
322324
f15dat.nfreq = readlinescalar( fid ) ;
323325
for k = 1: f15dat.nfreq
@@ -379,5 +381,12 @@
379381
[token,rem] = strtok(msg) ;
380382

381383
end
382-
383-
end
384+
385+
function [vec, name] = readlinevecname( fid )
386+
387+
msg = fgetl(fid) ;
388+
[token, name] = strtok(msg,"!");
389+
vec = sscanf(token,'%f');
390+
391+
end
392+
end

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
175175
- Printing of namelist character strings or numbers. https://github.com/CHLNDDEV/OceanMesh2D/pull/261
176176
- `Make_offset63.m` time interval computation. https://github.com/CHLNDDEV/OceanMesh2D/pull/261 and https://github.com/CHLNDDEV/OceanMesh2D/pull/272
177177
- Removed dependency on statistics toolbox when using the 'nanfill' option in `msh.interp`. https://github.com/CHLNDDEV/OceanMesh2D/pull/269
178+
- Missing routines for reading in elvstaname and velstaname in readfort15.m by adding readlinevecname() method. https://github.com/CHLNDDEV/OceanMesh2D/pull/281
178179

179180
### [5.0.0] - 2021-07-29
180181
## Added

0 commit comments

Comments
 (0)