|
79 | 79 |
|
80 | 80 | tmpdata = ncread( fname_til, this_varname ); |
81 | 81 |
|
82 | | - % rename some fields |
83 | | - |
84 | | - if strcmp(this_varname,'i_indg1' ), this_varname = 'i_indg'; end |
85 | | - if strcmp(this_varname,'j_indg1' ), this_varname = 'j_indg'; end |
86 | | - if strcmp(this_varname,'frac_cell1' ), this_varname = 'frac_cell'; end |
87 | | - if strcmp(this_varname,'dummy_index1'), this_varname = 'dummy_index'; end |
88 | | - |
89 | 82 | cmd = ['tile_coord.', this_varname, ' = tmpdata;']; |
90 | 83 |
|
91 | 84 | %disp(cmd) |
|
232 | 225 | % |
233 | 226 | % header line 2: |
234 | 227 |
|
235 | | - tile_coord.N_grids = fscanf( ifp, '%f', 1 ); |
| 228 | + tile_coord.N_Grids = fscanf( ifp, '%f', 1 ); |
236 | 229 |
|
237 | | - % verify N_grids (should be 1 for EASE and 2 for non-EASE) |
| 230 | + % verify N_Grids (should be 1 for EASE and 2 for non-EASE) |
238 | 231 |
|
239 | | - if isEASE & tile_coord.N_grids~=1, error(['unexpected N_grids for EASE tile space: ', num2str(tile_coord.N_grids)]), end |
| 232 | + if isEASE & tile_coord.N_Grids~=1, error(['unexpected N_Grids for EASE tile space: ', num2str(tile_coord.N_Grids)]), end |
240 | 233 |
|
241 | | - if ~isEASE & tile_coord.N_grids~=2, error(['unexpected N_grids for non-EASE tile space: ', num2str(tile_coord.N_grids)]), end |
| 234 | + if ~isEASE & tile_coord.N_Grids~=2, error(['unexpected N_Grids for non-EASE tile space: ', num2str(tile_coord.N_Grids)]), end |
242 | 235 |
|
243 | 236 | % Deal with older EASE bcs versions having (useless) header lines for grid 2, |
244 | | - % despite having the correct value of N_grids=1 in header line 2. |
| 237 | + % despite having the correct value of N_Grids=1 in header line 2. |
245 | 238 |
|
246 | 239 | if isEASE & ( ~isempty(findstr('NL3',fname_til)) | ~isempty(findstr('NL4',fname_til)) ) |
247 | 240 |
|
248 | 241 | tmp_n_grids = 2; |
249 | 242 |
|
250 | 243 | else |
251 | 244 |
|
252 | | - tmp_n_grids = tile_coord.N_grids; |
| 245 | + tmp_n_grids = tile_coord.N_Grids; |
253 | 246 |
|
254 | 247 | end |
255 | 248 |
|
|
267 | 260 |
|
268 | 261 | if tmp_n_grids==2 |
269 | 262 |
|
270 | | - % NOTE: EASE NL3 and NL4 contain additional header lines for second grid, despite (correct) N_grids=1 |
| 263 | + % NOTE: EASE NL3 and NL4 contain additional header lines for second grid, despite (correct) N_Grids=1 |
| 264 | + % For these old versions, read (and then ignore) additional header lines. |
271 | 265 |
|
272 | | - tile_coord.Grid2_Name = fscanf( ifp, '%s', 1 ); |
273 | | - tile_coord.IM2 = fscanf( ifp, '%f', 1 ); |
274 | | - tile_coord.JM2 = fscanf( ifp, '%f', 1 ); |
| 266 | + tile_coord.Grid_ocn_Name = fscanf( ifp, '%s', 1 ); |
| 267 | + tile_coord.IM_ocn = fscanf( ifp, '%f', 1 ); |
| 268 | + tile_coord.JM_ocn = fscanf( ifp, '%f', 1 ); |
275 | 269 |
|
276 | 270 | end |
277 | 271 |
|
|
318 | 312 | % |
319 | 313 | % copy data into tile_coord structure |
320 | 314 |
|
321 | | - tile_coord.N_tile = size(tmpdata,1); % number of tiles (assign here in case of subsetting above) |
| 315 | + tile_coord.N_tile = size(tmpdata,1); % number of tiles (assign here in case of subsetting above) |
322 | 316 |
|
323 | 317 | % the following are universal (for EASE and non-EASE, all tile types) |
324 | 318 |
|
325 | | - tile_coord.tile_id = tmp_tileid; % tile ID |
| 319 | + tile_coord.tile_id = tmp_tileid; % tile ID |
326 | 320 |
|
327 | | - tile_coord.typ = tmpdata(:, 1); % tile type |
| 321 | + tile_coord.typ = tmpdata(:, 1); % tile type |
328 | 322 |
|
329 | | - tile_coord.com_lon = tmpdata(:, 3); % center-of-mass longitude of tile |
330 | | - tile_coord.com_lat = tmpdata(:, 4); % center-of-mass latitude of tile |
| 323 | + tile_coord.com_lon = tmpdata(:, 3); % center-of-mass longitude of tile |
| 324 | + tile_coord.com_lat = tmpdata(:, 4); % center-of-mass latitude of tile |
331 | 325 |
|
332 | | - tile_coord.i_indg = tmpdata(:, 5); % i index of tile on global "atm" (or EASE) grid |
333 | | - tile_coord.j_indg = tmpdata(:, 6); % j index of tile on global "atm" (or EASE) grid |
334 | | - tile_coord.frac_cell = tmpdata(:, 7); % area fraction of "atm" (or EASE) grid cell |
| 326 | + tile_coord.i_indg = tmpdata(:, 5); % i index of tile on global "atm" (or EASE) grid |
| 327 | + tile_coord.j_indg = tmpdata(:, 6); % j index of tile on global "atm" (or EASE) grid |
| 328 | + tile_coord.frac_cell = tmpdata(:, 7); % area fraction of "atm" (or EASE) grid cell |
335 | 329 |
|
336 | 330 | % initialize remaining fields (to be filled below) |
337 | 331 |
|
338 | 332 | tmpNaN = NaN*ones(tile_coord.N_tile,1); |
339 | 333 |
|
340 | | - tile_coord.min_lon = tmpNaN; % min longitude of tile |
341 | | - tile_coord.max_lon = tmpNaN; % max longitude of tile |
342 | | - tile_coord.min_lat = tmpNaN; % min latitude of tile |
343 | | - tile_coord.max_lat = tmpNaN; % max latitude of tile |
| 334 | + tile_coord.min_lon = tmpNaN; % min longitude of tile |
| 335 | + tile_coord.max_lon = tmpNaN; % max longitude of tile |
| 336 | + tile_coord.min_lat = tmpNaN; % min latitude of tile |
| 337 | + tile_coord.max_lat = tmpNaN; % max latitude of tile |
344 | 338 |
|
345 | | - tile_coord.elev = tmpNaN; % elevation of tile |
| 339 | + tile_coord.elev = tmpNaN; % elevation of tile |
346 | 340 |
|
347 | | - tile_coord.area = tmpNaN; % area of "atm" grid cell |
348 | | - tile_coord.pfaf_index = tmpNaN; % index of (hydrological) Pfafstetter catchment |
349 | | - tile_coord.frac_pfaf = tmpNaN; % area fraction of Pfafstetter catchment |
| 341 | + tile_coord.area = tmpNaN; % area of "atm" grid cell |
| 342 | + tile_coord.pfaf_index = tmpNaN; % index of (hydrological) Pfafstetter catchment |
| 343 | + tile_coord.frac_pfaf = tmpNaN; % area fraction of Pfafstetter catchment |
350 | 344 |
|
351 | 345 | if ~isEASE |
352 | 346 |
|
353 | | - tile_coord.i_indg2 = tmpNaN; % i index of tile on global "ocean" grid (grid 2) |
354 | | - tile_coord.j_indg2 = tmpNaN; % j index of tile on global "ocean" grid (grid 2) |
355 | | - tile_coord.frac_cell2 = tmpNaN; % area fraction of "ocean" grid cell (grid 2) |
| 347 | + tile_coord.i_indg_ocn = tmpNaN; % i index of tile on global "ocean" grid (grid 2) |
| 348 | + tile_coord.j_indg_ocn = tmpNaN; % j index of tile on global "ocean" grid (grid 2) |
| 349 | + tile_coord.frac_cell_ocn = tmpNaN; % area fraction of "ocean" grid cell (grid 2) |
356 | 350 |
|
357 | 351 | end |
358 | 352 |
|
|
409 | 403 |
|
410 | 404 | tile_coord.frac_pfaf( ind_NOTocean) = tmpdata(ind_NOTocean, col_fracpfaf); |
411 | 405 |
|
412 | | - tile_coord.i_indg2( ind_ocean) = tmpdata(ind_ocean, 9); |
413 | | - tile_coord.j_indg2( ind_ocean) = tmpdata(ind_ocean, 10); |
414 | | - tile_coord.frac_cell2(ind_ocean) = tmpdata(ind_ocean, 11); |
| 406 | + tile_coord.i_indg_ocn( ind_ocean) = tmpdata(ind_ocean, 9); |
| 407 | + tile_coord.j_indg_ocn( ind_ocean) = tmpdata(ind_ocean, 10); |
| 408 | + tile_coord.frac_cell_ocn(ind_ocean) = tmpdata(ind_ocean, 11); |
415 | 409 |
|
416 | 410 | end |
417 | 411 |
|
|
0 commit comments