Skip to content

Commit f2635ee

Browse files
rename tile_coord%pfaf to tile_coord%pfaf_index; add matlab reader for tile file (ASCII and nc4) (#78)
2 parents f48d06e + 53f6825 commit f2635ee

File tree

7 files changed

+571
-78
lines changed

7 files changed

+571
-78
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- Updated subroutine read_obs_sm_ASCAT_EUMET() to work with both original and revised file name templates.
2121
- Updated subroutines read_obs_sm_ASCAT_EUMET(), read_obs_SMAP_halforbit_Tb(), read_obs_SMOS() and read_obs_MODIS_SCF() with hardcoded time ranges for when observations are available and should be read.
2222
- Revised variable names (SHORT_NAME) and descriptions (LONG_NAME) to match M21C file specs.
23+
- Renamed tilecoord%pfaf to %pfaf_index; added matlab tile file reader.
2324

2425
### Fixed
2526

GEOSldas_App/preprocess_ldas_routines.F90

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ subroutine domain_setup( &
409409

410410
! locals
411411

412-
integer :: n, this_tileid, this_catpfaf, N_exclude, N_include, indomain, rc
412+
integer :: n, this_tileid, N_exclude, N_include, indomain, rc
413413

414414
integer, dimension(N_cat_global) :: ExcludeList, IncludeList, tmp_d2g
415415

@@ -2964,7 +2964,7 @@ subroutine LDAS_read_til_file( tile_file, catch_file, tile_grid_g, tile_coord_la
29642964

29652965
read (tmpline,*) &
29662966
tile_coord(i)%typ, & ! 1
2967-
tile_coord(i)%pfaf, & ! 2
2967+
tile_coord(i)%pfaf_index, & ! 2
29682968
tile_coord(i)%com_lon, & ! 3
29692969
tile_coord(i)%com_lat, & ! 4
29702970
tile_coord(i)%i_indg, & ! 5
@@ -2985,7 +2985,7 @@ subroutine LDAS_read_til_file( tile_file, catch_file, tile_grid_g, tile_coord_la
29852985

29862986
read (tmpline,*) &
29872987
tile_coord(i)%typ, & ! 1
2988-
tile_coord(i)%pfaf, & ! 2 *
2988+
tile_coord(i)%pfaf_index, & ! 2 *
29892989
tile_coord(i)%com_lon, & ! 3
29902990
tile_coord(i)%com_lat, & ! 4
29912991
tile_coord(i)%i_indg, & ! 5
@@ -3009,7 +3009,7 @@ subroutine LDAS_read_til_file( tile_file, catch_file, tile_grid_g, tile_coord_la
30093009
tile_coord(i)%j_indg, & ! 6
30103010
tile_coord(i)%frac_cell, & ! 7
30113011
tmpint1, & ! 8
3012-
tile_coord(i)%pfaf, & ! 9 *
3012+
tile_coord(i)%pfaf_index, & ! 9 *
30133013
tmpint2, & ! 10
30143014
tile_coord(i)%frac_pfaf, & ! 11
30153015
tmpint3 ! 12 * (previously "tile_id")
@@ -3250,7 +3250,7 @@ subroutine read_catchment_def( catchment_def_file, N_tile, tile_coord )
32503250
!
32513251
! Header line: N_tile
32523252
!
3253-
! Columns: tile_id, Pfaf, min_lon, max_lon, min_lat, max_lat, [elev]
3253+
! Columns: tile_id, pfaf_index, min_lon, max_lon, min_lat, max_lat, [elev]
32543254
!
32553255
! Elevation [m] is ONLY available for EASE grid tile definitions
32563256

@@ -3266,7 +3266,7 @@ subroutine read_catchment_def( catchment_def_file, N_tile, tile_coord )
32663266

32673267
integer :: i, istat, tmpint1, sweep
32683268

3269-
integer, dimension(N_tile) :: tmp_tileid, tmp_pfaf
3269+
integer, dimension(N_tile) :: tmp_tileid, tmp_pfafindex
32703270

32713271
character(len=*), parameter :: Iam = 'read_catchment_def'
32723272
character(len=400) :: err_msg
@@ -3305,7 +3305,7 @@ subroutine read_catchment_def( catchment_def_file, N_tile, tile_coord )
33053305

33063306
! read 7 columns, avoid using exact format specification
33073307

3308-
read (10,*, iostat=istat) tmp_tileid(i), tmp_pfaf(i), &
3308+
read (10,*, iostat=istat) tmp_tileid(i), tmp_pfafindex(i), &
33093309
tile_coord(i)%min_lon, &
33103310
tile_coord(i)%max_lon, &
33113311
tile_coord(i)%min_lat, &
@@ -3316,7 +3316,7 @@ subroutine read_catchment_def( catchment_def_file, N_tile, tile_coord )
33163316

33173317
! read 6 columns, avoid using exact format specification
33183318

3319-
read (10,*, iostat=istat) tmp_tileid(i), tmp_pfaf(i), &
3319+
read (10,*, iostat=istat) tmp_tileid(i), tmp_pfafindex(i), &
33203320
tile_coord(i)%min_lon, &
33213321
tile_coord(i)%max_lon, &
33223322
tile_coord(i)%min_lat, &
@@ -3358,8 +3358,8 @@ subroutine read_catchment_def( catchment_def_file, N_tile, tile_coord )
33583358

33593359
end do ! loop through sweeps
33603360

3361-
if ( any(tile_coord(1:N_tile)%tile_id/=tmp_tileid) .or. &
3362-
any(tile_coord(1:N_tile)%pfaf /=tmp_pfaf) ) then
3361+
if ( any(tile_coord(1:N_tile)%tile_id /=tmp_tileid) .or. &
3362+
any(tile_coord(1:N_tile)%pfaf_index/=tmp_pfafindex) ) then
33633363

33643364
err_msg = 'tile_coord_file and catchment_def_file mismatch. (2)'
33653365
call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
function [tile_coord ] = read_catchmentdef( fname )
2+
3+
% read (land) tile properties from "catchment.def" file (EASEv2 and cube-sphere)
4+
%
5+
% reichle, 24 Jan 2025
6+
%
7+
% -------------------------------------------------------------
8+
9+
% read file
10+
11+
disp(['reading from ', fname])
12+
13+
ifp = fopen( fname, 'r' );
14+
15+
% read header line
16+
17+
tmpdata = fscanf( ifp, '%f', 1 );
18+
19+
tile_coord.N_tile = tmpdata(1);
20+
21+
% read rest of data
22+
23+
tmpdata = fscanf( ifp, '%f' );
24+
25+
fclose(ifp);
26+
27+
disp('done reading "catchment.def" file')
28+
29+
% --------------------------------------------------
30+
31+
% process data
32+
33+
tmpdata = reshape(tmpdata, [7, tile_coord.N_tile])';
34+
35+
tile_coord.tile_id = tmpdata(:,1);
36+
tile_coord.pfaf_index = tmpdata(:,2);
37+
38+
tile_coord.min_lon = tmpdata(:,3);
39+
tile_coord.max_lon = tmpdata(:,4);
40+
tile_coord.min_lat = tmpdata(:,5);
41+
tile_coord.max_lat = tmpdata(:,6);
42+
43+
tile_coord.elev = tmpdata(:,7);
44+
45+
% ========== EOF ===================================================
46+

0 commit comments

Comments
 (0)