Example #1
0
int main(
  int argc,
  char *argv[]) {

  static atm_t atm_in, atm_pts;
  static ctl_t ctl;

  /* Check arguments... */
  if (argc < 5)
    ERRMSG("Give parameters: <ctl> <atm_in> <atm_pts> <atm_out>");

  /* Read control parameters... */
  read_ctl(argc, argv, &ctl);

  /* Read atmospheric data... */
  read_atm(NULL, argv[2], &ctl, &atm_in);
  read_atm(NULL, argv[3], &ctl, &atm_pts);

  /* Interpolate atmospheric data... */
  intpol_atm(&ctl, &atm_pts, &atm_in);

  /* Save interpolated data... */
  write_atm(NULL, argv[4], &ctl, &atm_pts);

  return EXIT_SUCCESS;
}
Example #2
0
void read_wifi(struct params *p)
{
	char buf[4096];
	int rc;
	struct ieee80211_frame *wh;

	rc = sniff(p->rx, buf, sizeof(buf));
	if (rc == -1)
		err(1, "sniff()");
        
	wh = get_wifi(buf, &rc);
	if (!wh)
		return;

	/* filter my own shit */
	if (memcmp(wh->i_addr2, p->mac, 6) == 0) {
		/* XXX CTL frames */
		if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) !=
		    IEEE80211_FC0_TYPE_CTL)
			return;
	}

#if 1
	ack(p, wh);
#endif

	if (duplicate(p, wh, rc)) {
#if 0
		printf("Dup\n");
#endif		
		return;
	}

	switch (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) {
	case IEEE80211_FC0_TYPE_MGT:
		read_mgt(p, wh, rc);
		break;
		
	case IEEE80211_FC0_TYPE_CTL:
		read_ctl(p, wh, rc);
		break;
	
	case IEEE80211_FC0_TYPE_DATA:
		read_data(p, wh, rc);
		break;
	
	default:
		printf("wtf\n");
		abort();
		break;
	}
}
Example #3
0
int main(
  int argc,
  char *argv[]) {

  static atm_t atm;
  static ctl_t ctl;
  static obs_t obs;

  gsl_matrix *k;

  size_t m, n;

  /* Check arguments... */
  if (argc < 5)
    ERRMSG("Give parameters: <ctl> <obs> <atm> <kernel>");

  /* Read control parameters... */
  read_ctl(argc, argv, &ctl);

  /* Set flags... */
  ctl.write_matrix = 1;

  /* Read observation geometry... */
  read_obs(NULL, argv[2], &ctl, &obs);

  /* Read atmospheric data... */
  read_atm(NULL, argv[3], &ctl, &atm);

  /* Get sizes... */
  n = atm2x(&ctl, &atm, NULL, NULL, NULL);
  m = obs2y(&ctl, &obs, NULL, NULL, NULL);

  /* Check sizes... */
  if (n <= 0)
    ERRMSG("No state vector elements!");
  if (m <= 0)
    ERRMSG("No measurement vector elements!");

  /* Allocate... */
  k = gsl_matrix_alloc(m, n);

  /* Compute kernel matrix... */
  kernel(&ctl, &atm, &obs, k);

  /* Write matrix to file... */
  write_matrix(NULL, argv[4], &ctl, k, &atm, &obs, "y", "x", "r");

  /* Free... */
  gsl_matrix_free(k);

  return EXIT_SUCCESS;
}
Example #4
0
int main(
  int argc,
  char *argv[]) {

  static ctl_t ctl;

  FILE *in;

  char dirlist[LEN], task[LEN], wrkdir[LEN];

  /* Check arguments... */
  if (argc < 5)
    ERRMSG("Give parameters: <ctl> <obs> <atm> <rad>");

  /* Read control parameters... */
  read_ctl(argc, argv, &ctl);

  /* Get task... */
  scan_ctl(argc, argv, "TASK", -1, "-", task);

  /* Get dirlist... */
  scan_ctl(argc, argv, "DIRLIST", -1, "-", dirlist);

  /* Single forward calculation... */
  if (dirlist[0] == '-')
    call_formod(&ctl, NULL, argv[2], argv[3], argv[4], task);

  /* Work on directory list... */
  else {

    /* Open directory list... */
    if (!(in = fopen(dirlist, "r")))
      ERRMSG("Cannot open directory list!");

    /* Loop over directories... */
    while (fscanf(in, "%s", wrkdir) != EOF) {

      /* Write info... */
      printf("\nWorking directory: %s\n", wrkdir);

      /* Call forward model... */
      call_formod(&ctl, wrkdir, argv[2], argv[3], argv[4], task);
    }

    /* Close dirlist... */
    fclose(in);
  }

  return EXIT_SUCCESS;
}
Example #5
0
int main(
    int argc,
    char *argv[]) {

    static atm_t atm;
    static ctl_t ctl;

    double dz, t0, z, z0, z1;

    /* Check arguments... */
    if (argc < 3)
        ERRMSG("Give parameters: <ctl> <atm>");

    /* Read control parameters... */
    read_ctl(argc, argv, &ctl);
    t0 = scan_ctl(argc, argv, "T0", -1, "0", NULL);
    z0 = scan_ctl(argc, argv, "Z0", -1, "0", NULL);
    z1 = scan_ctl(argc, argv, "Z1", -1, "90", NULL);
    dz = scan_ctl(argc, argv, "DZ", -1, "1", NULL);

    /* Set atmospheric grid... */
    for (z = z0; z <= z1; z += dz) {
        atm.time[atm.np] = t0;
        atm.z[atm.np] = z;
        if ((++atm.np) >= NP)
            ERRMSG("Too many atmospheric grid points!");
    }

    /* Interpolate climatological data... */
    climatology(&ctl, &atm);

    /* Write data to disk... */
    write_atm(NULL, argv[2], &ctl, &atm);

    return EXIT_SUCCESS;
}