예제 #1
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);
}
예제 #2
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);
    }
}
예제 #3
0
	/*NP*/
void plot_vis(void)
	/*************************************************************/
	/*  PLOT_VIS                                                 */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots the results of storm-relative parcel trajectory.   */
	/*************************************************************/
{
	float sfctemp, sfcdwpt, sfcpres, ix1;
	short x1, y1, x2, y2, ulx, uly, vwid;
	Parcel pcl;

	ulx = hov.tlx;
	uly = hov.bry;
	vwid = 120;

	setcliprgn( ulx, uly, ulx + vwid, uly + vwid - 1);
	setcolor(0);
	setlinestyle( 1, 1 );
	rectangle( 1, ulx, uly, ulx + vwid, uly + vwid - 1); 
	setcolor(1);
	rectangle( 0, ulx, uly, ulx + vwid, uly + vwid - 1);

       /* ----- Plot Crosshairs ----- */
	setcolor(24);
	moveto(ulx, uly + (vwid/2)); lineto(ulx + vwid, uly + (vwid/2));
	moveto(ulx + (vwid/2), uly); lineto(ulx + (vwid/2), uly + vwid);

	/* ----- Plot Label ----- */
	setcolor(1);
	/* outgtext( "Storm", hov.brx-145, hov.tly + 125 ); */
	outgtext( "Storm Slinky",  ulx + 5, uly + vwid-13 );


	/* ----- Calculate Parcel Data ----- */
	sfctemp = lplvals.temp;
	sfcdwpt = lplvals.dwpt;
	sfcpres = lplvals.pres;
	ix1 = parcel( -1, -1, sfcpres, sfctemp, sfcdwpt, &pcl);

	/* ----- Plot storm motion ----- */
	x1 = ulx + (vwid/2);
	y1 = uly + (vwid/2);
	x2 = x1 + (short)ucomp( st_dir, 30);
	y2 = y1 - (short)vcomp( st_dir, 30);
	setcolor(31);
	moveto( x1, y1);
	lineto( x2, y2);

	/* ----- Run Visualization Routine ----- */
	ix1 = visual1( pcl.lfcpres, pcl.elpres, sfcpres, sfctemp, sfcdwpt, ulx, uly, vwid);
	
	setcliprgn(1, 1, xwdth, xhght);
}
예제 #4
0
	/*NP*/
void draw_hoinset( void )
	/*************************************************************/
	/*  DRAW_HOINSET                                             */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Draws the hodograph inset graphic selected by the user.  */
	/*************************************************************/
{
	switch(ho_mode)
	   {
	   case 0:
	      break;
	   case 1:
	      plot_vis();
	      break;
	   case 2:
	      plot_storminflow();
	      break;
	   case 3:
	      plot_vertsrw();
	      break;
	   }

	XCopyArea(XtDisplay(draw_reg), canvas, XtWindow(draw_reg), 
		  gc, hov.brx-150, hov.tly, 150, 150, 
		  hov.brx-150, hov.tly);
	XFlush(XtDisplay(draw_reg));
	setcliprgn(1, 1, xwdth, xhght);
}
예제 #5
0
 /*NP*/ void
plot_barbs (void)
	/*************************************************************/
	/*  PLOT_BARBS                                               */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots wind barbs along side of thermo diagram.           */
	/*************************************************************/
{
  short ii, xx, yy;
  float lastpres;

  setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);
  lastpres = 1100;
  for (ii = 0; ii < sndgp->numlev; ii++)
    {
      if (qc (sndgp->sndg[ii].drct))
	{
	  yy = pres_to_pix (sndgp->sndg[ii].pres);
	  xx = skv.brx - 40;

	  if ((sndgp->sndg[ii].hght - i_hght (lastpres)) > 400)
	    {
	      wind_barb (sndgp->sndg[ii].drct, sndgp->sndg[ii].sped, xx, yy,
			 4);
	      lastpres = sndgp->sndg[ii].pres;
	    }
	}
    }
}
예제 #6
0
void
trace_dwpt2 (short width)
	/*************************************************************/
	/*  TRACE_DWPT2                                              */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots environmental Dew Point trace on SkewT.            */
	/*************************************************************/
{
  short i, x, y, xold, yold, ok = 0, numlvl2;

  numlvl2 = sndgp->ovrlev;
  setcliprgn (skv.tlx, skv.tly, skv.brx, skv.bry, draw_reg, gc);
  setlinestyle (1, width);
  for (i = 0; i < numlvl2; i++)
    {
      if (sndgp->ovrl[i].dwpt > -200)
	{
	  xold = x;
	  yold = y;
	  x = temp_to_pix (sndgp->ovrl[i].dwpt, sndgp->ovrl[i].pres);
	  y = pres_to_pix (sndgp->ovrl[i].pres);
	  if (ok == 0)
	    {
	      moveto (x, y);
	      ok = 1;
	    }
	  else
	    {
	      moveto (xold, yold);
	      lineto (x, y);
	    }
	}
    }
}
예제 #7
0
void
trace_temp (struct sndg_struct *sp, short width)
	/*************************************************************/
	/*  TRACE_TEMP                                               */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots environmental temperature trace on SkewT.          */
	/*************************************************************/
{
  short i, x, y, xold, yold, ok = 0;

  setcliprgn (skv.tlx, skv.tly, skv.brx, skv.bry, draw_reg, gc);
  setlinestyle (1, width);
  for (i = 0; i < sp->numlev; i++)
    {
      if (sp->sndg[i].temp > -200)
	{
	  xold = x;
	  yold = y;
	  x = temp_to_pix (sndgp->sndg[i].temp, sndgp->sndg[i].pres);
	  y = pres_to_pix (sndgp->sndg[i].pres);
	  if (ok == 0)
	    {
	      moveto (x, y);
	      ok = 1;
	    }
	  else
	    {
	      moveto (xold, yold);
	      lineto (x, y);
	    }
	}
    }
}
예제 #8
0
void
vvel_profile (void)
	/*************************************************************/
	/*  VVEL_PROFILE                                             */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots vertical velocity profile                          */
	/*************************************************************/
{
  short i, x1, x2, y, avail, leng;

  avail = 0;
  setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);
  for (i = 0; i < sndgp->numlev; i++)
    {
      if (qc (sndgp->sndg[i].omega) && (sndgp->sndg[i].omega < 1))
	{
	  avail++;
	  y = pres_to_pix (sndgp->sndg[i].pres);
	  x1 = skv.tlx + 40;
	  leng = (sndgp->sndg[i].omega * 1000);	/* Convert to Mbs/sec */
	  x2 = x1 - (leng * 2);	/* Determine screen scale */
	  setcolor (25, draw_reg, gc);
	  if (sndgp->sndg[i].omega < 0)
	    setcolor (12, draw_reg, gc);
	  moveto (x1, y);
	  lineto (x2, y);
	}
    }

  /* ----- Draw Scales ----- */
  if (avail > 5)
    {
      setcolor (7, draw_reg, gc);
      x1 = skv.tlx + 40;
      moveto (x1, skv.tly + 40);
      lineto (x1, skv.bry - 10);

      setlinestyle (3, 1);
      x1 = skv.tlx + 20;
      moveto (x1, skv.tly + 40);
      lineto (x1, skv.bry - 10);
      x1 = skv.tlx + 60;
      moveto (x1, skv.tly + 40);
      lineto (x1, skv.bry - 10);

      set_font (2);
      outgtext ("OMEGA", skv.tlx + 18, skv.tlx);
      outgtext ("+10", skv.tlx + 3, skv.tlx + 15);
      outgtext ("-10", skv.tlx + 43, skv.tlx + 15);
    }
}
예제 #9
0
파일: main.cpp 프로젝트: zoe01/function
//主页
void MainPage(){
	setcliprgn(NULL);
	int choose = 0;

	choose = MainMenu();
	switch (choose){
	case 1: display1(); break;
	case 2: display2(); break;
	case 3:  settings();  break;
	case 4:  closemusic(); closegraph(); exit(1);
	default:;
	}
	_getch();
}
예제 #10
0
void isobar_nolabel (float pres)
/*************************************************************/
/*  OPC MODIFICATION - J. Morgan 5/12/05                     */
/*  ISOBAR_NOLABEL - New function                     		 */
/*                                                           */
/*  ISOBAR_NOLABEL                                           */
/*  J. Morgan OPC                                            */
/*                                                           */
/*  Modification of void isobar() to draw pressure (pres)    */
/*    without a label on SkewT graphic                       */
/*                                                           */
/*  Called by 	xwvid1.c: draw_skewt()                        */
/*************************************************************/
	{
		short y;

		setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);
		y = pres_to_pix (pres);
		moveto (skv.tlx, y);
		setcliprgn (skv.tlx, skv.tly, skv.brx, skv.bry, draw_reg, gc);
		moveto (skv.tlx, y);
		lineto (skv.brx, y);
	}
예제 #11
0
void
dry_adiabat (float thta)
	/*************************************************************/
	/*  DRY_ADIABAT                                              */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Draws dry adiabat of theta (thta, c) on SkewT graphic.   */
	/*************************************************************/
{
  float pres, temp;
  short x, y;

  setcliprgn (skv.tlx, skv.tly, skv.brx, skv.bry, draw_reg, gc);
  for (pres = 1050; pres >= 100; pres = pres - 50)
    {
      temp = (float) ((((double) thta + 273.15) / pow (1000.0 /
						       (double) pres,
						       ROCP)) - 273.15);

      x = temp_to_pix (temp, pres);
      y = pres_to_pix (pres);

      /*
         if( pres <= 200) { printf( "%f   %f   %d\n", pres, temp, x);}
       */

      if (pres == 1050)
	{
	  moveto (x, y);
	}
      else
	{
	  lineto (x, y);
	}
    }
}
예제 #12
0
        /* NP */
short ww_type(short *wwtype, short *dcp)
        /********************************************************************/
        /*      Watch type guidance                                         */
        /*      A decision tree to help with ww issuance                    */
        /*                                                                  */
        /*      Rich Thompson SPC OUN                                       */
        /********************************************************************/
        {
        float ix1, ix2, ix3, ix4, lr75, shr6, t500, fzlh, mumixr, lowrh, midrh, low_mid_rh;
        float mucn, mlcn, mlcp, sbcp, mucp, lr1, lr3, shr6_dir, sr46_dir, sr46_spd, shr6_sr46_diff, mmp;
        float sig_tor, sig_tor_winter, sighail, wind_dmg, rm_scp, cbsig, dncp, srh1, sblcl, mllcl;
        float oldlplpres, pres, pbot, ptop, shr8, bot, top, esrh, lm_scp;
        short oldlplchoice, ww_choice;
        short pIndex, tIndex, zIndex, tdIndex;
        short x1, y1, x2, y2, tlx, tly, wid;
        struct _parcel pcl;
        char st[40];

        tlx = hov.tlx + 409;
        tly = hov.bry;
        wid = 119;

        setcliprgn( tlx+2, tly+2, tlx+wid+24, tly+wid+1);
        setcolor(0);
        setlinestyle( 1, 1 );
        rectangle( 1,tlx, tly, tlx+wid+27, tly+wid+1);
        setcolor(1);
        rectangle( 0, tlx, tly, tlx+wid+27, tly+wid+1);
        setlinestyle( 1, 1 );
        moveto( tlx + 2, tly + 18);
	lineto(tlx + wid + 27, tly + 18);


        /* ----- Plot Label ----- */
        set_font(6);
        setcolor(1);
        outgtext( "Psbl Watch Type", tlx + 20, tly + 3 );

	*wwtype = 0;
	*dcp = 0;

        oldlplchoice = lplvals.flag;

        tIndex = getParmIndex("TEMP");
        pIndex = getParmIndex("PRES");
        zIndex = getParmIndex("HGHT");
        tdIndex = getParmIndex("DWPT");

/* 24 Mar 2008 */
/*        effective_inflow_layer(100, -250, &pbot, &ptop);*/

	/* sb parcel */
        define_parcel(1,0);
        ix1 = parcel(-1, -1, lplvals.pres, lplvals.temp, lplvals.dwpt, &pcl);
        sbcp = pcl.bplus;
        sblcl = agl(i_hght(pcl.lclpres, I_PRES));
        sig_tor_winter = sigtorn_fixed(st_dir, st_spd);

	/* ml parcel */
        define_parcel(4,100);
        ix1 = parcel(-1, -1, lplvals.pres, lplvals.temp, lplvals.dwpt, &pcl);
        mlcn = pcl.bminus;
        mlcp = pcl.bplus;
        mllcl = agl(i_hght(pcl.lclpres, I_PRES));
        sig_tor = sigtorn_cin(st_dir, st_spd);

	/* mu parcel */
        define_parcel(3,400);
        mucp = parcel(-1, -1, lplvals.pres, lplvals.temp, lplvals.dwpt, &pcl);
        mucn = pcl.bminus;

	dncp = dcape(&ix1, &ix2);

	/* sighail ingredients */
        lr75 = lapse_rate(&ix1, 700, 500);
        wind_shear(sndg[sfc()][pIndex], i_pres(msl(6000)), &ix1, &ix2, &ix3, &ix4);
        shr6 = ix4;
        shr6_dir = ix3;
        wind_shear(sndg[sfc()][pIndex], i_pres(msl(8000)), &ix1, &ix2, &ix3, &ix4);
	shr8 = ix4;
        mumixr = mixratio(lplvals.pres, lplvals.dwpt);
        t500 =  i_temp(500, I_PRES);
        fzlh = mtof(agl(i_hght(temp_lvl(0, &ix1), I_PRES)));
        sighail = sig_hail(pcl.bplus, mumixr, lr75, t500, kt_to_mps(shr6), fzlh, pcl.bminus, 0, 0, 25, mlcp);

        rm_scp = scp(st_dir, st_spd);
        wind_dmg = damaging_wind();

        sr_wind( i_pres(msl(4000)), i_pres(msl(6000)), st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
        sr46_dir = ix3;
        sr46_spd = ix4;
        shr6_sr46_diff = (shr6_dir - sr46_dir);
	srh1 = helicity(0, 1000, st_dir, st_spd, &ix1, &ix2);
	bot = agl(i_hght(p_bot, I_PRES));
	top = agl(i_hght(p_top, I_PRES));	
	esrh = helicity(bot, top, st_dir, st_spd, &ix1, &ix2);

        lapse_rate(&ix2, sndg[sfc()][pIndex], i_pres(sndg[sfc()][zIndex]+1000));
        lr1 = ix2;
        lapse_rate(&ix2, sndg[sfc()][pIndex], i_pres(sndg[sfc()][zIndex]+3000));
        lr3 = ix2;

        mean_relhum(&ix1, sndg[sfc()][pIndex]-150, sndg[sfc()][pIndex]-350);
        midrh = ix1;
        mean_relhum(&ix1, sndg[sfc()][pIndex], sndg[sfc()][pIndex]-150);
        lowrh = ix1;
        low_mid_rh = ((lowrh + midrh)/2);
        mmp = coniglio1();
        cbsig = (mlcp * kt_to_mps(shr6));

/* 24 Mar 2008 */
/* all "p_bot" below were changed from "pbot" */

/* Decision tree below is identical to the operational "ww_type" flow chart documentation 9/23/09 RLT */
        if ((sig_tor >= 3.0) && (sig_tor_winter >= 3.0) && (srh1 >= 150) && (esrh >= 150) && (sr46_spd >= 15.0) && (shr8 >= 40.0) && (sblcl < 1000) && (mllcl < 1100) && (lr1 >= 5.0) && (bot == 0.0)) {
		*dcp = 1;
		*wwtype = 5;
                ww_choice = 5;
        	/*printf("\n dcp (in PDS) = %d", *dcp);*/
        	set_font(6);
        	setcolor(7);
        	outgtext( "PDS TOR", tlx + 45, tly + 60 );
                }

/*        else
        if ((sig_tor_winter >= 4.0) && (sr46_spd >= 15.0) && (shr8 >= 40.0) && (sblcl < 1000) && (lr1 >= 5.0) && (bot == 0.0)) {
                *dcp = 2;
                *wwtype = 5;
                ww_choice = 5;
                set_font(6);
                setcolor(7);
                outgtext( "PDS TOR", tlx + 45, tly + 60 );
                }
*/	
        else
        if (((sig_tor >= 3.0) || (sig_tor_winter >= 4.0)) && (bot == 0.0)) {
                *dcp = 3;
                *wwtype = 4;
                ww_choice = 4;
                /*printf("\n dcp (in TOR) = %d", *dcp);*/
                set_font(6);
                setcolor(2);
                outgtext( "TOR", tlx + 45, tly + 60 );
                }
	
        else
        if (((sig_tor >= 1.0) || (sig_tor_winter >= 1.0)) && ((sr46_spd >= 15.0) || (shr8 >= 40.0)) && (bot == 0.0)) {
                *dcp = 4;
                *wwtype = 4;
                ww_choice = 4;
                /*printf("\n dcp (in TOR) = %d", *dcp);*/
                set_font(6);
                setcolor(2);
                outgtext( "TOR", tlx + 45, tly + 60 );
                }

        else
        if (((sig_tor >= 1.0) || (sig_tor_winter >= 1.0)) && (low_mid_rh >= 60) && (lr1 >= 5.0) && (bot == 0.0)) {
                *dcp = 5;
                *wwtype = 4;
                ww_choice = 4;
                /*printf("\n dcp (in TOR) = %d", *dcp);*/
                set_font(6);
                setcolor(2);
                outgtext( "TOR", tlx + 45, tly + 60 );
                }

        else
        if ((( sig_tor >= 1.0) || (sig_tor_winter >= 1.0)) && (bot == 0.0)) {
                *dcp = 6;
                *wwtype = 3;	
                ww_choice = 3; 
                /*printf("\n dcp (in mrgl TOR) = %d", *dcp);*/
	        set_font(6);
                setcolor(2);
                outgtext( "mrgl TOR", tlx + 40, tly + 60 );
                }

        else
        if (((( sig_tor >= 0.5) && (esrh >= 150)) || ((sig_tor_winter >= 0.5) && (srh1 >= 150))) && (bot == 0.0)) {
                *dcp = 7;
                *wwtype = 3;	
                ww_choice = 3;
                /*printf("\n dcp (in mrgl TOR) = %d", *dcp);*/
                set_font(6);
                setcolor(2);
                outgtext( "mrgl TOR", tlx + 40, tly + 60 );
                }

        else
        if ((( sig_tor_winter >= 1.0) || (rm_scp >= 4.0) || (sig_tor >= 1.0)) && (mucn >= -50.0)) {
                *dcp = 8;
                *wwtype = 2;
                ww_choice = 2;
                /*printf("\n dcp (in SVR) = %d", *dcp);*/
	        set_font(6);
                setcolor(6);
                outgtext( "SVR",  tlx + 60, tly + 60 );
                }

        else
        if ((rm_scp >= 2.0) && ((sighail >= 1.0) || (dncp >= 750)) && (mucn >= -50.0)) {
                *dcp = 9;
                *wwtype = 2;
                ww_choice = 2;
                /*printf("\n dcp (in SVR) = %d", *dcp);*/
                set_font(6);
                setcolor(6);
                outgtext( "SVR",  tlx + 60, tly + 60 );
                }

        else
        if ((cbsig >= 30000) && (mmp >= 0.6) && (mucn >= -50.0)) {
                *dcp = 10;
                *wwtype = 2;
                ww_choice = 2;
                /*printf("\n dcp (in SVR) = %d", *dcp);*/
                set_font(6);
                setcolor(6);
                outgtext( "SVR",  tlx + 60, tly + 60 );
                }
        
	else
        if ((mucn >= -75.0) && ((wind_dmg >= 0.5) || (sighail >= 0.5) || (rm_scp >= 0.5)))  {
                *dcp = 11;
                *wwtype = 1;
                ww_choice = 1;
                /*printf("\n dcp (in mrgl SVR) = %d", *dcp);*/
	        set_font(6);
                setcolor(26);
                outgtext( "MRGL SVR",  tlx + 40, tly + 60 );
                }
        else    {
                *dcp = 0;
                /*printf("\n dcp (after logic checks) = %d", *dcp);*/
                *wwtype = 0;
                ww_choice = 0;
		}

        if (*wwtype == 0) {
                set_font(6);
                setcolor(19);
                outgtext( "NONE",  tlx + 50, tly + 60 );
                }
    	//printf("sig_tor=%f sig_tor_winter=%f srh1=%f esrh=%f sr46_spd=%f shr8=%f sblcl=%f\n mllcl=%f lr1=%f bot=%f low_mid_rh=%f rm_scp=%f\n mucn=%f dncp=%f sighail=%f cbsig=%f wind_dmg=%f",
    	//		sig_tor,sig_tor_winter,srh1,esrh,sr46_spd,shr8, sblcl, mllcl, lr1, bot, low_mid_rh, rm_scp,mucn, dncp, sighail, cbsig, wind_dmg);

/*      define_parcel(oldlplchoice, oldlplpres); */
        
        /* set parcel back to user selection */
        if (oldlplchoice == 1)
          pres = 0;
        else if (oldlplchoice == 2)
          pres = 0;
        else if (oldlplchoice == 3)
          pres = mu_layer;
        else if (oldlplchoice == 4)
          pres = mml_layer;
        else if (oldlplchoice == 5)
          pres = user_level;
        else if (oldlplchoice == 6)
          pres = mu_layer;
        define_parcel(oldlplchoice, pres);

        return ww_choice;

        }
예제 #13
0
	/*NP*/
void plot_storminflow( void )
	/*************************************************************/
	/*  PLOT_STORMINFLOW                                         */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots various inflow/sr wind vectors.                    */
	/*************************************************************/
{
	float sfctemp, sfcdwpt, sfcpres, ix1, ix2, ix3, ix4;
	short x1, y1, x2, y2, x3, y3, i;
	struct _parcel pcl;

	setcliprgn( hov.brx-150, hov.tly, hov.brx, hov.tly+150);
	setcolor(0);
	setlinestyle( 1, 1 );
	rectangle( 1, hov.brx-150, hov.tly, hov.brx, hov.tly+150);
	setcolor(1);
	rectangle( 0, hov.brx-150, hov.tly, hov.brx, hov.tly+150);
	setcolor(1);
	moveto(hov.brx-150, hov.tly + 75); lineto(hov.brx, hov.tly+75);
	moveto(hov.brx-75, hov.tly); lineto(hov.brx-75, hov.tly+150);
	
	sfctemp = lplvals.temp;
	sfcdwpt = lplvals.dwpt;
	sfcpres = lplvals.pres;

	/* ----- Plot speed rings ----- */
	x1 = hov.brx - 75;
	y1 = hov.tly + 75;
	setlinestyle( 2, 1 );
	setcolor(24);
	for(i=20; i<=60; i+=20) { ellipse( 0, x1-i, y1-i, x1+i, y1+i); }
	rectangle( 0, hov.brx-150, hov.tly, hov.brx, hov.tly+150);

	/* ----- Plot Label ----- */
	setcolor(1);
	outgtext( "SR Wind", hov.brx-135, hov.tly + 3 );
	outgtext( "Vectors", hov.brx-135, hov.tly + 15 );

	/* ----- Calculate Parcel Data ----- */
	ix1 = parcel( -1, -1, sfcpres, sfctemp, sfcdwpt, &pcl);

	/* ----- Plot 0-2km Inflow Vector ----- */
	sr_wind( -1, i_pres(msl(2000)), st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
	if(qc(ix3))
	   {
	   x1 = hov.brx - 75;
	   y1 = hov.tly + 75;
	   x2 = (hov.brx - 75) + (short)ix1;
	   y2 = (hov.tly + 75) - (short)ix2;
	   x3 = x2 + 1;
	   y3 = y2 + 1;

	   setlinestyle( 1, 2 );
	   setcolor(2);
	   moveto( x1, y1); lineto( x2, y2);
	   outgtext( "L", x3, y3 );
	   }

	/* ----- Plot 4-6km Inflow Vector ----- */
	sr_wind( i_pres(msl(4000)), i_pres(msl(6000)), st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
	if(qc(ix3))
	   {
	   x1 = hov.brx - 75;
	   y1 = hov.tly + 75;
	   x2 = (hov.brx - 75) + (short)ix1;
	   y2 = (hov.tly + 75) - (short)ix2;
	   x3 = x2 + 1;
	   y3 = y2 + 1;

	   setcolor(6);
	   setlinestyle( 1, 2 );
	   moveto( x1, y1); lineto( x2, y2);
	   outgtext( "M", x3, y3 );
	   }

	/* ----- Plot 9-11km Inflow Vector ----- */
	sr_wind( i_pres(msl(9000)), i_pres(msl(11000)), st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
	if(qc(ix3))
	   {
	   x1 = hov.brx - 75;
	   y1 = hov.tly + 75;
	   x2 = (hov.brx - 75) + (short)ix1;
	   y2 = (hov.tly + 75) - (short)ix2;
	   x3 = x2 + 1;
	   y3 = y2 + 1;

	   setcolor(7);
	   setlinestyle( 1, 2 );
	   moveto( x1, y1); lineto( x2, y2);
	   outgtext( "H", x3, y3 );
	   }
}
예제 #14
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);
}
예제 #15
0
void draw_skewt (void)
/*************************************************************/
/*  DRAW_SKEWT                                               */
/*  John Hart  NSSFC KCMO                                    */
/*                                                           */
/*  Draws a standard Skew-T/LogP diagram.                    */
/*************************************************************/
{
  short i;
  float thta;
  float ix1, ix2, ix3, ix4, ix5, ix6, ix7;
  float lvl[] =
    { 1050.0F, 1000.0F, 850.0F, 700.0F, 500.0F, 300.0F, 200.0F, 100.0F };
  char rtitle[200];

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

/* ----- Draw Skewed Temperature Lines ----- */
  setcolor (24, draw_reg, gc);
  setlinestyle (2, 1);
  for (i = (-160); i <= 50; i = i + 10)
    {
      isotherm ((float) i);
    }

/* ----- Draw Dry Adiabats ----- */
  setcolor (24, draw_reg, gc);
  setlinestyle (1, 1);
  for (thta = (-70.0F); thta <= 350.0F; thta = thta + 20.0F)
    {
      dry_adiabat (thta);
    };

/* ----- Draw Horizontal Pressure Lines ----- */
  setcolor (1, draw_reg, gc);
  setlinestyle (1, 1);
  for (i = 1; i < 8; i++)
    {
      isobar (lvl[i], 0);
    }
  for (i = 100; i <= 1050; i = i + 50)
    {
      isobar ((float) i, 1);
    }

/* ----- Draw OPC Horizontal Stability Lines ----- *
 ************************************************************************
 *  OPC MODIFICATION - J. Morgan 5/12/05				*
 *  Draws:								*
 *	 Lowest Inversion Height					*
 *	 Layer Based Mixing Height					*
 *	 Surface Based Mixing Height					*
 *  Calls:								*
 *	 xwvid.c: void isobar_nolabel ()				*
 *	skparams.c: void low_inv ()					* 
 *	 skparams.c: void mix_height ()					*
 ***********************************************************************/

  low_inv( &ix1, &ix2 );
  setcolor (5, draw_reg, gc);
  setlinestyle (1, 1);
  isobar_nolabel (ix1);

  mix_height( &ix1, &ix2, &ix3, &ix4, &ix5, &ix6, &ix7, 1);
  setcolor (6, draw_reg, gc);
  setlinestyle (2, 1);
  isobar_nolabel (ix1);

  mix_height( &ix1, &ix2, &ix3, &ix4, &ix5, &ix6, &ix7, 0);
  setcolor (7, draw_reg, gc);
  setlinestyle (4, 1);
  isobar_nolabel (ix1);	

/* Draw frame boarder */
  setcolor (1, draw_reg, gc);
  rectangle (0, skv.tlx, skv.tly, skv.brx, skv.bry);

  if (sndgp != NULL)
    {

      /* ----- Plot old sounding if exists ----- */
      setcolor (28, draw_reg, gc);
      if ((overlay_previous == 1) && (sndgp->ovrlev > 0))
	{
	  trace_temp2 (3);
	  trace_dwpt2 (3);
	}

      if (sndgp->numlev > 0)
	{
	  /* ----- Plot Environmental Temperature Data ----- */
	  setcolor (2, draw_reg, gc);
	  trace_temp (sndgp, 3);

	  /* ----- Plot Environmental Dew Point Data ----- */
	  setcolor (3, draw_reg, gc);
	  trace_dwpt (sndgp, 3);

	  /* ----- Plot Environmental Virtual Temperature Data ----- */
	  setcolor (2, draw_reg, gc);
	  trace_vtmp (1);

	  /* ----- Plot Environmental Wetbulb Temperature Data ----- */
	  setcolor (6, draw_reg, gc);
	  setlinestyle (1, 1);
	  trace_wetbulb (1);

	  /* ----- Plot Wind Barbs ----- */
	  setcolor (5, draw_reg, gc);
	  setlinestyle (1, 1);
	  plot_barbs ();

	  /* ----- If Available, plot VVEL profile ----- */
	  vvel_profile ();
	}




      /* ----- Display Skew-T Inset ----- */
      draw_skinset ();

      setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);
      setcolor (1, draw_reg, gc);
      set_font (1);

      sprintf (rtitle, "%s (%s)", sndgp->title, raob_type);
      outgtext (rtitle, skv.tlx, 1);

      update_text_values ();
    }

  XCopyArea (XtDisplay (draw_reg), canvas, XtWindow (draw_reg),
	     gc, 0, 0, xwdth, xhght, 0, 0);
}
예제 #16
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();
}
예제 #17
0
        /*NP*/
void plot_windspeedprofile(void)
        /*************************************************************/
        /*  PLOT_WINDSPEEDPROFILE                                    */
        /*  John Hart  SPC Norman                                    */
        /*                                                           */
        /*  Plots vertical profile of Wind Speeds                    */
        /*************************************************************/
{
	float lasthght;
        float bothgt, tophgt, h, wsp;
        short x1, y1, x2, y2, 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;
        tly = skv.tly;
	wid = 93;
	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);

	/* Plot scale */
        setlinestyle(2, 1);
	set_font(5);
	for (i=20;i<=120;i+=20) {
        	setcolor(8);
		x1 = tlx + (i/1.5);
		x2 = x1;
		y1 = tly + 1;
		y2 = tly + hgt;
              	moveto(x1, y1);
              	lineto(x2, y2);
        	setcolor(1);
		sprintf( st, "%d", i);	
		outgtext(st, x1-3, y2+2);
		}

        /* ----- Plot Label ----- */
        setcolor(1);
	set_font(5);
        outgtext("Wind Speed (kt)", tlx+5, tly+3);
        outgtext("vs Height",  tlx+5, tly+15);


	/* color code to match hodograph layers */
	lasthght = 0;
	setlinestyle(1, 1);
        for (i=0; i<numlvl; i++) 
	{
      		if ((lasthght >= 0) && (lasthght < 3000))
        		{
           		if (qc(sndg[i][wsIndex])) {
                		wsp = sndg[i][wsIndex];
                		x1 = tlx;
                		x2 = tlx + (short)(wsp / 1.5);
                		y2 = pres_to_pix(sndg[i][pIndex]);
                		y1 = y2;
                		setcolor(2);
                		moveto(x1, y1);
                		lineto(x2, y2);
				lasthght = agl(sndg[i][zIndex]);
           			}
		  	}

        	if ((lasthght >= 3000) && (lasthght < 6000))                                              
                	{
                	if (qc(sndg[i][wsIndex])) {
                        	wsp = sndg[i][wsIndex];
                        	x1 = tlx;
                        	x2 = tlx + (short)(wsp / 1.5);
                        	y2 = pres_to_pix(sndg[i][pIndex]);
                        	y1 = y2;
                        	setcolor(3);
                        	moveto(x1, y1);
                        	lineto(x2, y2);
                        	lasthght = agl(sndg[i][zIndex]);
				}
		  	}
        	if ((lasthght >= 6000) && (lasthght < 9000))
                	{
                	if (qc(sndg[i][wsIndex])) {
                        	wsp = sndg[i][wsIndex];
                        	x1 = tlx;
                        	x2 = tlx + (short)(wsp / 1.5);
                        	y2 = pres_to_pix(sndg[i][pIndex]);
                        	y1 = y2;
                        	setcolor(5);
                        	moveto(x1, y1);
                        	lineto(x2, y2);
                        	lasthght = agl(sndg[i][zIndex]);
				}
		  	}
        	if ((lasthght >= 9000) && (lasthght < 12000))
                	{
                	if (qc(sndg[i][wsIndex])) {
                        	wsp = sndg[i][wsIndex];
                        	x1 = tlx;
                        	x2 = tlx + (short)(wsp / 1.5);
                        	y2 = pres_to_pix(sndg[i][pIndex]);
                        	y1 = y2;
                        	setcolor(6);
                        	moveto(x1, y1);
                        	lineto(x2, y2);
                        	lasthght = agl(sndg[i][zIndex]);
				}
		  	}
        	if (lasthght >= 12000)
                	{
                	if (qc(sndg[i][wsIndex])) {
                        	wsp = sndg[i][wsIndex];
                        	x1 = tlx;
                        	x2 = tlx + (short)(wsp / 1.5);
                        	y2 = pres_to_pix(sndg[i][pIndex]);
                        	y1 = y2;
                        	setcolor(29);
                        	moveto(x1, y1);
                        	lineto(x2, y2);
                        	lasthght = agl(sndg[i][zIndex]);
				}
                  	}

	}
        setcliprgn(1, 1, xwdth, xhght);
        copytodisplay();
}
예제 #18
0
	/*NP*/
void plot_thetae(void)
	/*************************************************************/
	/*  PLOT_THETAE                                              */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots vertical profile of Theta-E (sfc-500mb)            */
	/*************************************************************/
{
	float bothgt, tophgt, h, cthe, ix1;
	short x1, y1, x2, y2, i, tlx, tly;
	short pIndex, zIndex, tIndex, tdIndex;
	char st[10];

	pIndex = getParmIndex("PRES");
	zIndex = getParmIndex("HGHT");
	tIndex = getParmIndex("TEMP");
	tdIndex = getParmIndex("DWPT");

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

	/* tlx = hov.brx - 150;
	tly = hov.tly; */

	tlx = hov.tlx + 120;
	tly = hov.bry;

	setcliprgn(tlx, tly, tlx+134, tly+120);
	setcolor(0);
	setlinestyle( 1, 1 );
	rectangle(1,tlx, tly, tlx+134, tly+120); 
	setcolor(1);
	rectangle(0, tlx, tly, tlx+134, tly+120);

	/* ----- Set Layer (AGL) ----- */
	bothgt = 0;
	tophgt = agl(i_hght(500, I_PRES));

	/* ----- Plot Label ----- */
	setcolor(1);
	set_font(4);
	outgtext("Theta-E vs", tlx+55, tly+3);
	outgtext("Pressure",  tlx+55, tly+15);

	/* ----- Plot horizontal legend ----- */
        if (800 < pIndex < 850){
                cthe = (thetae(800, i_temp(800, I_PRES), i_dwpt(800, I_PRES)) +
                        thetae(650, i_temp(650, I_PRES), i_dwpt(650, I_PRES)) +
                        thetae(sndg[sfc()][pIndex], sndg[sfc()][tIndex],
                        sndg[sfc()][tdIndex])) / 3.0;
                        }
        if (750 < pIndex < 800){
                cthe = (thetae(750, i_temp(750, I_PRES), i_dwpt(750, I_PRES)) +
                        thetae(600, i_temp(600, I_PRES), i_dwpt(600, I_PRES)) +
                        thetae(sndg[sfc()][pIndex], sndg[sfc()][tIndex],
                        sndg[sfc()][tdIndex])) / 3.0;
                        }
        if (700 < pIndex < 750){
                cthe = (thetae(700, i_temp(700, I_PRES), i_dwpt(700, I_PRES)) +
                        thetae(500, i_temp(500, I_PRES), i_dwpt(500, I_PRES)) +
                        thetae(sndg[sfc()][pIndex], sndg[sfc()][tIndex],
                        sndg[sfc()][tdIndex])) / 3.0;
                        }
        if (pIndex >= 850){
                cthe = (thetae(850, i_temp(850, I_PRES), i_dwpt(850, I_PRES)) +
                        thetae(700, i_temp(700, I_PRES), i_dwpt(700, I_PRES)) +
                        thetae(sndg[sfc()][pIndex], sndg[sfc()][tIndex],
                        sndg[sfc()][tdIndex])) / 3.0;
                        }
	setcolor(19);
	set_font(5);
	for(h=cthe - 30.0; h<=cthe + 30.0; h += 10) {
	   x1 = (short)(tlx + 60 + ((h-cthe)*2.5));
	   y1 = tly+120;
	   moveto( x1, y1);
	   lineto( x1, y1-5);
	   sprintf(st, "%.0f", h + 273.15);
	   outgtext(st, x1-6, y1-14);
	   }

	/* ----- Plot vertical theta-e profile ----- */
	setlinestyle(1, 2);
	setcolor(2);
	x2 = 999;
        if (sndg[numlvl-1][pIndex] < 500) {
	   for (i=0; sndg[i][pIndex] >= 500; i++) {
	      /*printf ("i = %d,    PRES = %.1f\n", i, sndg[i][pIndex]);*/
	      if (qc(sndg[i][tdIndex])) {
	         x1 = (short)(tlx + 60 + ((thetae(sndg[i][pIndex], 
	              sndg[i][tIndex], sndg[i][tdIndex])-cthe)*2.5));
   	         y1 = vert_coords(agl(sndg[i][zIndex]), tophgt, tly);
	         if(x2 == 999) { x2=x1; y2=y1; }

	         moveto(x1, y1);
	         lineto(x2, y2);

	         x2=x1;
	         y2=y1;
	      }
	   }
	}


	/* ----- Plot Vertical Legend ----- */
	setlinestyle(1, 1);
	setcolor(1);
	set_font(5);
	x2 = 999;
	for(i=1000; i >= 600; i -= 100) {
	   x1 = tlx;
	   y1 = vert_coords(agl(i_hght(i, I_PRES)), tophgt, tly);
	   moveto( x1, y1);
	   lineto( x1+5, y1);
	   sprintf(st, "%d", i);
	   if (i<1000) outgtext(st, x1+6, y1-5);
	}

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

	/* plot theta-e index */
	setcolor(19);
	set_font(4);
	sprintf( st, "TEI = %s", qc2( ThetaE_diff(&ix1), "", 0));
        outgtext( st, tlx + 80, tly + 50);
}
예제 #19
0
	/*NP*/
void plot_vertsrw(void)
	/*************************************************************/
	/*  PLOT_VERTSRW                                             */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots vertical profile of sr-winds (0-9km AGL)           */
	/*************************************************************/
{
	float bothgt, tophgt, h, ix1, ix2, ix3, ix4, h1, h2;
	short x1, y1, x2, y2, tlx, tly, wid;
	char st[40];

	tlx = hov.tlx + 254;
	tly = hov.bry;
	wid = 135;

	setcliprgn( tlx+2, tly+2, tlx+wid+24, tly+wid-15);
	setcolor(0);
	setlinestyle( 1, 1 );
	rectangle( 1,tlx, tly, tlx+wid+27, tly+wid-15); 
	setcolor(1);
	rectangle( 0, tlx, tly, tlx+wid+27, tly+wid-15);

	/* ----- Set Layer (AGL) ----- */
	bothgt = 0;
	tophgt = 16000;

	/* ----- Plot Label ----- */
	set_font(5);
	setcolor(1);
	outgtext( "SR Winds (kt)", tlx + 20, tly + 3 );
	outgtext( "vs Height", tlx + 20, tly + 15 );

	/* ----- Plot height legend ----- */
	setcolor(1);
	for(h=bothgt; h<=tophgt; h += 2000)
	   {
	   x1 = tlx;
	   y1 = vert_coords(h, tophgt, tly);
	   moveto( x1, y1);
	   lineto(x1+5, y1);

	   if(h>0 && h<16000)
	      {
	      sprintf( st, "%d", (int)(h/1000));
	      outgtext( st, x1+5, y1-4 );
	      }
	   }

	/* ----- Plot horizontal legend ----- */
	setcolor(1);
	for(h=0; h<=80; h += 10)
	   {
	   x1 = tlx + (short)(h*2);
	   y1 = tly + wid - 15;
	   moveto( x1, y1);
	   lineto( x1, y1-5);
	   }

       /* ----- Plot vertical dashed line at 15kt ----- */
       setlinestyle(2, 1);
       moveto( tlx + 30, tly);
       lineto( tlx + 30, tly + wid);

       /* ----- Plot vertical dashed line at 40kt ----- */
       setcolor(7);     	
       moveto( tlx + 80, tly);
       lineto( tlx + 80, tly + (wid/2));

       /* ----- Plot vertical dashed line at 15kt ----- */
       moveto( tlx + 140, tly);
       lineto( tlx + 140, tly + (wid/2));


	/* ----- Plot vertical srw profile ----- */
        setlinestyle(1, 2);
	setcolor(2);
	x2 = 999;
	for(h=bothgt; h<=tophgt; h += 250)
	   {
	   sr_wind( i_pres(msl(h)), i_pres(msl(h)), 
			st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
	   x1 = tlx + (short)(ix4*2);
	   y1 = vert_coords(h, tophgt, tly);
	   if(x2 == 999) { x2=x1; y2=y1; }

	   moveto( x1, y1);
	   lineto( x2, y2);

	   x2=x1;
	   y2=y1;
	   }

	/* ----- Plot Mean-Layer SRW value (Sfc-2km) ----- */
	h1 = 0;
	h2 = 2000;
	sr_wind( i_pres(msl(h1)), i_pres(msl(h2)),
			st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
	if(qc(ix4))
	   {
	   x1 = tlx + (short)(ix4*2);
	   y1 = vert_coords(h1, tophgt, tly);
	   y2 = vert_coords(h2, tophgt, tly);
	   setcolor(15);
	   moveto( x1, y1);
	   lineto( x1, y2);
	   }

	/* ----- Plot Mean-Layer SRW value (4-6km) ----- */
	h1 = 4000;
	h2 = 6000;
	sr_wind( i_pres(msl(h1)), i_pres(msl(h2)), st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
	if(qc(ix4))
	   {
	   x1 = tlx + (short)(ix4*2);
	   y1 = vert_coords(h1, tophgt, tly);
	   y2 = vert_coords(h2, tophgt, tly);
	   setcolor(25);
	   moveto( x1, y1);
	   lineto( x1, y2);
	   }

	/* ----- Plot Mean-Layer SRW value (9-11km) ----- */
	h1 = 9000;
	h2 = 11000;
	sr_wind( i_pres(msl(h1)), i_pres(msl(h2)), st_dir, st_spd, &ix1, &ix2, &ix3, &ix4);
	if(qc(ix4))
	   {
	   x1 = tlx + (short)(ix4*2);
	   y1 = vert_coords(h1, tophgt, tly);
	   y2 = vert_coords(h2, tophgt, tly);
	   setcolor(7);
	   moveto( x1, y1);
	   lineto( x1, y2);
	   }

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