void vfgname ( int *iret ) /************************************************************************ * vfgname * * * * This function gets the station information for the anchor points. * * * * vfgname ( iret ) * * * * Input parameters: * * * * Output parameters: * * *iret int Return Code * * * ** * * Log: * * A. Hardy/GSC 8/99 Created * * A. Hardy/GSC 11/99 Removed unused variables * * A. Hardy/GSC 01/00 Changed type from int to char * * A. Hardy/GSC 2/00 Extracted from SPCTXT * * A. Hardy/GSC 5/00 Removed FILE declarations * * A. Hardy/GSC 5/01 Initialized iret to 0 * * R. Tian/SAIC 7/03 Changed to call cst_gtag * ***********************************************************************/ { char stninfo[128]; char hunt[1], type[7]; int ier, nstns, maxlen, isrch; /*-------------------------------------------------------------------*/ *iret = 0; ier = 0; strcpy (type, "ANCHOR"); hunt[0] = '\0'; maxlen = sizeof(stninfo); isrch = 1; /* * Find the first point's information. */ clo_init ( &ier ); clo_findstn ( type, spcinfo.ancrpt.stn1, hunt, isrch, maxlen, &nstns, stninfo, &ier ); cst_gtag ( "NAME", stninfo, " ", spcinfo.ancrpt.stnnam1, &ier ); cst_gtag ( "ST", stninfo, " ", spcinfo.ancrpt.stateid1, &ier ); /* * Find the second point's information. */ clo_findstn ( type, spcinfo.ancrpt.stn2, hunt, 1, maxlen, &nstns, stninfo, &ier); cst_gtag ( "NAME", stninfo, " ", spcinfo.ancrpt.stnnam2, &ier ); cst_gtag ( "ST", stninfo, " ", spcinfo.ancrpt.stateid2, &ier ); }
void clo_findmatch ( char *locnam, char *name, char *state, int itype, int srchtyp, int maxlen, int *nret, char *info, int *iret ) /************************************************************************ * clo_findmatch * * * * This function finds station information based on the type and name. * * A state PO abbreviation may also be given to to narrow the choices. * * * * clo_findmatch ( locnam, name, state, itype, srchtyp, maxlen, * * nret, info, iret ) * * * * Input parameters: * * *locnam char Data location name * * *name char Full name or substring to match * * *state char State name (optional) * * itype int Type of data to match * * = 0 - column1 * * = 1 - column3 * * srchtyp int Search type * * = 1 - EXACT * * = 2 - FIRST * * = 3 - INDEX * * maxlen int Max length of info string * * * * Output parameters: * * *nret int Number of matches returned * * *info char String w/ match information * * *iret int Return code * * = 0: normal * * = >0: > maxret available * * = -2: unable to find match * * * ** * * Log: * * S. Law/GSC 03/99 initial coding * * T. Piper/GSC 3/99 Corrected prolog * * D.W.Plummer/NCEP 4/99 added MARINE and COASTAL types * * D.W.Plummer/NCEP 8/00 changes for modified CLO library * * D.W.Plummer/NCEP 8/00 calling seq change - added itype * ***********************************************************************/ { /*---------------------------------------------------------------------*/ switch ( itype ) { case 0: /* * Search based on station ID */ clo_findstn ( locnam, name, state, srchtyp, maxlen, nret, info, iret ); break; case 1: /* * Search based on station description (name) */ clo_finddesc ( locnam, name, state, srchtyp, maxlen, nret, info, iret ); break; } }
void clo_findstnw ( char *locnam, char *xid, char *xstate, int *srchtyp, int *maxlen, int *nret, char *info, int *iret ) /************************************************************************ * clo_findstnw * * * * This function is a wrapper for the Fortran routines * * to call CLO_FINDSTN. Therefore, the calling sequence is the same as * * CLO_FINDSTN except that all integers are converted to pointers. * * * * clo_findstnw ( locnam,xid,xstate,srchtyp,maxlen,nret,info,iret ) * * * * Input parameters: * * *locnam char Data location name * * *xid char Station name or substring * * *xstate char State name (optional) * * *srchtyp int Search type * * = 1 - EXACT * * = 2 - FIRST * * = 3 - INDEX * * *maxlen int Max length of info string * * * * Output parameters: * * *nret int Number of stations returned * * *info char String w/ station information * * *iret int Return code * * = 0 - normal * * = >0 - >maxret stations availble* * = -2 - unable to match station * ** * * Log: * * S. Jacobs/NCEP 2/05 * * m.gamazaychikov/SAIC 02/05 Moved from gh_fstn * ***********************************************************************/ { clo_findstn ( locnam, xid, xstate, *srchtyp, *maxlen, nret, info, iret ); }
void wbc_area ( char *locnam, char *vorstr, int len, char *areastr, int *iret ) /************************************************************************ * wbc_area * * * * This function converts the VOR stations string to the VOR watch area * * string,containing distance, direction, county names and state ids. * * * * Input example: * * 17 WNW DEC;26 E FAM;26 WNW FAM;55 SSE COU;22 NNW UIN;47 ENE UIN; * * * * Output example: * * 17 WNW OF DECATUR, IL..TO 26 E OF FARMINGTON, MO..TO 26 WNW OF * * FARMINGTON, MO..TO 55 SSE OF COLUMBIA, MO..TO 22 NNW OF QUINCY, * * IL..TO 47 ENE OF QUINCY, IL. * * * * wbc_area ( locnam, vorstr, len, areastr, iret ) * * * * Input parameters: * * *locnam char Locator type * * *vorstr char Polygon text string * * len int Max length of 'areastr' * * * * Output parameters: * * *areastr char Polygon area text string * * *iret int Return value * * -5 = VORSTR too big * * * ** * * Log: * * A. Hardy/NCEP 5/03 From VF_AREA * ************************************************************************/ { int ii, nstn, maxlen, nstr, np, icnt, ier, exp, max, len1; char tmpstr[420], holdstr[200], qstate[1], pstn[180]; char arrgrp[15], **aryvor, county[30], state[3]; /*---------------------------------------------------------------------*/ *iret = 0; np = 1; icnt = 1; max = 6; exp = 4; qstate[0] = '\0'; tmpstr[0] = '\0'; maxlen = sizeof(pstn); if ( strcmp ( locnam, "VOR") != 0 ) { *iret = -2; return; } cst_lstr ( vorstr, &len1, &ier ); if ( len1 >= 400 ) { *iret = -5; return; } /* * Set up the memory space to break up the VOR area string. */ clo_init ( &ier ); aryvor = (char **) malloc(sizeof(char *) * 4); for ( ii = 0; ii < 4; ii++ ) { aryvor[ii] = (char *) malloc(6) ; } /* * Get the city and state of the VOR station. */ for ( ii = 0; ii < 6; ii++) { vorstr = (char *) cst_split ( vorstr, ';', 12, arrgrp, &ier); cst_clst ( arrgrp, ' ', " ", exp, max, aryvor, &nstr, &ier); if ( nstr == 3 ) { clo_findstn ( locnam, aryvor[2], qstate, np, maxlen, &nstn, pstn, &ier); } else if ( nstr == 2) { clo_findstn ( locnam, aryvor[1], qstate, np, maxlen, &nstn, pstn, &ier); } cst_gtag ( "NAME", pstn, " ", county, &ier ); cst_gtag ( "ST", pstn, " ", state, &ier ); cst_rnan (county, county, &ier); /* * Create the watch area string. */ holdstr[0] = '\0'; if ( icnt < 6 ) { if ( strcmp ( aryvor[0], "..") != 0 ) { sprintf( holdstr," %s %s OF %s, %s..TO ",aryvor[0], aryvor[1], county, state); } else { /* * Print string for zero distance and no direction. */ sprintf( holdstr," %s, %s..TO ", county, state); } } else { if ( strcmp ( aryvor[0], "..") != 0 ) { sprintf( holdstr," %s %s OF %s, %s.",aryvor[0], aryvor[1], county, state); } else { /* * Print string for zero distance and no direction. */ sprintf( holdstr," %s, %s.", county, state); } } icnt++; cst_ncat ( tmpstr, holdstr, &len1, &ier); } len1 = G_MIN ( len, (int)strlen(tmpstr) ); cst_ncpy( areastr, tmpstr, len1, &ier); /* * Free memory space. */ for ( ii = 0; ii < 4; ii++ ) { free ( aryvor[ii] ); } free ( aryvor); }