Original WRF subgrid support version from John Michalakes without fire
[wrffire.git] / wrfv2_fire / chem / KPP / util / wkc / get_wrf_chem_specs.c
blob3399c64aaf43466ca2cb5a94a14f8093aabb91ee
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <strings.h>
5 #include <dirent.h>
6 #include <unistd.h>
7 #include <sys/stat.h>
11 #include "protos.h"
12 #include "protos_kpp.h"
13 #include "registry.h"
14 #include "data.h"
15 #include "kpp_data.h"
18 int
19 get_wrf_chem_specs ( )
21 node_t * pkg;
22 char assoc_namelist_var[NAMELEN];
23 char scalars_str[NAMELEN] ;
24 char * scalar ;
25 char * suffix;
26 char pname[NAMELEN] ;
27 int j;
29 knode_t * q , * member ;
32 for ( pkg = Packages ; pkg != NULL ; pkg = pkg->next )
36 if ( !strncmp( pkg->pkg_assoc ,"chem_opt", 8) )
41 suffix=strrchr(pkg->name, '_');
42 /* printf("suffix 0 %s \n",suffix ); */
45 /* only use packages ending on "_kpp" */
47 if ( suffix == NULL ) continue;
48 if (strlen(suffix) != 4) continue;
49 if (strcmp(suffix, "_kpp") != 0) continue;
51 /* clear string */
52 for(j = 0; j < NAMELEN ; j++) pname[j]='\0';
54 /* remove the _kpp at the end */
55 strncpy(pname, pkg->name, strlen(pkg->name)-4);
58 /* printf("pname 0 %s %s %i \n",pname,pkg->name, strlen(pkg->name)-4 ); */
61 q = new_knode( );
62 q->next = NULL ;
63 strcpy( q->name, pname );
64 add_knode_to_end( q , &(WRFC_packs) ) ;
67 strcpy(scalars_str,pkg->pkg_4dscalars) ;
70 scalar=strtok(scalars_str, ":");
71 scalar=strtok(NULL, ",");
74 while (scalar != NULL)
77 member = new_knode( ) ;
78 strcpy( member->name , scalar ) ;
79 member->next = NULL ;
80 add_knode_to_end( member , &(q->members) ) ;
83 scalar = strtok(NULL, ",");
94 return(0) ;