Exemple #1
0
void
isobar (float pres, short flag)
	/*************************************************************/
	/*  ISOBAR                                                   */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Draws pressure lines (pres, mb) on SkewT graphic.        */
	/*                                                           */
	/*  flag = 0    Draw complete horizontal line                */
	/*       = 1    Draw small tick marks along sides of chart   */
	/*************************************************************/
{
  short y;
  char st[10];

  setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);
  y = pres_to_pix (pres);
  if (flag == 0)
    {
      moveto (skv.tlx, y);
      itoa ((short) pres, st, 10);
      outgtext (st, skv.tlx - getgtextextent (st) - 2, y - 5);
      setcliprgn (skv.tlx, skv.tly, skv.brx, skv.bry, draw_reg, gc);
      moveto (skv.tlx, y);
      lineto (skv.brx, y);
    }
  else
    {
      moveto (skv.tlx, y);
      lineto (skv.tlx + 5, y);
      moveto (skv.brx, y);
      lineto (skv.brx - 5, y);
    }
}
Exemple #2
0
void
isotherm (float temp)
	/*************************************************************/
	/*  ISOTHERM                                                 */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Draws temperature lines (temp, c) on SkewT graphic.      */
	/*************************************************************/
{
  short x, y;
  char st[10];

  setcolor (24, draw_reg, gc);
  x = temp_to_pix (temp, 1050);
  y = skv.bry;
  if ((temp >= -30) && (temp <= 50))
    {
      setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);
      itoa ((short) temp, st, 10);
      setcolor (1, draw_reg, gc);
      outgtext (st, x - (getgtextextent (st) / 2), y);
      setcolor (24, draw_reg, gc);
    }
  setcliprgn (skv.tlx, skv.tly, skv.brx, skv.bry, draw_reg, gc);
  moveto (x, y);
  x = temp_to_pix (temp, 100);
  y = skv.tly;
  lineto (x, y);
}
Exemple #3
0
void
draw_hodo (void)
	/*************************************************************/
	/*  DRAW_HODO                                                */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Draws a standard Hodograph display.                      */
	/*************************************************************/
{
  short x1, y1, x2, y2, i, y3;
  float wdir, wspd, mnu, mnv, ix1, ix2, ix3, ix4;
  char st[10];

  setcolor (0, draw_reg, gc);
  rectangle (1, 1, 1, hov.brx + 14, hov.bry + 14);
  setcolor (1, draw_reg, gc);
  set_font (2);
  setcliprgn (hov.tlx, hov.tly, hov.brx, hov.bry, draw_reg, gc);
  setlinestyle (1, 1);
  rectangle (0, hov.tlx, hov.tly, hov.brx, hov.bry);

  /* ----- Plot crosshairs ----- */
  setcolor (31, draw_reg, gc);
  hodo_to_pix (180.0F, 60.0F, &x1, &y1);
  moveto (x1, hov.tly);
  lineto (x1, hov.bry);

  setcolor (31, draw_reg, gc);
  hodo_to_pix (270.0F, 60.0F, &x1, &y1);
  moveto (hov.tlx, y1);
  lineto (hov.brx, y1);

  /* ----- Plot Radius circles ----- */
  setcolor (24, draw_reg, gc);
  setlinestyle (2, 1);
  hodo_to_pix (0.0F, 0.0F, &x1, &y1);
  x2 = x1;
  y2 = y1;
  for (i = hov.scale; i <= hov.hodomag; i = i + hov.scale)
    {
      hodo_to_pix (0.0F, (float) i, &x1, &y1);
      y3 = (y1 - y2);
      ellipse (0, x2 - y3, y2 - y3, x2 + y3, y2 + y3);
    }

  setcolor (1, draw_reg, gc);
  /* ----- Plot X-Coord hash marks ----- */
  for (i = hov.scale; i <= hov.hodomag; i = i + hov.scale)
    {
      hodo_to_pix (180.0F, (float) i, &x1, &y1);
      moveto (x1 - 3, y1);
      lineto (x1 + 3, y1);
      itoa (i, st, 10);
      outgtext (st, x1 - getgtextextent (st) - 4, y1 - 5);

      hodo_to_pix (360.0F, (float) i, &x1, &y1);
      moveto (x1 - 3, y1);
      lineto (x1 + 3, y1);
      itoa (i, st, 10);
      outgtext (st, x1 - getgtextextent (st) - 4, y1 - 5);
    }

  /* ----- Plot Y-Coord hash marks ----- */
  setcolor (1, draw_reg, gc);
  for (i = hov.scale; i <= hov.hodomag; i = i + hov.scale)
    {
      hodo_to_pix (90.0F, (float) i, &x1, &y1);
      moveto (x1, y1 - 3);
      lineto (x1, y1 + 3);
      itoa (i, st, 10);
      outgtext (st, x1 - (getgtextextent (st) / 2), y1 + 5);

      hodo_to_pix (270.0F, (float) i, &x1, &y1);
      moveto (x1, y1 - 3);
      lineto (x1, y1 + 3);
      itoa (i, st, 10);
      outgtext (st, x1 - (getgtextextent (st) / 2), y1 + 5);
    }

  /* ----- Plot Hodograph (Shear Vectors) ----- */
  setcolor (2, draw_reg, gc);
  setlinestyle (1, 2);

  if ((sndgp != NULL) && (sndgp->numlev > 0))
    {
      trace_hodo (3);

      /* ----- Plot Mean Wind Vector ----- */
      setcolor (5, draw_reg, gc);
      mean_wind (-1.0F, -1.0F, &mnu, &mnv, &wdir, &wspd);
      hodo_to_pix (wdir, wspd, &x1, &y1);
      moveto (x1, y1);
      rectangle (0, (short) (x1 - 4), (short) (y1 - 4), (short) (x1 + 4),
		 (short) (y1 + 4));


      /* ----- Plot 30/75 Storm Motion Vector ----- */
      mean_wind (sndgp->sndg[sfc ()].pres, i_pres (msl (6000.0F)), &ix1, &ix2,
		 &ix3, &ix4);
      setcolor (11, draw_reg, gc);
      setlinestyle (1, 1);
      ix4 *= .75F;
      ix3 += 30.0F;
      if (ix3 > 360.0F)
	ix3 -= 360.0F;
      hodo_to_pix (ix3, ix4, &x1, &y1);
      moveto (x1 - 3, y1);
      lineto (x1 + 3, y1);
      moveto (x1, y1 - 3);
      lineto (x1, y1 + 3);
      ellipse (0, x1 - 3, y1 - 3, x1 + 3, y1 + 3);


      /* ----- Plot 15/85 Storm Motion Vector ----- */
      mean_wind (sndgp->sndg[sfc ()].pres, i_pres (msl (6000.0F)), &ix1, &ix2,
		 &ix3, &ix4);
      setcolor (12, draw_reg, gc);
      setlinestyle (1, 1);
      ix4 *= .85F;
      ix3 += 15.0F;
      if (ix3 > 360.0F)
	ix3 -= 360.0F;
      hodo_to_pix (ix3, ix4, &x1, &y1);
      moveto (x1 - 3, y1);
      lineto (x1 + 3, y1);
      moveto (x1, y1 - 3);
      lineto (x1, y1 + 3);
      ellipse (0, x1 - 3, y1 - 3, x1 + 3, y1 + 3);


      /* ----- Plot Current Storm Motion Vector ----- */
      setcolor (31, draw_reg, gc);
      setlinestyle (1, 1);
      hodo_to_pix (sndgp->st_dir, sndgp->st_spd, &x1, &y1);
      moveto (x1 - 6, y1);
      lineto (x1 + 6, y1);
      moveto (x1, y1 - 6);
      lineto (x1, y1 + 6);
      ellipse (0, x1 - 6, y1 - 6, x1 + 6, y1 + 6);

      /* ----- Display Hodograph Inset ----- */
      draw_hoinset ();

      setcolor (1, draw_reg, gc);
      set_font (1);
      outgtext (sndgp->title, skv.tlx, 1);
    }


  /* ----- Draw final outline of hodograph ----- */
  setcolor (1, draw_reg, gc);
  setlinestyle (1, 1);
  rectangle (0, hov.tlx, hov.tly, hov.brx, hov.bry);

  /* reset clip region */
  setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);

  XCopyArea (XtDisplay (draw_reg), canvas, XtWindow (draw_reg),
	     gc, 0, 0, xwdth, xhght, 0, 0);
}
Exemple #4
0
        /*NP*/
void plot_advectionprofile(void)
        /*************************************************************/
        /*  PLOT_ADVECTIONPROFILE                                    */
        /*  John Hart  SPC Norman                                    */
        /*                                                           */
        /*  Plots vertical profile of Wind Speeds                    */
        /*************************************************************/
{
        float bothgt, tophgt, h, wsp, advt, ix1, z;
        short x1, y1, x2, y2, x3, i, tlx, tly, wid, hgt;
        short pIndex, zIndex, wsIndex, wdIndex; 
        char st[10];

        pIndex = getParmIndex("PRES");
        zIndex = getParmIndex("HGHT");
        wsIndex = getParmIndex("SPED");

        if (!sndg || pIndex == -1 || zIndex == -1 || wsIndex == -1) return;

        tlx = skv.brx + 93;
        tly = skv.tly;
        wid = 67;
        hgt = skv.bry - skv.tly;

        setcliprgn(tlx, tly, tlx+wid, tly+hgt+15);
        setcolor(0);
        setlinestyle( 1, 1 );
        rectangle(1,tlx, tly, tlx+wid, tly+hgt);
        setcolor(1);
        rectangle(0, tlx, tly, tlx+wid, tly+hgt);

	/* Draw centerline */
        setlinestyle( 2, 1 );
	moveto( tlx + (wid/2), tly); lineto(tlx + (wid/2), tly + hgt);

	set_font(4);
        setlinestyle( 1, 1 );
	for (h=sndg[sfc()][pIndex]; h>=200; h-=100) {
		advt = advection_layer(&ix1, h, h - 100);

		/* Draw tick marks 
                x1 = tlx + (wid/2) + 5;
                x2 = tlx + (wid/2) - 5;
                y2 = pres_to_pix(h);
                y1 = pres_to_pix(h - 100);
		setcolor(1);
		moveto( x1, y1); lineto(x2, y1);
		moveto( x1, y2); lineto(x2, y2);
		*/
                x1 = tlx + (wid/2);
                x2 = tlx + (wid/2) + (advt*2.5);
                y2 = pres_to_pix(h);
                y1 = pres_to_pix(h - 100);
		setcolor(1);
		moveto( x1, y1); lineto(x2, y1);
		moveto( x1, y2); lineto(x2, y2);
		setcolor(26);
        	if (advt > 0) setcolor(13);
		sprintf( st, "%.1f", advt);
		if(advt > 0) rectangle(0, x1, y1, x2, y2); else rectangle(0, x2, y1, x1, y2);
		if (advt > 0) {
			x3 = x2 + 3;
			if (advt > 2) x3 = x1 + 3;
			}
		else {
			x3 = x2 - getgtextextent(st); 
			if (advt < -2) x3 = x1 - getgtextextent(st); 
			}
		if (advt > -999) outgtext( st, x3, ((y1+y2)/2)-4);
	}

        /* ----- Plot Label ----- */
        setcolor(1);
        set_font(5);
        outgtext("Inferred", tlx+5, tly+3);
        outgtext("Temp Advection",  tlx+5, tly+13);
        outgtext("(C / hr)",  tlx+5, tly+23);

	setcliprgn(1, 1, xwdth, xhght);
	copytodisplay();
}