NCEPLIBS-bufr  12.1.0
cpmstabs.c
Go to the documentation of this file.
1 
6 #include "bufrlib.h"
7 #include "mstabs.h"
8 
36 void
37 cpmstabs(int nmtb, int *ibfxyn, char (*cbscl)[4], char (*cbsref)[12], char (*cbbw)[4],
38  char (*cbunit)[24], char (*cbmnem)[8], char (*cbelem)[120], int nmtd,
39  int *idfxyn, char (*cdseq)[120], char (*cdmnem)[8], int *ndelem,
40  int *idefxy, int maxcd)
41 {
42 
43  int ii, jj, idx;
44 
45  nmtb_c = nmtb;
46  for ( ii = 0; ii < nmtb; ii++ ) {
47  ibfxyn_c[ii] = ibfxyn[ii];
48  for ( jj = 0; jj < 4; jj++ ) {
49  cbscl_c[ii][jj] = cbscl[ii][jj];
50  cbbw_c[ii][jj] = cbbw[ii][jj];
51  }
52  for ( jj = 0; jj < 8; jj++ ) {
53  cbmnem_c[ii][jj] = cbmnem[ii][jj];
54  }
55  for ( jj = 0; jj < 12; jj++ ) {
56  cbsref_c[ii][jj] = cbsref[ii][jj];
57  }
58  for ( jj = 0; jj < 24; jj++ ) {
59  cbunit_c[ii][jj] = cbunit[ii][jj];
60  }
61  for ( jj = 0; jj < 120; jj++ ) {
62  cbelem_c[ii][jj] = cbelem[ii][jj];
63  }
64  }
65 
66  nmtd_c = nmtd;
67  for ( ii = 0; ii < nmtd; ii++ ) {
68  idfxyn_c[ii] = idfxyn[ii];
69  ndelem_c[ii] = ndelem[ii];
70  for ( jj = 0; jj < ndelem[ii]; jj++ ) {
71  idx = icvidx( ii, jj, maxcd );
72  idefxy_c[idx] = idefxy[idx];
73  }
74  for ( jj = 0; jj < 8; jj++ ) {
75  cdmnem_c[ii][jj] = cdmnem[ii][jj];
76  }
77  for ( jj = 0; jj < 120; jj++ ) {
78  cdseq_c[ii][jj] = cdseq[ii][jj];
79  }
80  }
81 
82 }
Enable a number of NCEPLIBS-bufr subprograms to be called from within the C part of the library.
int icvidx(int ii, int jj, int numjj)
Computes a unique 1-dimensional array index from 2-dimensional indices.
Definition: icvidx.c:22
void cpmstabs(int nmtb, int *ibfxyn, char(*cbscl)[4], char(*cbsref)[12], char(*cbbw)[4], char(*cbunit)[24], char(*cbmnem)[8], char(*cbelem)[120], int nmtd, int *idfxyn, char(*cdseq)[120], char(*cdmnem)[8], int *ndelem, int *idefxy, int maxcd)
Copy relevant information from the Fortran module moda_mstabs arrays to new arrays within C,...
Definition: cpmstabs.c:37
Declare variables for internal storage of master Table B and Table D entries.
int * idefxy_c
WMO bit-wise representations of child descriptors for master Table D sequences; copied from Fortran i...
char(* cbsref_c)[12]
Master Table B reference values; copied from Fortran cbsref array.
char(* cbelem_c)[120]
Master Table B element names; copied from Fortran cbelem array.
int * idfxyn_c
WMO bit-wise representations of master Table D FXY numbers; copied from Fortran idfxyn array.
char(* cdmnem_c)[8]
Master Table D mnemonics; copied from Fortran cdmnem array.
char(* cdseq_c)[120]
Master Table D sequence names; copied from Fortran cdseq array.
char(* cbscl_c)[4]
Master Table B scale factors; copied from Fortran cbscl array.
char(* cbunit_c)[24]
Master Table B units; copied from Fortran cbunit array.
char(* cbmnem_c)[8]
Master Table B mnemonics; copied from Fortran cbmnem array.
char(* cbbw_c)[4]
Master Table B bit widths; copied from Fortran cbbw array.
int nmtd_c
Number of master Table D entries; copied from Fortran nmtd variable.
int * ibfxyn_c
WMO bit-wise representations of master Table B FXY numbers; copied from Fortran ibfxyn array.
int nmtb_c
Number of master Table B entries; copied from Fortran nmtb variable.
int * ndelem_c
Number of child descriptors for master Table D sequences; copied from Fortran ndelem array.
integer, dimension(:), allocatable idfxyn
WMO bit-wise representations of FXY numbers for master Table D.
character, dimension(:,:), allocatable cbunit
Units corresponding to ibfxyn.
integer nmtb
Number of master Table B entries (up to a maximum of mxmtbb).
character, dimension(:,:), allocatable cbbw
Bit widths corresponding to ibfxyn.
character, dimension(:,:), allocatable cdseq
Sequence names corresponding to idfxyn.
character, dimension(:,:), allocatable cbmnem
Mnemonics corresponding to ibfxyn.
integer, dimension(:), allocatable ndelem
Numbers of child descriptors corresponding to idfxyn.
character, dimension(:,:), allocatable cbelem
Element names corresponding to ibfxyn.
character, dimension(:,:), allocatable cbscl
Scale factors corresponding to ibfxyn.
character, dimension(:,:), allocatable cdmnem
Mnemonics corresponding to idfxyn.
character, dimension(:,:), allocatable cbsref
Reference values corresponding to ibfxyn.
integer nmtd
Number of master Table D entries (up to a maximum of mxmtbd).
integer, dimension(:), allocatable idefxy
WMO bit-wise representations of child descriptors corresponding to idfxyn.
integer, dimension(:), allocatable ibfxyn
WMO bit-wise representations of FXY numbers for master Table B.