FV3 Bundle
read_mosaic.h
Go to the documentation of this file.
1 /***********************************************************************
2  * GNU Lesser General Public License
3  *
4  * This file is part of the GFDL Flexible Modeling System (FMS).
5  *
6  * FMS is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or (at
9  * your option) any later version.
10  *
11  * FMS is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FMS. If not, see <http://www.gnu.org/licenses/>.
18  **********************************************************************/
19 #ifndef READ_MOSAIC_H_
20 #define READ_MOSAIC_H_
21 
22 /* netcdf helpers */
23 /* perhaps should consider making static, or breaking out into seperate file,
24  some of these names (field_exist) could pollute namespace... */
25 
26 void handle_netcdf_error(const char *msg, int status );
27 
28 void get_file_dir(const char *file, char *dir);
29 
30 int field_exist(const char* file, const char *name);
31 
32 int get_dimlen(const char* file, const char *name);
33 
34 void get_string_data_level(const char *file, const char *name, char *data, const unsigned int* level);
35 
36 void get_var_data(const char *file, const char *name, void *data);
37 
38 void get_var_data_region(const char *file, const char *name, const size_t *start, const size_t *nread, void *data);
39 
40 void get_string_data(const char *file, const char *name, char *data);
41 
42 void get_var_text_att(const char *file, const char *name, const char *attname, char *att);
43 /* end netcdf helpers */
44 
45 int read_mosaic_xgrid_size( const char *xgrid_file );
46 
47 #ifdef OVERLOAD_R4
48 
49 void read_mosaic_xgrid_order1(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, float *area );
50 
51 void read_mosaic_xgrid_order1_region(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, float *area, int *isc, int *iec );
52 
53 void read_mosaic_xgrid_order2(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2,
54  float *area, float *di, float *dj );
55 
56 float get_global_area(void);
57 
58 #else
59 
60 void read_mosaic_xgrid_order1(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area );
61 
62 void read_mosaic_xgrid_order1_region(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, int *isc, int *iec );
63 
64 void read_mosaic_xgrid_order2(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2,
65  double *area, double *di, double *dj );
66 
67 double get_global_area(void);
68 
69 #endif
70 
71 int read_mosaic_ntiles(const char *mosaic_file);
72 
73 int read_mosaic_ncontacts(const char *mosaic_file);
74 
75 void read_mosaic_grid_sizes(const char *mosaic_file, int *nx, int *ny);
76 
77 void read_mosaic_contact(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1,
78  int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2);
79 
80 int transfer_to_model_index(int istart_in, int iend_in, int *istart_out, int *iend_out, int refine_ratio);
81 
82 void read_mosaic_grid_data(const char *mosaic_file, const char *name, int nx, int ny,
83  double *data, unsigned int level, int ioff, int joff);
84 
85 
86 #ifndef __AIX
87 
88 void read_mosaic_contact_(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1,
89  int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2);
90 
91 int read_mosaic_xgrid_size_( const char *xgrid_file );
92 
93 int read_mosaic_ntiles_(const char *mosaic_file);
94 
95 int read_mosaic_ncontacts_(const char *mosaic_file);
96 
97 void read_mosaic_grid_sizes_(const char *mosaic_file, int *nx, int *ny);
98 
99 #ifdef OVERLOAD_R4
100 
101 float get_global_area_(void);
102 
103 void read_mosaic_xgrid_order1_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, float *area );
104 
105 void read_mosaic_xgrid_order1_region_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, float *area, int *isc, int *iec );
106 
107 void read_mosaic_xgrid_order2_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, float *area, float *di, float *dj );
108 
109 #else
110 
111 double get_global_area_(void);
112 
113 void read_mosaic_xgrid_order1_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area );
114 
115 void read_mosaic_xgrid_order1_region_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, int *isc, int *iec );
116 
117 void read_mosaic_xgrid_order2_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, double *di, double *dj );
118 
119 #endif /* OVERLOAD_R4 */
120 
121 #endif /* AIX */
122 
123 
124 #endif
void get_file_dir(const char *file, char *dir)
Definition: read_mosaic.c:48
int read_mosaic_ntiles(const char *mosaic_file)
Definition: read_mosaic.c:609
void read_mosaic_xgrid_order1_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area)
Definition: read_mosaic.c:435
void get_var_text_att(const char *file, const char *name, const char *attname, char *att)
Definition: read_mosaic.c:349
void handle_netcdf_error(const char *msg, int status)
Definition: read_mosaic.c:34
void read_mosaic_grid_data(const char *mosaic_file, const char *name, int nx, int ny, double *data, unsigned int level, int ioff, int joff)
Definition: read_mosaic.c:827
integer, save, private iec
Definition: oda_core.F90:124
int get_dimlen(const char *file, const char *name)
Definition: read_mosaic.c:102
void read_mosaic_xgrid_order1(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area)
Definition: read_mosaic.c:446
integer, parameter nx
void read_mosaic_contact(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1, int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2)
Definition: read_mosaic.c:728
void get_string_data_level(const char *file, const char *name, char *data, const unsigned int *level)
Definition: read_mosaic.c:186
integer, parameter ny
character(len=32) name
void read_mosaic_xgrid_order1_region(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, int *isc, int *iec)
Definition: read_mosaic.c:497
void get_string_data(const char *file, const char *name, char *data)
Definition: read_mosaic.c:150
void read_mosaic_xgrid_order2(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, double *di, double *dj)
Definition: read_mosaic.c:559
void read_mosaic_xgrid_order1_region_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, int *isc, int *iec)
Definition: read_mosaic.c:486
void get_var_data(const char *file, const char *name, void *data)
Definition: read_mosaic.c:228
int read_mosaic_ncontacts(const char *mosaic_file)
Definition: read_mosaic.c:630
real, dimension(:,:), allocatable area
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine READ_RECORD_CORE_(unit, field, nwords, data, start, axsiz) integer, intent(in) ::unit type(fieldtype), intent(in) ::field integer, intent(in) ::nwords MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in) ::start(:), axsiz(:) integer(SHORT_KIND) ::i2vals(nwords)!rab used in conjunction with transfer intrinsic to determine size of a variable integer(KIND=1) ::one_byte(8) integer ::word_sz!#ifdef __sgi integer(INT_KIND) ::ivals(nwords) real(FLOAT_KIND) ::rvals(nwords)!#else! integer ::ivals(nwords)! real ::rvals(nwords)!#endif real(DOUBLE_KIND) ::r8vals(nwords) pointer(ptr1, i2vals) pointer(ptr2, ivals) pointer(ptr3, rvals) pointer(ptr4, r8vals) if(mpp_io_stack_size< nwords) call mpp_io_set_stack_size(nwords) call mpp_error(FATAL, 'MPP_READ currently requires use_netCDF option') end subroutine READ_RECORD_CORE_ subroutine READ_RECORD_(unit, field, nwords, data, time_level, domain, position, tile_count, start_in, axsiz_in)!routine that is finally called by all mpp_read routines to perform the read!a non-netCDF record contains:! field ID! a set of 4 coordinates(is:ie, js:je) giving the data subdomain! a timelevel and a timestamp(=NULLTIME if field is static)! 3D real data(stored as 1D)!if you are using direct access I/O, the RECL argument to OPEN must be large enough for the above!in a global direct access file, record position on PE is given by %record.!Treatment of timestamp:! We assume that static fields have been passed without a timestamp.! Here that is converted into a timestamp of NULLTIME.! For non-netCDF fields, field is treated no differently, but is written! with a timestamp of NULLTIME. There is no check in the code to prevent! the user from repeatedly writing a static field. integer, intent(in) ::unit, nwords type(fieldtype), intent(in) ::field MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in), optional ::time_level type(domain2D), intent(in), optional ::domain integer, intent(in), optional ::position, tile_count integer, intent(in), optional ::start_in(:), axsiz_in(:) integer, dimension(size(field%axes(:))) ::start, axsiz integer ::tlevel !, subdomain(4) integer ::i, error, is, ie, js, je, isg, ieg, jsg, jeg type(domain2d), pointer ::io_domain=> tlevel if(PRESENT(start_in) .AND. PRESENT(axsiz_in)) then if(size(start(! the data domain and compute domain must refer to the subdomain being passed ! In this ! since that attempts to gather all data on PE start
int read_mosaic_xgrid_size_(const char *xgrid_file)
Definition: read_mosaic.c:385
int read_mosaic_xgrid_size(const char *xgrid_file)
Definition: read_mosaic.c:391
void get_var_data_region(const char *file, const char *name, const size_t *start, const size_t *nread, void *data)
Definition: read_mosaic.c:288
double get_global_area_(void)
Definition: read_mosaic.c:419
int read_mosaic_ncontacts_(const char *mosaic_file)
Definition: read_mosaic.c:625
void read_mosaic_contact_(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1, int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2)
Definition: read_mosaic.c:684
void read_mosaic_grid_sizes(const char *mosaic_file, int *nx, int *ny)
Definition: read_mosaic.c:656
int read_mosaic_ntiles_(const char *mosaic_file)
Definition: read_mosaic.c:604
integer, save, private isc
Definition: oda_core.F90:124
void read_mosaic_xgrid_order2_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, double *di, double *dj)
Definition: read_mosaic.c:549
int transfer_to_model_index(int istart_in, int iend_in, int *istart_out, int *iend_out, int refine_ratio)
Definition: read_mosaic.c:696
double get_global_area(void)
Definition: read_mosaic.c:404
void read_mosaic_grid_sizes_(const char *mosaic_file, int *nx, int *ny)
Definition: read_mosaic.c:651
int field_exist(const char *file, const char *name)
Definition: read_mosaic.c:69