NCEPLIBS-ip  5.0.0
gdswzd_c_mod Module Reference

Module that contains C wrapper for routine gdswzd(). More...

Functions/Subroutines

subroutine gdswzd_c (IGDTNUM, IGDTMPL, IGDTLEN, IOPT, NPTS, FILL, XPTS, YPTS, RLON, RLAT, NRET, CROT, SROT, XLON, XLAT, YLON, YLAT, AREA)
 C wrapper for routine gdswzd(). More...
 
subroutine gdswzd_c_grib1 (KGDS, IOPT, NPTS, FILL, XPTS, YPTS, RLON, RLAT, NRET, CROT, SROT, XLON, XLAT, YLON, YLAT, AREA)
 C wrapper for routine gdswzd. More...
 

Detailed Description

Module that contains C wrapper for routine gdswzd().

Author
JOVIC
Date
2016-04-10

Function/Subroutine Documentation

◆ gdswzd_c()

subroutine gdswzd_c_mod::gdswzd_c ( integer(kind=c_int), intent(in), value  IGDTNUM,
integer(kind=c_int), dimension(igdtlen), intent(in)  IGDTMPL,
integer(kind=c_int), intent(in), value  IGDTLEN,
integer(kind=c_int), intent(in), value  IOPT,
integer(kind=c_int), intent(in), value  NPTS,
real(kind=c_double), intent(in), value  FILL,
real(kind=c_double), dimension(npts), intent(inout)  XPTS,
real(kind=c_double), dimension(npts), intent(inout)  YPTS,
real(kind=c_double), dimension(npts), intent(inout)  RLON,
real(kind=c_double), dimension(npts), intent(inout)  RLAT,
integer(kind=c_int), intent(out)  NRET,
real(kind=c_double), dimension(npts), intent(out)  CROT,
real(kind=c_double), dimension(npts), intent(out)  SROT,
real(kind=c_double), dimension(npts), intent(out)  XLON,
real(kind=c_double), dimension(npts), intent(out)  XLAT,
real(kind=c_double), dimension(npts), intent(out)  YLON,
real(kind=c_double), dimension(npts), intent(out)  YLAT,
real(kind=c_double), dimension(npts), intent(out)  AREA 
)

C wrapper for routine gdswzd().

Use this routine to call gdswzd() from a C or C++ program. Takes advantage of the fortran/c interoperability standard.

Program History Log

Date Programmer Comments
2016-04-10 Jovic initial version.
2016-04-26 G. Gayno update for grib 2

Example: Mixed precsion iplib call

include "iplib.h"
int *igdtmpl;
int igdtnum, igdtlen, iopt, npts, nret;
double fill;
double *xpts, *ypts, *rlon, *rlat;
double *crot, *srot, *xlon, *xlat, *ylon, *ylat, *area;
gdswzd(igdtnum, igdtmpl, igdtlen, iopt, npts,
fill, xpts, ypts, rlon, rlat,
&nret, crot, srot, xlon,
xlat, ylon, ylat, area);
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() interface for C for _4 build of library.
Parameters
[in]igdtnumgrid definition template number. Corresponds to the gfldigdtnum 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
[in]igdtmpl(igdtlen) grid definition template array. corresponds to the gfldigdtmpl 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
[in]igdtlennumber of elements of the grid definition template array. Corresponds to the gfldigdtlen component of the ncep g2 library gridmod data structure.
[in]ioptoption 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
[in]nptsinteger maximum number of coordinates
[in]fillreal fill value to set invalid output data (must be impossible value; suggested value: -9999.)
[in,out]xptsreal (npts) grid x point coordinates if iopt>0
[in,out]yptsreal (npts) grid y point coordinates if iopt>0
[in,out]rlonreal (npts) earth longitudes in degrees e if iopt<0 (acceptable range: -360. to 360.)
[in,out]rlatreal (npts) earth latitudes in degrees n if iopt<0 (acceptable range: -90. to 90.)
[out]nretnumber of valid points computed (-1 if projection unrecognized)
[out]crot(npts) clockwise vector rotation cosines
[out]srot(npts) clockwise vector rotation sines (ugrid=crot*uearth-srot*vearth, vgrid=srot*uearth+crot*vearth)
[out]xlon(npts) dx/dlon in 1/degrees
[out]xlat(npts) dx/dlat in 1/degrees
[out]ylon(npts) dy/dlon in 1/degrees
[out]ylat(npts) dy/dlat in 1/degrees
[out]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-04-10

Definition at line 173 of file gdswzd_c.F90.

◆ gdswzd_c_grib1()

subroutine gdswzd_c_mod::gdswzd_c_grib1 ( integer(kind=c_int), dimension(200), intent(in)  KGDS,
integer(kind=c_int), intent(in), value  IOPT,
integer(kind=c_int), intent(in), value  NPTS,
real(kind=c_double), intent(in), value  FILL,
real(kind=c_double), dimension(npts), intent(inout)  XPTS,
real(kind=c_double), dimension(npts), intent(inout)  YPTS,
real(kind=c_double), dimension(npts), intent(inout)  RLON,
real(kind=c_double), dimension(npts), intent(inout)  RLAT,
integer(kind=c_int), intent(out)  NRET,
real(kind=c_double), dimension(npts), intent(out)  CROT,
real(kind=c_double), dimension(npts), intent(out)  SROT,
real(kind=c_double), dimension(npts), intent(out)  XLON,
real(kind=c_double), dimension(npts), intent(out)  XLAT,
real(kind=c_double), dimension(npts), intent(out)  YLON,
real(kind=c_double), dimension(npts), intent(out)  YLAT,
real(kind=c_double), dimension(npts), intent(out)  AREA 
)

C wrapper for routine gdswzd.

Use this routine to call 'gdswzd' from a C or C++ program. Takes advantage of the fortran/c interoperability standard.

Example: mixed precsion iplib call

include "iplib.h"
int kgds[200];
int iopt, npts, nret;
double fill;
double *xpts, *ypts, *rlon, *rlat;
double *crot, *srot, *xlon, *xlat, *ylon, *ylat, *area;
gdswzd(kgds, iopt, npts, fill,
xpts, ypts, rlon, rlat,
&nret, crot, srot, xlon,
xlat, ylon, ylat, area);
Parameters
kgds(200) gds parameters as decoded by w3fi63.
ioptoption 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
nptsmaximum number of coordinates
fillfill value to set invalid output data (must be impossible value; suggested value: -9999.)
xpts(npts) grid x point coordinates if iopt>0
ypts(npts) grid y point coordinates if iopt>0
[out]rlon(npts) earth longitudes in degrees e if iopt<0 (acceptable range: -360. to 360.)
[out]rlat(npts) earth latitudes in degrees n if iopt<0 (acceptable range: -90. to 90.)
[out]nretnumber of valid points computed (-1 if projection unrecognized)
[out]crot(npts) clockwise vector rotation cosines
[out]srot(npts) clockwise vector rotation sines (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth)
[out]xlon(npts) dx/dlon in 1/degrees
[out]xlat(npts) dx/dlat in 1/degrees
[out]ylon(npts) dy/dlon in 1/degrees
[out]ylat(npts) dy/dlat in 1/degrees
[out]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-04-10

Definition at line 259 of file gdswzd_c.F90.