static void cmdedit( void ) { double pt[ 3 ], r[ 3 ], c[ 3 ], h, xrot, yrot, rot; int i, j, n, vi, snum; csSetLayer( layer1 ); csMergePoints( 0 ); if ( atom_type == ATYPE_SPHERE ) { mgMonitorBegin( "Sphere Atoms", NULL, seqlen ); csSetLayer( layer1 ); for ( j = 0; j < seqlen; j++ ) { n = atom_count( seq[ j ] ); for ( i = 0; i < n; i++ ) { atom_info( seq[ j ], i, &vi, &snum ); vert_coords( seq[ j ], vi, pt ); transform_point( j * 3.4, j * 36.0, pt ); r[ 0 ] = r[ 1 ] = r[ 2 ] = atom_radius[ snum ]; csSetDefaultSurface( surface_name( snum )); csMakeBall( r, atom_nsides, atom_nsegments, pt ); } if ( userabort = mgMonitorStep( 1 )) break; } mgMonitorDone(); } if ( bond_type == BTYPE_CYLINDER && !userabort ) { mgMonitorBegin( "Cylinder Bonds", NULL, seqlen ); for ( j = 0; j < seqlen; j++ ) { n = bond_count( seq[ j ] ); for ( i = 0; i < n; i++ ) { bond_coords( seq[ j ], i, pt, &h, &xrot, &yrot, &snum ); pt[ 1 ] += 3.4 * j; csSetLayer( layer2 ); csSetDefaultSurface( surface_name( snum )); r[ 0 ] = r[ 1 ] = r[ 2 ] = bond_radius; c[ 0 ] = c[ 2 ] = 0.0; c[ 1 ] = h / 2.0; csMakeDisc( r, h, 0, "Y", bond_nsides, bond_nsegments, c ); csRotate( xrot, "X", NULL ); csRotate( yrot, "Y", NULL ); csMove( pt ); rot = 36 * j; csRotate( rot, "Y", NULL ); csCut(); csSetLayer( layer1 ); csPaste(); } if ( userabort = mgMonitorStep( 1 )) break; } mgMonitorDone(); } }
/*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); }
static void meshedit( void ) { double pt[ 3 ]; LWPntID id[ 57 ], vid[ 2 ]; int i, j, k, n, v[ 9 ], snum; csMeshBegin( 0, 0, OPSEL_GLOBAL ); if ( bond_type == BTYPE_LINE ) { mgMonitorBegin( "Line Bonds", NULL, seqlen ); for ( j = 0; j < seqlen; j++ ) { n = point_count( seq[ j ] ); for ( i = 0; i < n; i++ ) { vert_coords( seq[ j ], i, pt ); transform_point( j * 3.4, j * 36.0, pt ); id[ i ] = meAddPoint( pt ); } n = bond_count( seq[ j ] ); for ( i = 0; i < n; i++ ) { bond_info( seq[ j ], i, &v[ 0 ], &v[ 1 ], &snum ); vid[ 0 ] = id[ v[ 0 ]]; vid[ 1 ] = id[ v[ 1 ]]; meAddPoly( LWPOLTYPE_FACE, NULL, surface_name( snum ), 2, vid ); } if ( userabort = mgMonitorStep( 1 )) break; } mgMonitorDone(); } if ( atom_type == ATYPE_POINT && !userabort ) { mgMonitorBegin( "Point Atoms", NULL, seqlen ); for ( j = 0; j < seqlen; j++ ) { n = atom_count( seq[ j ] ); for ( i = 0; i < n; i++ ) { atom_info( seq[ j ], i, &v[ 0 ], &snum ); vert_coords( seq[ j ], v[ 0 ], pt ); transform_point( j * 3.4, j * 36.0, pt ); id[ 0 ] = meAddPoint( pt ); meAddPoly( LWPOLTYPE_FACE, NULL, surface_name( snum ), 1, &id[ 0 ] ); } if ( userabort = mgMonitorStep( 1 )) break; } mgMonitorDone(); } else if ( atom_type == ATYPE_DODEC && !userabort ) { mgMonitorBegin( "Dodecahedron Atoms", NULL, seqlen ); for ( j = 0; j < seqlen; j++ ) { n = atom_count( seq[ j ] ); for ( i = 0; i < n; i++ ) { atom_info( seq[ j ], i, &v[ 0 ], &snum ); vert_coords( seq[ j ], v[ 0 ], pt ); transform_point( j * 3.4, j * 36.0, pt ); dodec( pt, atom_radius[ snum ], surface_name( snum )); } if ( userabort = mgMonitorStep( 1 )) break; } mgMonitorDone(); } if ( do_plates && !userabort ) { mgMonitorBegin( "Base Plates", NULL, seqlen ); for ( j = 0; j < seqlen; j++ ) { for ( i = 0; i < 2; i++ ) { plate_info( seq[ j ], i, &n, v, &snum ); for ( k = 0; k < n; k++ ) { vert_coords( seq[ j ], v[ k ], pt ); transform_point( j * 3.4, j * 36.0, pt ); id[ k ] = meAddPoint( pt ); } meAddPoly( LWPOLTYPE_FACE, NULL, surface_name( snum ), n, id ); } if ( userabort = mgMonitorStep( 1 )) break; } mgMonitorDone(); } csMeshDone( EDERR_NONE, 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(); }