Changeset 248
- Timestamp:
- 12/09/08 11:29:48
- Files:
-
- obskml/trunk/General/obsKMLSubRoutines.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
obskml/trunk/General/obsKMLSubRoutines.pm
r202 r248 257 257 } 258 258 ####################################################################################################### 259 # Subroutine: CleanString 260 # Takes a string and removes unprintable characters from it. Tries to make sure the string contains 261 # only alpha numerics. 262 ####################################################################################################### 263 sub CleanString #( $strString ) 264 { 265 my $strString = shift @_; 266 my $strClean; 267 $strClean = $strString; 268 $strClean =~ tr/\x80-\xFF//d; 269 $strClean =~ s/\x//; 270 $strClean =~ s/\x00$//; 271 272 return $strClean; 273 } 274 ####################################################################################################### 259 275 # Subroutine: UnitsStringConversion 260 276 # Takes a given units string and converts it into a string that we use internally. … … 267 283 #DWR 4/15/2008 268 284 #Remove any characters we don't want used. I did notice the unicode char "\x" was in some ndbc files. 269 $strFromUOMString =~ tr/\x80-\xFF//d; 270 $strFromUOMString =~ s/\x//; 285 #$strFromUOMString =~ tr/\x80-\xFF//d; 286 #$strFromUOMString =~ s/\x//; 287 #$strFromUOMString =~ s/\x00$//; 288 my $strUOM = CleanString( $strFromUOMString ); 271 289 272 290 #print( "UnitsStringConversion:: XMLLookup: //unit_conversion_list/unit_conversion[\@id=\"$strFromUOMString\"]/units\n"); 273 my $strConversionString = $XMLDoc->findvalue('//unit_conversion_list/unit_conversion[@id="'.$str FromUOMString.'"]/units');291 my $strConversionString = $XMLDoc->findvalue('//unit_conversion_list/unit_conversion[@id="'.$strUOM.'"]/units'); 274 292 if( length( $strConversionString ) ) 275 293 { 276 294 $strConvertedString = $strConversionString; 277 295 } 278 print "Units: $strConvertedString \n";296 #print "UnitsStringConversion::Units: $strConvertedString \n"; 279 297 return $strConvertedString; 280 298 … … 623 641 #Add the child tag to the parent, ObsList. 624 642 $ObsList->appendChild( $Obs ); 643 #print( "obsType: $ObsType value: $hObsList->{elev}{$Elev}{obsType}{$ObsType}{value} uomType: $hObsList->{elev}{$Elev}{obsType}{$ObsType}{uomType}\n" ); 625 644 #DWR v1.1.0.0 626 645 #Each obs has its own row with the observation type, value, and units of measurement. 627 646 $$strDescription = $$strDescription."<tr><td>$ObsType</td><td>$hObsList->{elev}{$Elev}{obsType}{$ObsType}{value}</td><td>$hObsList->{elev}{$Elev}{obsType}{$ObsType}{uomType}</td></tr>"; 647 #print( "KMLAddObsList::strDescription: $$strDescription\n" ); 628 648 } 629 649 }
