From 5fa380c2cc1765c603249bf3af9eec4fb7e71e3e Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Wed, 20 Sep 2023 20:20:53 -0700 Subject: [PATCH 1/2] Rename ip2lib_?.h --- src/CMakeLists.txt | 13 +-- src/ip2lib_4.h | 192 ------------------------------------ src/ip2lib_8.h | 193 ------------------------------------- src/ip2lib_d.h | 191 ------------------------------------ src/iplib_4.h | 203 ++++++++++++++++++++++++++++++++++----- src/iplib_8.h | 203 ++++++++++++++++++++++++++++++++++----- src/iplib_d.h | 202 +++++++++++++++++++++++++++++++++----- tests/tst_gdswzd_grib1.c | 3 - tests/tst_gdswzd_grib2.c | 2 +- 9 files changed, 545 insertions(+), 657 deletions(-) delete mode 100644 src/ip2lib_4.h delete mode 100644 src/ip2lib_8.h delete mode 100644 src/ip2lib_d.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8736cee0..bf272349 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,12 +3,11 @@ # Mark Potts, Kyle Gerheiser, Ed Hartnett, Eric Engle # These are the source code filees. -set(fortran_src gdswzd_c.F90 gdswzd_mod.F90 ip2lib_4.h -ip2lib_d.h ipolates.F90 ipolatev.F90 ipxetas.F90 ipxwafs.F90 -ipxwafs2.F90 ipxwafs3.F90 movect.F90 bilinear_interp_mod.F90 -bicubic_interp_mod.F90 neighbor_interp_mod.F90 budget_interp_mod.F90 -spectral_interp_mod.F90 neighbor_budget_interp_mod.F90 ip_mod.F90 -ip_grid_descriptor_mod.F90 ip_grid_mod.F90 +set(fortran_src gdswzd_c.F90 gdswzd_mod.F90 ipolates.F90 ipolatev.F90 +ipxetas.F90 ipxwafs.F90 ipxwafs2.F90 ipxwafs3.F90 movect.F90 +bilinear_interp_mod.F90 bicubic_interp_mod.F90 neighbor_interp_mod.F90 +budget_interp_mod.F90 spectral_interp_mod.F90 neighbor_budget_interp_mod.F90 +ip_mod.F90 ip_grid_descriptor_mod.F90 ip_grid_mod.F90 ip_station_points_grid_mod.F90 ip_gaussian_grid_mod.F90 ip_equid_cylind_grid_mod.F90 ip_lambert_conf_grid_mod.F90 ip_mercator_grid_mod.F90 ip_polar_stereo_grid_mod.F90 @@ -22,7 +21,6 @@ foreach(kind ${kinds}) set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include_${kind}") # Create the C header files for this kind. - configure_file(ip2lib_${kind}.h ${CMAKE_CURRENT_BINARY_DIR}/include_${kind}/ip2lib.h COPYONLY) configure_file(iplib_${kind}.h ${CMAKE_CURRENT_BINARY_DIR}/include_${kind}/iplib.h COPYONLY) # Compiled with preprocessor definition LSIZE=D, not d @@ -57,7 +55,6 @@ foreach(kind ${kinds}) list(APPEND LIB_TARGETS ${lib_name}) install(DIRECTORY ${module_dir} DESTINATION ${CMAKE_INSTALL_PREFIX}) - install(FILES ip2lib_${kind}.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include_${kind} RENAME ip2lib.h) install(FILES iplib_${kind}.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include_${kind} RENAME iplib.h) endforeach() diff --git a/src/ip2lib_4.h b/src/ip2lib_4.h deleted file mode 100644 index 1c8e80f6..00000000 --- a/src/ip2lib_4.h +++ /dev/null @@ -1,192 +0,0 @@ -/** @file - * @brief C interface to gdswzd() and gdswzd_grib1() functions for '4' - * library build. - * @author Jovic @date 2016 - */ - -#ifndef IPLIB -#define IPLIB - -/** - * gdswzd() interface for C for _4 build of library. - * - * @param igdtnum grid definition template number. Corresponds - * to the gfld%igdtnum component of the ncep g2 library gridmod data - * structure. - * - 00 equidistant cylindrical - * - 01 rotated equidistant cylindrical. "e" and non-"e" staggered - * - 10 mercator cyclindrical - * - 20 polar stereographic azimuthal - * - 30 lambert conformal conical - * - 40 gaussian equidistant cyclindrical - * @param igdtmpl (igdtlen) grid definition template array. - * corresponds to the gfld%igdtmpl component of the ncep g2 library - * gridmod data structure for section three. - * all projections: - * - 1 shape of earth, octet 15 - * - 2 scale factor of spherical earth radius, octet 16 - * - 3 scaled value of radius of spherical earth, octets 17-20 - * - 4 scale factor of major axis of elliptical earth, octet 21 - * - 5 scaled value of major axis of elliptical earth, octets 22-25 - * - 6 scale factor of minor axis of elliptical earth, octet 26 - * - 7 scaled value of minor axis of elliptical earth, octets 27-30 - * equidistant cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42. - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 j-direction increment, octets 68-71 - * - 19 scanning mode, octet 72 - * mercator cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 latitude of first point, octets 39-42 - * - 11 longitude of first point, octets 43-46 - * - 12 resolution and component flags, octet 47 - * - 13 tangent latitude, octets 48-51 - * - 14 latitude of last point, octets 52-55 - * - 15 longitude of last point, octets 56-59 - * - 16 scanning mode flags, octet 60 - * - 17 orientation of grid, octets 61-64 - * - 18 longitudinal grid length, octets 65-68 - * - 19 latitudinal grid length, octets 69-72 - * Lambert conformal conical: - * - 8 number of points along x-axis, octs 31-34 - * - 9 number of points along y-axis, octs 35-38 - * - 10 latitude of first point, octets 39-42 - * - 11 longitude of first point, octets 43-46 - * - 12 resolution of component flag, octet 47 - * - 13 latitude where grid lengths specified, octets 48-51 - * - 14 longitude of meridian that is parallel to y-axis, octets 52-55 - * - 15 x-direction grid length, octets 56-59 - * - 16 y-direction grid length, octets 60-63 - * - 17 projection center flag, octet 64 - * - 18 scanning mode, octet 65 - * - 19 first tangent latitude from pole, octets 66-69 - * - 20 second tangent latitude from pole, octets 70-73 - * - 21 latitude of south pole of projection, octets 74-77 - * - 22 longitude of south pole of projection, octets 78-81 - * gaussian cylindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42 - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 number of parallels between pole and equator, octets 68-71 - * - 19 scanning mode, octet 72 - * polar stereographic azimuthal: - * - 8 number of points along x-axis, octets 31-34 - * - 9 number of points along y-axis, octets 35-38 - * - 10 latitude of first grid point, octets 39-42 - * - 11 longitude of first grid point, octets 43-46 - * - 12 resolution and component flags, octet 47 - * - 13 true latitude, octets 48-51 - * - 14 orientation longitude, octets 52-55 - * - 15 x-direction grid length, octets 56-59 - * - 16 y-direction grid length, octets 60-63 - * - 17 projection center flag, octet 64 - * - 18 scanning mode flags, octet 65 - * rotated equidistant cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42 - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 j-direction increment, octets 68-71 - * - 19 scanning mode, octet 72 - * - 20 latitude of southern pole of projection, octets 73-76 - * - 21 longitude of southern pole of projection, octets 77-80 - * - 22 angle of rotation of projection, octs 81-84 - * @param igdtlen number of elements of the grid definition - * template array. Corresponds to the gfld%igdtlen component of the - * ncep g2 library gridmod data structure. - * @param iopt option flag - * - 0 to compute earth coords of all the grid points - * - 1 to compute earth coords of selected grid coords - * - -1 to compute grid coords of selected earth coords - * @param npts integer maximum number of coordinates - * @param fill real fill value to set invalid output data (must - * be impossible value; suggested value: -9999.) - * @param xpts real (npts) grid x point coordinates if iopt>0 - * @param ypts real (npts) grid y point coordinates if iopt>0 - * @param rlon real (npts) earth longitudes in degrees e if - * iopt<0 (acceptable range: -360. to 360.) - * @param rlat real (npts) earth latitudes in degrees n if - * iopt<0 (acceptable range: -90. to 90.) - * @param nret number of valid points computed (-1 if - * projection unrecognized) - * @param crot (npts) clockwise vector rotation cosines - * @param srot (npts) clockwise vector rotation sines - * (ugrid=crot*uearth-srot*vearth, vgrid=srot*uearth+crot*vearth) - * @param xlon (npts) dx/dlon in 1/degrees - * @param xlat (npts) dx/dlat in 1/degrees - * @param ylon (npts) dy/dlon in 1/degrees - * @param ylat (npts) dy/dlat in 1/degrees - * @param area (npts) area weights in m**2 (Proportional to the - * square of the map factor in the case of conformal projections.) - * - * @author Jovic @date 2016 - */ -void gdswzd(int igdtnum, int *igdtmpl, int igdtlen, int iopt, - int npts, float fill, float *xpts, float *ypts, - float *rlon, float *rlat, int *nret, - float *crot, float *srot, float *xlon, float *xlat, - float *ylon, float *ylat, float *area); - -/** - * gdswzd_grib1() interface for C for the _4 build of the library. - * - * This is a C prototype to call the Fortran module subroutine - * gdswzd_c_grib1() for the _4 version of the library. - * - * @param kgds (200) gds parameters as decoded by - * [w3fi63](https://noaa-emc.github.io/NCEPLIBS-w3emc/w3fi63_8f.html). - * @param iopt option flag - * - 0 to compute earth coords of all the grid points - * - 1 to compute earth coords of selected grid coords - * - -1 to compute grid coords of selected earth coords - * @param npts maximum number of coordinates - * @param fill fill value to set invalid output data (must be - * impossible value; suggested value: -9999.) - * @param xpts (npts) grid x point coordinates if iopt>0 - * @param ypts (npts) grid y point coordinates if iopt>0 - * @param rlon (npts) earth longitudes in degrees e if iopt<0 - * (acceptable range: -360. to 360.) - * @param rlat (npts) earth latitudes in degrees n if iopt<0 - * (acceptable range: -90. to 90.) - * @param nret number of valid points computed (-1 if - * projection unrecognized) - * @param crot (npts) clockwise vector rotation cosines - * @param srot (npts) clockwise vector rotation sines - * (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth) - * @param xlon (npts) dx/dlon in 1/degrees - * @param xlat (npts) dx/dlat in 1/degrees - * @param ylon (npts) dy/dlon in 1/degrees - * @param ylat (npts) dy/dlat in 1/degrees - * @param area (npts) area weights in m**2 (proportional to the - * square of the map factor in the case of conformal projections.) - * - * @author Jovic @date 2016 - */ -void gdswzd_grib1(int kgds, int iopt, int npts, float *fill, float *xpts, - float *ypts, float *rlon, float *rlat, int nret, float *crot, - float *srot, float *xlon, float *xlat, float *ylon, - float *ylat, float *area); - -#endif diff --git a/src/ip2lib_8.h b/src/ip2lib_8.h deleted file mode 100644 index b28c9186..00000000 --- a/src/ip2lib_8.h +++ /dev/null @@ -1,193 +0,0 @@ -/** @file - * @brief C interface to gdswzd() and gdswzd_grib1() functions for '8' - * library build. - * @author Jovic @date 2016 - * @author NOAA Programmer - */ - -#ifndef IPLIB -#define IPLIB - -/** - * gdswzd() interface for C for _8 build of library. - * - * @param igdtnum grid definition template number. Corresponds - * to the gfld%igdtnum component of the ncep g2 library gridmod data - * structure. - * - 00 equidistant cylindrical - * - 01 rotated equidistant cylindrical. "e" and non-"e" staggered - * - 10 mercator cyclindrical - * - 20 polar stereographic azimuthal - * - 30 lambert conformal conical - * - 40 gaussian equidistant cyclindrical - * @param igdtmpl (igdtlen) grid definition template array. - * corresponds to the gfld%igdtmpl component of the ncep g2 library - * gridmod data structure for section three. - * all projections: - * - 1 shape of earth, octet 15 - * - 2 scale factor of spherical earth radius, octet 16 - * - 3 scaled value of radius of spherical earth, octets 17-20 - * - 4 scale factor of major axis of elliptical earth, octet 21 - * - 5 scaled value of major axis of elliptical earth, octets 22-25 - * - 6 scale factor of minor axis of elliptical earth, octet 26 - * - 7 scaled value of minor axis of elliptical earth, octets 27-30 - * equidistant cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42. - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 j-direction increment, octets 68-71 - * - 19 scanning mode, octet 72 - * mercator cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 latitude of first point, octets 39-42 - * - 11 longitude of first point, octets 43-46 - * - 12 resolution and component flags, octet 47 - * - 13 tangent latitude, octets 48-51 - * - 14 latitude of last point, octets 52-55 - * - 15 longitude of last point, octets 56-59 - * - 16 scanning mode flags, octet 60 - * - 17 orientation of grid, octets 61-64 - * - 18 longitudinal grid length, octets 65-68 - * - 19 latitudinal grid length, octets 69-72 - * Lambert conformal conical: - * - 8 number of points along x-axis, octs 31-34 - * - 9 number of points along y-axis, octs 35-38 - * - 10 latitude of first point, octets 39-42 - * - 11 longitude of first point, octets 43-46 - * - 12 resolution of component flag, octet 47 - * - 13 latitude where grid lengths specified, octets 48-51 - * - 14 longitude of meridian that is parallel to y-axis, octets 52-55 - * - 15 x-direction grid length, octets 56-59 - * - 16 y-direction grid length, octets 60-63 - * - 17 projection center flag, octet 64 - * - 18 scanning mode, octet 65 - * - 19 first tangent latitude from pole, octets 66-69 - * - 20 second tangent latitude from pole, octets 70-73 - * - 21 latitude of south pole of projection, octets 74-77 - * - 22 longitude of south pole of projection, octets 78-81 - * gaussian cylindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42 - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 number of parallels between pole and equator, octets 68-71 - * - 19 scanning mode, octet 72 - * polar stereographic azimuthal: - * - 8 number of points along x-axis, octets 31-34 - * - 9 number of points along y-axis, octets 35-38 - * - 10 latitude of first grid point, octets 39-42 - * - 11 longitude of first grid point, octets 43-46 - * - 12 resolution and component flags, octet 47 - * - 13 true latitude, octets 48-51 - * - 14 orientation longitude, octets 52-55 - * - 15 x-direction grid length, octets 56-59 - * - 16 y-direction grid length, octets 60-63 - * - 17 projection center flag, octet 64 - * - 18 scanning mode flags, octet 65 - * rotated equidistant cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42 - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 j-direction increment, octets 68-71 - * - 19 scanning mode, octet 72 - * - 20 latitude of southern pole of projection, octets 73-76 - * - 21 longitude of southern pole of projection, octets 77-80 - * - 22 angle of rotation of projection, octs 81-84 - * @param igdtlen number of elements of the grid definition - * template array. Corresponds to the gfld%igdtlen component of the - * ncep g2 library gridmod data structure. - * @param iopt option flag - * - 0 to compute earth coords of all the grid points - * - 1 to compute earth coords of selected grid coords - * - -1 to compute grid coords of selected earth coords - * @param npts integer maximum number of coordinates - * @param fill real fill value to set invalid output data (must - * be impossible value; suggested value: -9999.) - * @param xpts real (npts) grid x point coordinates if iopt>0 - * @param ypts real (npts) grid y point coordinates if iopt>0 - * @param rlon real (npts) earth longitudes in degrees e if - * iopt<0 (acceptable range: -360. to 360.) - * @param rlat real (npts) earth latitudes in degrees n if - * iopt<0 (acceptable range: -90. to 90.) - * @param nret number of valid points computed (-1 if - * projection unrecognized) - * @param crot (npts) clockwise vector rotation cosines - * @param srot (npts) clockwise vector rotation sines - * (ugrid=crot*uearth-srot*vearth, vgrid=srot*uearth+crot*vearth) - * @param xlon (npts) dx/dlon in 1/degrees - * @param xlat (npts) dx/dlat in 1/degrees - * @param ylon (npts) dy/dlon in 1/degrees - * @param ylat (npts) dy/dlat in 1/degrees - * @param area (npts) area weights in m**2 (Proportional to the - * square of the map factor in the case of conformal projections.) - * - * @author Jovic @date 2016 - */ -void gdswzd(long igdtnum, long *igdtmpl, long igdtlen, long iopt, - long npts, double fill, double *xpts, double *ypts, - double *rlon, double *rlat, long *nret, - double *crot, double *srot, double *xlon, double *xlat, - double *ylon, double *ylat, double *area); - -/** - * gdswzd_grib1() interface for C for _8 build of the library. - * - * This is a C prototype to call the Fortran module subroutine - * gdswzd_c_grib1() for the _4 version of the library. - * - * @param kgds (200) gds parameters as decoded by - * [w3fi63](https://noaa-emc.github.io/NCEPLIBS-w3emc/w3fi63_8f.html). - * @param iopt option flag - * - 0 to compute earth coords of all the grid points - * - 1 to compute earth coords of selected grid coords - * - -1 to compute grid coords of selected earth coords - * @param npts maximum number of coordinates - * @param fill fill value to set invalid output data (must be - * impossible value; suggested value: -9999.) - * @param xpts (npts) grid x point coordinates if iopt>0 - * @param ypts (npts) grid y point coordinates if iopt>0 - * @param rlon (npts) earth longitudes in degrees e if iopt<0 - * (acceptable range: -360. to 360.) - * @param rlat (npts) earth latitudes in degrees n if iopt<0 - * (acceptable range: -90. to 90.) - * @param nret number of valid points computed (-1 if - * projection unrecognized) - * @param crot (npts) clockwise vector rotation cosines - * @param srot (npts) clockwise vector rotation sines - * (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth) - * @param xlon (npts) dx/dlon in 1/degrees - * @param xlat (npts) dx/dlat in 1/degrees - * @param ylon (npts) dy/dlon in 1/degrees - * @param ylat (npts) dy/dlat in 1/degrees - * @param area (npts) area weights in m**2 (proportional to the - * square of the map factor in the case of conformal projections.) - * - * @author Jovic @date 2016 - */ -void gdswzd_grib1(long kgds, long iopt, long npts, - double *fill, double *xpts, - double *ypts, double *rlon, double *rlat, int nret, double *crot, - double *srot, double *xlon, double *xlat, double *ylon, - double *ylat, double *area); -#endif diff --git a/src/ip2lib_d.h b/src/ip2lib_d.h deleted file mode 100644 index 8f821c70..00000000 --- a/src/ip2lib_d.h +++ /dev/null @@ -1,191 +0,0 @@ -/** @file - * @brief C interface to gdswzd() and gdswzd_grib1() functions for 'd' - * library build. - * @author Jovic @date 2016 - */ - -#ifndef IPLIB -#define IPLIB - -/** - * gdswzd() interface for C for _d build of library. - * - * @param igdtnum grid definition template number. Corresponds - * to the gfld%igdtnum component of the ncep g2 library gridmod data - * structure. - * - 00 equidistant cylindrical - * - 01 rotated equidistant cylindrical. "e" and non-"e" staggered - * - 10 mercator cyclindrical - * - 20 polar stereographic azimuthal - * - 30 lambert conformal conical - * - 40 gaussian equidistant cyclindrical - * @param igdtmpl (igdtlen) grid definition template array. - * corresponds to the gfld%igdtmpl component of the ncep g2 library - * gridmod data structure for section three. - * all projections: - * - 1 shape of earth, octet 15 - * - 2 scale factor of spherical earth radius, octet 16 - * - 3 scaled value of radius of spherical earth, octets 17-20 - * - 4 scale factor of major axis of elliptical earth, octet 21 - * - 5 scaled value of major axis of elliptical earth, octets 22-25 - * - 6 scale factor of minor axis of elliptical earth, octet 26 - * - 7 scaled value of minor axis of elliptical earth, octets 27-30 - * equidistant cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42. - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 j-direction increment, octets 68-71 - * - 19 scanning mode, octet 72 - * mercator cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 latitude of first point, octets 39-42 - * - 11 longitude of first point, octets 43-46 - * - 12 resolution and component flags, octet 47 - * - 13 tangent latitude, octets 48-51 - * - 14 latitude of last point, octets 52-55 - * - 15 longitude of last point, octets 56-59 - * - 16 scanning mode flags, octet 60 - * - 17 orientation of grid, octets 61-64 - * - 18 longitudinal grid length, octets 65-68 - * - 19 latitudinal grid length, octets 69-72 - * Lambert conformal conical: - * - 8 number of points along x-axis, octs 31-34 - * - 9 number of points along y-axis, octs 35-38 - * - 10 latitude of first point, octets 39-42 - * - 11 longitude of first point, octets 43-46 - * - 12 resolution of component flag, octet 47 - * - 13 latitude where grid lengths specified, octets 48-51 - * - 14 longitude of meridian that is parallel to y-axis, octets 52-55 - * - 15 x-direction grid length, octets 56-59 - * - 16 y-direction grid length, octets 60-63 - * - 17 projection center flag, octet 64 - * - 18 scanning mode, octet 65 - * - 19 first tangent latitude from pole, octets 66-69 - * - 20 second tangent latitude from pole, octets 70-73 - * - 21 latitude of south pole of projection, octets 74-77 - * - 22 longitude of south pole of projection, octets 78-81 - * gaussian cylindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42 - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 number of parallels between pole and equator, octets 68-71 - * - 19 scanning mode, octet 72 - * polar stereographic azimuthal: - * - 8 number of points along x-axis, octets 31-34 - * - 9 number of points along y-axis, octets 35-38 - * - 10 latitude of first grid point, octets 39-42 - * - 11 longitude of first grid point, octets 43-46 - * - 12 resolution and component flags, octet 47 - * - 13 true latitude, octets 48-51 - * - 14 orientation longitude, octets 52-55 - * - 15 x-direction grid length, octets 56-59 - * - 16 y-direction grid length, octets 60-63 - * - 17 projection center flag, octet 64 - * - 18 scanning mode flags, octet 65 - * rotated equidistant cyclindrical: - * - 8 number of points along a parallel, octs 31-34 - * - 9 number of points along a meridian, octs 35-38 - * - 10 basic angle of initial production domain, octets 39-42 - * - 11 subdivisions of basic angle, octets 43-46 - * - 12 latitude of first grid point, octets 47-50 - * - 13 longitude of first grid point, octets 51-54 - * - 14 resolution and component flags, octet 55 - * - 15 latitude of last grid point, octets 56-59 - * - 16 longitude of last grid point, octets 60-63 - * - 17 i-direction increment, octets 64-67 - * - 18 j-direction increment, octets 68-71 - * - 19 scanning mode, octet 72 - * - 20 latitude of southern pole of projection, octets 73-76 - * - 21 longitude of southern pole of projection, octets 77-80 - * - 22 angle of rotation of projection, octs 81-84 - * @param igdtlen number of elements of the grid definition - * template array. Corresponds to the gfld%igdtlen component of the - * ncep g2 library gridmod data structure. - * @param iopt option flag - * - 0 to compute earth coords of all the grid points - * - 1 to compute earth coords of selected grid coords - * - -1 to compute grid coords of selected earth coords - * @param npts integer maximum number of coordinates - * @param fill real fill value to set invalid output data (must - * be impossible value; suggested value: -9999.) - * @param xpts real (npts) grid x point coordinates if iopt>0 - * @param ypts real (npts) grid y point coordinates if iopt>0 - * @param rlon real (npts) earth longitudes in degrees e if - * iopt<0 (acceptable range: -360. to 360.) - * @param rlat real (npts) earth latitudes in degrees n if - * iopt<0 (acceptable range: -90. to 90.) - * @param nret number of valid points computed (-1 if - * projection unrecognized) - * @param crot (npts) clockwise vector rotation cosines - * @param srot (npts) clockwise vector rotation sines - * (ugrid=crot*uearth-srot*vearth, vgrid=srot*uearth+crot*vearth) - * @param xlon (npts) dx/dlon in 1/degrees - * @param xlat (npts) dx/dlat in 1/degrees - * @param ylon (npts) dy/dlon in 1/degrees - * @param ylat (npts) dy/dlat in 1/degrees - * @param area (npts) area weights in m**2 (Proportional to the - * square of the map factor in the case of conformal projections.) - * - * @author Jovic @date 2016 - */ -void gdswzd(int igdtnum, int *igdtmpl, int igdtlen, int iopt, - int npts, double fill, double *xpts, double *ypts, - double *rlon, double *rlat, int *nret, - double *crot, double *srot, double *xlon, double *xlat, - double *ylon, double *ylat, double *area); - -/** - * gdswzd_grib1() interface for C for _d build of the library. - * - * This is a C prototype to call the Fortran module subroutine - * gdswzd_c_grib1() for the _4 version of the library. - * - * @param kgds (200) gds parameters as decoded by - * [w3fi63](https://noaa-emc.github.io/NCEPLIBS-w3emc/w3fi63_8f.html). - * @param iopt option flag - * - 0 to compute earth coords of all the grid points - * - 1 to compute earth coords of selected grid coords - * - -1 to compute grid coords of selected earth coords - * @param npts maximum number of coordinates - * @param fill fill value to set invalid output data (must be - * impossible value; suggested value: -9999.) - * @param xpts (npts) grid x point coordinates if iopt>0 - * @param ypts (npts) grid y point coordinates if iopt>0 - * @param rlon (npts) earth longitudes in degrees e if iopt<0 - * (acceptable range: -360. to 360.) - * @param rlat (npts) earth latitudes in degrees n if iopt<0 - * (acceptable range: -90. to 90.) - * @param nret number of valid points computed (-1 if - * projection unrecognized) - * @param crot (npts) clockwise vector rotation cosines - * @param srot (npts) clockwise vector rotation sines - * (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth) - * @param xlon (npts) dx/dlon in 1/degrees - * @param xlat (npts) dx/dlat in 1/degrees - * @param ylon (npts) dy/dlon in 1/degrees - * @param ylat (npts) dy/dlat in 1/degrees - * @param area (npts) area weights in m**2 (proportional to the - * square of the map factor in the case of conformal projections.) - * - * @author Jovic @date 2016 - */ -void gdswzd_grib1(int kgds, int iopt, int npts, double *fill, double *xpts, - double *ypts, double *rlon, double *rlat, int nret, double *crot, - double *srot, double *xlon, double *xlat, double *ylon, - double *ylat, double *area); -#endif diff --git a/src/iplib_4.h b/src/iplib_4.h index 6f196407..1c8e80f6 100644 --- a/src/iplib_4.h +++ b/src/iplib_4.h @@ -1,35 +1,192 @@ /** @file - * @brief C interface to gdswzd() function for '4' library build. - * @author NOAA Programmer + * @brief C interface to gdswzd() and gdswzd_grib1() functions for '4' + * library build. + * @author Jovic @date 2016 */ #ifndef IPLIB #define IPLIB /** - GDSWZD_grib1 in C. - - @param kgds - @param iopt - @param npts - @param *fill - @param *xpts - @param *ypts - @param *rlon - @param *rlat - @param nret - @param *crot - @param *srot - @param *xlon - @param *xlat - @param *ylon - @param *ylat - @param *area + * gdswzd() interface for C for _4 build of library. + * + * @param igdtnum grid definition template number. Corresponds + * to the gfld%igdtnum component of the ncep g2 library gridmod data + * structure. + * - 00 equidistant cylindrical + * - 01 rotated equidistant cylindrical. "e" and non-"e" staggered + * - 10 mercator cyclindrical + * - 20 polar stereographic azimuthal + * - 30 lambert conformal conical + * - 40 gaussian equidistant cyclindrical + * @param igdtmpl (igdtlen) grid definition template array. + * corresponds to the gfld%igdtmpl component of the ncep g2 library + * gridmod data structure for section three. + * all projections: + * - 1 shape of earth, octet 15 + * - 2 scale factor of spherical earth radius, octet 16 + * - 3 scaled value of radius of spherical earth, octets 17-20 + * - 4 scale factor of major axis of elliptical earth, octet 21 + * - 5 scaled value of major axis of elliptical earth, octets 22-25 + * - 6 scale factor of minor axis of elliptical earth, octet 26 + * - 7 scaled value of minor axis of elliptical earth, octets 27-30 + * equidistant cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42. + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 j-direction increment, octets 68-71 + * - 19 scanning mode, octet 72 + * mercator cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 latitude of first point, octets 39-42 + * - 11 longitude of first point, octets 43-46 + * - 12 resolution and component flags, octet 47 + * - 13 tangent latitude, octets 48-51 + * - 14 latitude of last point, octets 52-55 + * - 15 longitude of last point, octets 56-59 + * - 16 scanning mode flags, octet 60 + * - 17 orientation of grid, octets 61-64 + * - 18 longitudinal grid length, octets 65-68 + * - 19 latitudinal grid length, octets 69-72 + * Lambert conformal conical: + * - 8 number of points along x-axis, octs 31-34 + * - 9 number of points along y-axis, octs 35-38 + * - 10 latitude of first point, octets 39-42 + * - 11 longitude of first point, octets 43-46 + * - 12 resolution of component flag, octet 47 + * - 13 latitude where grid lengths specified, octets 48-51 + * - 14 longitude of meridian that is parallel to y-axis, octets 52-55 + * - 15 x-direction grid length, octets 56-59 + * - 16 y-direction grid length, octets 60-63 + * - 17 projection center flag, octet 64 + * - 18 scanning mode, octet 65 + * - 19 first tangent latitude from pole, octets 66-69 + * - 20 second tangent latitude from pole, octets 70-73 + * - 21 latitude of south pole of projection, octets 74-77 + * - 22 longitude of south pole of projection, octets 78-81 + * gaussian cylindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42 + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 number of parallels between pole and equator, octets 68-71 + * - 19 scanning mode, octet 72 + * polar stereographic azimuthal: + * - 8 number of points along x-axis, octets 31-34 + * - 9 number of points along y-axis, octets 35-38 + * - 10 latitude of first grid point, octets 39-42 + * - 11 longitude of first grid point, octets 43-46 + * - 12 resolution and component flags, octet 47 + * - 13 true latitude, octets 48-51 + * - 14 orientation longitude, octets 52-55 + * - 15 x-direction grid length, octets 56-59 + * - 16 y-direction grid length, octets 60-63 + * - 17 projection center flag, octet 64 + * - 18 scanning mode flags, octet 65 + * rotated equidistant cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42 + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 j-direction increment, octets 68-71 + * - 19 scanning mode, octet 72 + * - 20 latitude of southern pole of projection, octets 73-76 + * - 21 longitude of southern pole of projection, octets 77-80 + * - 22 angle of rotation of projection, octs 81-84 + * @param igdtlen number of elements of the grid definition + * template array. Corresponds to the gfld%igdtlen component of the + * ncep g2 library gridmod data structure. + * @param iopt option flag + * - 0 to compute earth coords of all the grid points + * - 1 to compute earth coords of selected grid coords + * - -1 to compute grid coords of selected earth coords + * @param npts integer maximum number of coordinates + * @param fill real fill value to set invalid output data (must + * be impossible value; suggested value: -9999.) + * @param xpts real (npts) grid x point coordinates if iopt>0 + * @param ypts real (npts) grid y point coordinates if iopt>0 + * @param rlon real (npts) earth longitudes in degrees e if + * iopt<0 (acceptable range: -360. to 360.) + * @param rlat real (npts) earth latitudes in degrees n if + * iopt<0 (acceptable range: -90. to 90.) + * @param nret number of valid points computed (-1 if + * projection unrecognized) + * @param crot (npts) clockwise vector rotation cosines + * @param srot (npts) clockwise vector rotation sines + * (ugrid=crot*uearth-srot*vearth, vgrid=srot*uearth+crot*vearth) + * @param xlon (npts) dx/dlon in 1/degrees + * @param xlat (npts) dx/dlat in 1/degrees + * @param ylon (npts) dy/dlon in 1/degrees + * @param ylat (npts) dy/dlat in 1/degrees + * @param area (npts) area weights in m**2 (Proportional to the + * square of the map factor in the case of conformal projections.) + * + * @author Jovic @date 2016 */ -void gdswzd(int *kgds, int iopt, int npts, float fill, - float *xpts, float *ypts, float *rlon, float *rlat, - int *nret, +void gdswzd(int igdtnum, int *igdtmpl, int igdtlen, int iopt, + int npts, float fill, float *xpts, float *ypts, + float *rlon, float *rlat, int *nret, float *crot, float *srot, float *xlon, float *xlat, float *ylon, float *ylat, float *area); +/** + * gdswzd_grib1() interface for C for the _4 build of the library. + * + * This is a C prototype to call the Fortran module subroutine + * gdswzd_c_grib1() for the _4 version of the library. + * + * @param kgds (200) gds parameters as decoded by + * [w3fi63](https://noaa-emc.github.io/NCEPLIBS-w3emc/w3fi63_8f.html). + * @param iopt option flag + * - 0 to compute earth coords of all the grid points + * - 1 to compute earth coords of selected grid coords + * - -1 to compute grid coords of selected earth coords + * @param npts maximum number of coordinates + * @param fill fill value to set invalid output data (must be + * impossible value; suggested value: -9999.) + * @param xpts (npts) grid x point coordinates if iopt>0 + * @param ypts (npts) grid y point coordinates if iopt>0 + * @param rlon (npts) earth longitudes in degrees e if iopt<0 + * (acceptable range: -360. to 360.) + * @param rlat (npts) earth latitudes in degrees n if iopt<0 + * (acceptable range: -90. to 90.) + * @param nret number of valid points computed (-1 if + * projection unrecognized) + * @param crot (npts) clockwise vector rotation cosines + * @param srot (npts) clockwise vector rotation sines + * (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth) + * @param xlon (npts) dx/dlon in 1/degrees + * @param xlat (npts) dx/dlat in 1/degrees + * @param ylon (npts) dy/dlon in 1/degrees + * @param ylat (npts) dy/dlat in 1/degrees + * @param area (npts) area weights in m**2 (proportional to the + * square of the map factor in the case of conformal projections.) + * + * @author Jovic @date 2016 + */ +void gdswzd_grib1(int kgds, int iopt, int npts, float *fill, float *xpts, + float *ypts, float *rlon, float *rlat, int nret, float *crot, + float *srot, float *xlon, float *xlat, float *ylon, + float *ylat, float *area); + #endif diff --git a/src/iplib_8.h b/src/iplib_8.h index 058176de..ac755a59 100644 --- a/src/iplib_8.h +++ b/src/iplib_8.h @@ -1,35 +1,192 @@ /** @file - * @brief C interface to gdswzd() function for '8' library build. - * @author NOAA Programmer + * @brief C interface to gdswzd() and gdswzd_grib1() functions for '8' + * library build. + * @author Jovic @date 2016 */ #ifndef IPLIB #define IPLIB /** - GDSWZD_grib1 in C. - - @param kgds - @param iopt - @param npts - @param *fill - @param *xpts - @param *ypts - @param *rlon - @param *rlat - @param nret - @param *crot - @param *srot - @param *xlon - @param *xlat - @param *ylon - @param *ylat - @param *area + * gdswzd() interface for C for _8 build of library. + * + * @param igdtnum grid definition template number. Corresponds + * to the gfld%igdtnum component of the ncep g2 library gridmod data + * structure. + * - 00 equidistant cylindrical + * - 01 rotated equidistant cylindrical. "e" and non-"e" staggered + * - 10 mercator cyclindrical + * - 20 polar stereographic azimuthal + * - 30 lambert conformal conical + * - 40 gaussian equidistant cyclindrical + * @param igdtmpl (igdtlen) grid definition template array. + * corresponds to the gfld%igdtmpl component of the ncep g2 library + * gridmod data structure for section three. + * all projections: + * - 1 shape of earth, octet 15 + * - 2 scale factor of spherical earth radius, octet 16 + * - 3 scaled value of radius of spherical earth, octets 17-20 + * - 4 scale factor of major axis of elliptical earth, octet 21 + * - 5 scaled value of major axis of elliptical earth, octets 22-25 + * - 6 scale factor of minor axis of elliptical earth, octet 26 + * - 7 scaled value of minor axis of elliptical earth, octets 27-30 + * equidistant cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42. + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 j-direction increment, octets 68-71 + * - 19 scanning mode, octet 72 + * mercator cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 latitude of first point, octets 39-42 + * - 11 longitude of first point, octets 43-46 + * - 12 resolution and component flags, octet 47 + * - 13 tangent latitude, octets 48-51 + * - 14 latitude of last point, octets 52-55 + * - 15 longitude of last point, octets 56-59 + * - 16 scanning mode flags, octet 60 + * - 17 orientation of grid, octets 61-64 + * - 18 longitudinal grid length, octets 65-68 + * - 19 latitudinal grid length, octets 69-72 + * Lambert conformal conical: + * - 8 number of points along x-axis, octs 31-34 + * - 9 number of points along y-axis, octs 35-38 + * - 10 latitude of first point, octets 39-42 + * - 11 longitude of first point, octets 43-46 + * - 12 resolution of component flag, octet 47 + * - 13 latitude where grid lengths specified, octets 48-51 + * - 14 longitude of meridian that is parallel to y-axis, octets 52-55 + * - 15 x-direction grid length, octets 56-59 + * - 16 y-direction grid length, octets 60-63 + * - 17 projection center flag, octet 64 + * - 18 scanning mode, octet 65 + * - 19 first tangent latitude from pole, octets 66-69 + * - 20 second tangent latitude from pole, octets 70-73 + * - 21 latitude of south pole of projection, octets 74-77 + * - 22 longitude of south pole of projection, octets 78-81 + * gaussian cylindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42 + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 number of parallels between pole and equator, octets 68-71 + * - 19 scanning mode, octet 72 + * polar stereographic azimuthal: + * - 8 number of points along x-axis, octets 31-34 + * - 9 number of points along y-axis, octets 35-38 + * - 10 latitude of first grid point, octets 39-42 + * - 11 longitude of first grid point, octets 43-46 + * - 12 resolution and component flags, octet 47 + * - 13 true latitude, octets 48-51 + * - 14 orientation longitude, octets 52-55 + * - 15 x-direction grid length, octets 56-59 + * - 16 y-direction grid length, octets 60-63 + * - 17 projection center flag, octet 64 + * - 18 scanning mode flags, octet 65 + * rotated equidistant cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42 + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 j-direction increment, octets 68-71 + * - 19 scanning mode, octet 72 + * - 20 latitude of southern pole of projection, octets 73-76 + * - 21 longitude of southern pole of projection, octets 77-80 + * - 22 angle of rotation of projection, octs 81-84 + * @param igdtlen number of elements of the grid definition + * template array. Corresponds to the gfld%igdtlen component of the + * ncep g2 library gridmod data structure. + * @param iopt option flag + * - 0 to compute earth coords of all the grid points + * - 1 to compute earth coords of selected grid coords + * - -1 to compute grid coords of selected earth coords + * @param npts integer maximum number of coordinates + * @param fill real fill value to set invalid output data (must + * be impossible value; suggested value: -9999.) + * @param xpts real (npts) grid x point coordinates if iopt>0 + * @param ypts real (npts) grid y point coordinates if iopt>0 + * @param rlon real (npts) earth longitudes in degrees e if + * iopt<0 (acceptable range: -360. to 360.) + * @param rlat real (npts) earth latitudes in degrees n if + * iopt<0 (acceptable range: -90. to 90.) + * @param nret number of valid points computed (-1 if + * projection unrecognized) + * @param crot (npts) clockwise vector rotation cosines + * @param srot (npts) clockwise vector rotation sines + * (ugrid=crot*uearth-srot*vearth, vgrid=srot*uearth+crot*vearth) + * @param xlon (npts) dx/dlon in 1/degrees + * @param xlat (npts) dx/dlat in 1/degrees + * @param ylon (npts) dy/dlon in 1/degrees + * @param ylat (npts) dy/dlat in 1/degrees + * @param area (npts) area weights in m**2 (Proportional to the + * square of the map factor in the case of conformal projections.) + * + * @author Jovic @date 2016 */ -void gdswzd(long *kgds, long iopt, long npts, double fill, - double *xpts, double *ypts, double *rlon, double *rlat, - long *nret, +void gdswzd(long igdtnum, long *igdtmpl, long igdtlen, long iopt, + long npts, double fill, double *xpts, double *ypts, + double *rlon, double *rlat, long *nret, double *crot, double *srot, double *xlon, double *xlat, double *ylon, double *ylat, double *area); +/** + * gdswzd_grib1() interface for C for _8 build of the library. + * + * This is a C prototype to call the Fortran module subroutine + * gdswzd_c_grib1() for the _4 version of the library. + * + * @param kgds (200) gds parameters as decoded by + * [w3fi63](https://noaa-emc.github.io/NCEPLIBS-w3emc/w3fi63_8f.html). + * @param iopt option flag + * - 0 to compute earth coords of all the grid points + * - 1 to compute earth coords of selected grid coords + * - -1 to compute grid coords of selected earth coords + * @param npts maximum number of coordinates + * @param fill fill value to set invalid output data (must be + * impossible value; suggested value: -9999.) + * @param xpts (npts) grid x point coordinates if iopt>0 + * @param ypts (npts) grid y point coordinates if iopt>0 + * @param rlon (npts) earth longitudes in degrees e if iopt<0 + * (acceptable range: -360. to 360.) + * @param rlat (npts) earth latitudes in degrees n if iopt<0 + * (acceptable range: -90. to 90.) + * @param nret number of valid points computed (-1 if + * projection unrecognized) + * @param crot (npts) clockwise vector rotation cosines + * @param srot (npts) clockwise vector rotation sines + * (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth) + * @param xlon (npts) dx/dlon in 1/degrees + * @param xlat (npts) dx/dlat in 1/degrees + * @param ylon (npts) dy/dlon in 1/degrees + * @param ylat (npts) dy/dlat in 1/degrees + * @param area (npts) area weights in m**2 (proportional to the + * square of the map factor in the case of conformal projections.) + * + * @author Jovic @date 2016 + */ +void gdswzd_grib1(long kgds, long iopt, long npts, + double *fill, double *xpts, + double *ypts, double *rlon, double *rlat, int nret, double *crot, + double *srot, double *xlon, double *xlat, double *ylon, + double *ylat, double *area); #endif diff --git a/src/iplib_d.h b/src/iplib_d.h index dd225e41..8f821c70 100644 --- a/src/iplib_d.h +++ b/src/iplib_d.h @@ -1,35 +1,191 @@ /** @file - * @brief C interface to gdswzd() function for 'd' library build. - * @author NOAA Programmer + * @brief C interface to gdswzd() and gdswzd_grib1() functions for 'd' + * library build. + * @author Jovic @date 2016 */ #ifndef IPLIB #define IPLIB /** - GDSWZD_grib1 in C. - - @param kgds - @param iopt - @param npts - @param *fill - @param *xpts - @param *ypts - @param *rlon - @param *rlat - @param nret - @param *crot - @param *srot - @param *xlon - @param *xlat - @param *ylon - @param *ylat - @param *area + * gdswzd() interface for C for _d build of library. + * + * @param igdtnum grid definition template number. Corresponds + * to the gfld%igdtnum component of the ncep g2 library gridmod data + * structure. + * - 00 equidistant cylindrical + * - 01 rotated equidistant cylindrical. "e" and non-"e" staggered + * - 10 mercator cyclindrical + * - 20 polar stereographic azimuthal + * - 30 lambert conformal conical + * - 40 gaussian equidistant cyclindrical + * @param igdtmpl (igdtlen) grid definition template array. + * corresponds to the gfld%igdtmpl component of the ncep g2 library + * gridmod data structure for section three. + * all projections: + * - 1 shape of earth, octet 15 + * - 2 scale factor of spherical earth radius, octet 16 + * - 3 scaled value of radius of spherical earth, octets 17-20 + * - 4 scale factor of major axis of elliptical earth, octet 21 + * - 5 scaled value of major axis of elliptical earth, octets 22-25 + * - 6 scale factor of minor axis of elliptical earth, octet 26 + * - 7 scaled value of minor axis of elliptical earth, octets 27-30 + * equidistant cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42. + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 j-direction increment, octets 68-71 + * - 19 scanning mode, octet 72 + * mercator cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 latitude of first point, octets 39-42 + * - 11 longitude of first point, octets 43-46 + * - 12 resolution and component flags, octet 47 + * - 13 tangent latitude, octets 48-51 + * - 14 latitude of last point, octets 52-55 + * - 15 longitude of last point, octets 56-59 + * - 16 scanning mode flags, octet 60 + * - 17 orientation of grid, octets 61-64 + * - 18 longitudinal grid length, octets 65-68 + * - 19 latitudinal grid length, octets 69-72 + * Lambert conformal conical: + * - 8 number of points along x-axis, octs 31-34 + * - 9 number of points along y-axis, octs 35-38 + * - 10 latitude of first point, octets 39-42 + * - 11 longitude of first point, octets 43-46 + * - 12 resolution of component flag, octet 47 + * - 13 latitude where grid lengths specified, octets 48-51 + * - 14 longitude of meridian that is parallel to y-axis, octets 52-55 + * - 15 x-direction grid length, octets 56-59 + * - 16 y-direction grid length, octets 60-63 + * - 17 projection center flag, octet 64 + * - 18 scanning mode, octet 65 + * - 19 first tangent latitude from pole, octets 66-69 + * - 20 second tangent latitude from pole, octets 70-73 + * - 21 latitude of south pole of projection, octets 74-77 + * - 22 longitude of south pole of projection, octets 78-81 + * gaussian cylindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42 + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 number of parallels between pole and equator, octets 68-71 + * - 19 scanning mode, octet 72 + * polar stereographic azimuthal: + * - 8 number of points along x-axis, octets 31-34 + * - 9 number of points along y-axis, octets 35-38 + * - 10 latitude of first grid point, octets 39-42 + * - 11 longitude of first grid point, octets 43-46 + * - 12 resolution and component flags, octet 47 + * - 13 true latitude, octets 48-51 + * - 14 orientation longitude, octets 52-55 + * - 15 x-direction grid length, octets 56-59 + * - 16 y-direction grid length, octets 60-63 + * - 17 projection center flag, octet 64 + * - 18 scanning mode flags, octet 65 + * rotated equidistant cyclindrical: + * - 8 number of points along a parallel, octs 31-34 + * - 9 number of points along a meridian, octs 35-38 + * - 10 basic angle of initial production domain, octets 39-42 + * - 11 subdivisions of basic angle, octets 43-46 + * - 12 latitude of first grid point, octets 47-50 + * - 13 longitude of first grid point, octets 51-54 + * - 14 resolution and component flags, octet 55 + * - 15 latitude of last grid point, octets 56-59 + * - 16 longitude of last grid point, octets 60-63 + * - 17 i-direction increment, octets 64-67 + * - 18 j-direction increment, octets 68-71 + * - 19 scanning mode, octet 72 + * - 20 latitude of southern pole of projection, octets 73-76 + * - 21 longitude of southern pole of projection, octets 77-80 + * - 22 angle of rotation of projection, octs 81-84 + * @param igdtlen number of elements of the grid definition + * template array. Corresponds to the gfld%igdtlen component of the + * ncep g2 library gridmod data structure. + * @param iopt option flag + * - 0 to compute earth coords of all the grid points + * - 1 to compute earth coords of selected grid coords + * - -1 to compute grid coords of selected earth coords + * @param npts integer maximum number of coordinates + * @param fill real fill value to set invalid output data (must + * be impossible value; suggested value: -9999.) + * @param xpts real (npts) grid x point coordinates if iopt>0 + * @param ypts real (npts) grid y point coordinates if iopt>0 + * @param rlon real (npts) earth longitudes in degrees e if + * iopt<0 (acceptable range: -360. to 360.) + * @param rlat real (npts) earth latitudes in degrees n if + * iopt<0 (acceptable range: -90. to 90.) + * @param nret number of valid points computed (-1 if + * projection unrecognized) + * @param crot (npts) clockwise vector rotation cosines + * @param srot (npts) clockwise vector rotation sines + * (ugrid=crot*uearth-srot*vearth, vgrid=srot*uearth+crot*vearth) + * @param xlon (npts) dx/dlon in 1/degrees + * @param xlat (npts) dx/dlat in 1/degrees + * @param ylon (npts) dy/dlon in 1/degrees + * @param ylat (npts) dy/dlat in 1/degrees + * @param area (npts) area weights in m**2 (Proportional to the + * square of the map factor in the case of conformal projections.) + * + * @author Jovic @date 2016 */ -void gdswzd(int *kgds, int iopt, int npts, double fill, - double *xpts, double *ypts, double *rlon, double *rlat, - int *nret, +void gdswzd(int igdtnum, int *igdtmpl, int igdtlen, int iopt, + int npts, double fill, double *xpts, double *ypts, + double *rlon, double *rlat, int *nret, double *crot, double *srot, double *xlon, double *xlat, double *ylon, double *ylat, double *area); +/** + * gdswzd_grib1() interface for C for _d build of the library. + * + * This is a C prototype to call the Fortran module subroutine + * gdswzd_c_grib1() for the _4 version of the library. + * + * @param kgds (200) gds parameters as decoded by + * [w3fi63](https://noaa-emc.github.io/NCEPLIBS-w3emc/w3fi63_8f.html). + * @param iopt option flag + * - 0 to compute earth coords of all the grid points + * - 1 to compute earth coords of selected grid coords + * - -1 to compute grid coords of selected earth coords + * @param npts maximum number of coordinates + * @param fill fill value to set invalid output data (must be + * impossible value; suggested value: -9999.) + * @param xpts (npts) grid x point coordinates if iopt>0 + * @param ypts (npts) grid y point coordinates if iopt>0 + * @param rlon (npts) earth longitudes in degrees e if iopt<0 + * (acceptable range: -360. to 360.) + * @param rlat (npts) earth latitudes in degrees n if iopt<0 + * (acceptable range: -90. to 90.) + * @param nret number of valid points computed (-1 if + * projection unrecognized) + * @param crot (npts) clockwise vector rotation cosines + * @param srot (npts) clockwise vector rotation sines + * (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth) + * @param xlon (npts) dx/dlon in 1/degrees + * @param xlat (npts) dx/dlat in 1/degrees + * @param ylon (npts) dy/dlon in 1/degrees + * @param ylat (npts) dy/dlat in 1/degrees + * @param area (npts) area weights in m**2 (proportional to the + * square of the map factor in the case of conformal projections.) + * + * @author Jovic @date 2016 + */ +void gdswzd_grib1(int kgds, int iopt, int npts, double *fill, double *xpts, + double *ypts, double *rlon, double *rlat, int nret, double *crot, + double *srot, double *xlon, double *xlat, double *ylon, + double *ylat, double *area); #endif diff --git a/tests/tst_gdswzd_grib1.c b/tests/tst_gdswzd_grib1.c index 67e9f19e..6f91808b 100644 --- a/tests/tst_gdswzd_grib1.c +++ b/tests/tst_gdswzd_grib1.c @@ -4,14 +4,11 @@ Call gdswzd for a rotated lat/lon grid with "B" stagger and print out the corner point lat/lons and the number of valid grid points returned. - Tests the mixed precision version of gdswzd. **************************************************************/ #include #include -#include "iplib.h" - #if(LSIZE==4) #define REALTYPE float #else diff --git a/tests/tst_gdswzd_grib2.c b/tests/tst_gdswzd_grib2.c index 5082fb0f..4ec6de07 100644 --- a/tests/tst_gdswzd_grib2.c +++ b/tests/tst_gdswzd_grib2.c @@ -10,7 +10,7 @@ #include #include -#include "ip2lib.h" +#include "iplib.h" #if(LSIZE==4) #define REALTYPE float From 6094218f4ab14ec0607f45f0565a43a915652b46 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Wed, 20 Sep 2023 20:51:29 -0700 Subject: [PATCH 2/2] add testing for gdswzd_grib1() C interface --- src/iplib_4.h | 8 ++++---- src/iplib_8.h | 9 ++++----- src/iplib_d.h | 8 ++++---- tests/tst_gdswzd_grib1.c | 10 ++++------ 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/iplib_4.h b/src/iplib_4.h index 1c8e80f6..86bcbf69 100644 --- a/src/iplib_4.h +++ b/src/iplib_4.h @@ -184,9 +184,9 @@ void gdswzd(int igdtnum, int *igdtmpl, int igdtlen, int iopt, * * @author Jovic @date 2016 */ -void gdswzd_grib1(int kgds, int iopt, int npts, float *fill, float *xpts, - float *ypts, float *rlon, float *rlat, int nret, float *crot, - float *srot, float *xlon, float *xlat, float *ylon, - float *ylat, float *area); +void gdswzd_grib1(int *kgds, int iopt, int npts, float fill, + float *xpts, float *ypts, float *rlon, float *rlat, + int *nret, float *crot, float *srot, + float *xlon, float *xlat, float *ylon, float *ylat, float *area); #endif diff --git a/src/iplib_8.h b/src/iplib_8.h index ac755a59..9f1e056b 100644 --- a/src/iplib_8.h +++ b/src/iplib_8.h @@ -184,9 +184,8 @@ void gdswzd(long igdtnum, long *igdtmpl, long igdtlen, long iopt, * * @author Jovic @date 2016 */ -void gdswzd_grib1(long kgds, long iopt, long npts, - double *fill, double *xpts, - double *ypts, double *rlon, double *rlat, int nret, double *crot, - double *srot, double *xlon, double *xlat, double *ylon, - double *ylat, double *area); +void gdswzd_grib1(long *kgds, long iopt, long npts, double fill, + double *xpts, double *ypts, double *rlon, double *rlat, + long *nret, double *crot, double *srot, + double *xlon, double *xlat, double *ylon, double *ylat, double *area); #endif diff --git a/src/iplib_d.h b/src/iplib_d.h index 8f821c70..7436ce64 100644 --- a/src/iplib_d.h +++ b/src/iplib_d.h @@ -184,8 +184,8 @@ void gdswzd(int igdtnum, int *igdtmpl, int igdtlen, int iopt, * * @author Jovic @date 2016 */ -void gdswzd_grib1(int kgds, int iopt, int npts, double *fill, double *xpts, - double *ypts, double *rlon, double *rlat, int nret, double *crot, - double *srot, double *xlon, double *xlat, double *ylon, - double *ylat, double *area); +void gdswzd_grib1(int *kgds, int iopt, int npts, double fill, + double *xpts, double *ypts, double *rlon, double *rlat, + int *nret, double *crot, double *srot, + double *xlon, double *xlat, double *ylon, double *ylat, double *area); #endif diff --git a/tests/tst_gdswzd_grib1.c b/tests/tst_gdswzd_grib1.c index 6f91808b..ccaa985a 100644 --- a/tests/tst_gdswzd_grib1.c +++ b/tests/tst_gdswzd_grib1.c @@ -9,6 +9,8 @@ #include #include +#include "iplib.h" + #if(LSIZE==4) #define REALTYPE float #else @@ -20,10 +22,6 @@ #define INTTYPE int #endif -void gdswzd_grib1(INTTYPE *, INTTYPE, INTTYPE, REALTYPE, - REALTYPE *, REALTYPE *, REALTYPE *, REALTYPE *, INTTYPE *, - REALTYPE *, REALTYPE *, REALTYPE *, REALTYPE *, REALTYPE *, REALTYPE *, REALTYPE *); - int main() { INTTYPE kgds[200]; @@ -77,8 +75,8 @@ int main() gdswzd_grib1(kgds, iopt, npts, fill, xpts, ypts, rlon, rlat, - &nret, - crot, srot, xlon, xlat, ylon, ylat, area); + &nret, crot, srot, xlon, + xlat, ylon, ylat, area); int expextedPointsReturned = 50451;