Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/hrrr_to_kmz/hrrr_to_kmz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ void setSurfaceGrids( const std::string &wxModelFileName, const int &timeBandIdx

std::string srcWkt;
srcWkt = srcDS->GetProjectionRef();
if(srcWkt.empty())
{
throw std::runtime_error("Could not get projection from forecast file, bad forecast file.");
}

OGRSpatialReference oSRS, *poLatLong;
oSRS.importFromWkt(srcWkt.c_str());
Expand Down Expand Up @@ -432,8 +436,9 @@ void setSurfaceGrids( const std::string &wxModelFileName, const int &timeBandIdx
GRA_NearestNeighbour,
1.0, psWarpOptions );

if (wrpDS == NULL) {
throw std::runtime_error("Warp operation failed!");
if(wrpDS == NULL)
{
throw std::runtime_error("Could not warp the forecast file, possibly non-uniform grid.");
}

std::vector<std::string> varList = getVariableList();
Expand Down Expand Up @@ -614,15 +619,15 @@ void writeWxModelGrids( const std::string &outputPath, const boost::local_time::
}

ninjaKmlFiles.setLegendFile( CPLFormFilename(outputPath.c_str(), rootname.c_str(), "bmp") );
ninjaKmlFiles.setSpeedGrid(speedInitializationGrid_wxModel, outputSpeedUnits);
std::string dateTimewxModelLegFileTemp = CPLFormFilename(outputPath.c_str(), (rootname+"_date_time").c_str(), "bmp");
ninjaKmlFiles.setDateTimeLegendFile(dateTimewxModelLegFileTemp, forecastTime);
ninjaKmlFiles.setSpeedGrid(speedInitializationGrid_wxModel, outputSpeedUnits);
ninjaKmlFiles.setAngleFromNorth(angleFromNorth);
ninjaKmlFiles.setDirGrid(dirInitializationGrid_wxModel);

//ninjaKmlFiles.setLineWidth(1.0); // input.googLineWidth value
ninjaKmlFiles.setLineWidth(3.0); // input.wxModelGoogLineWidth value
std::string dateTimewxModelLegFileTemp = CPLFormFilename(outputPath.c_str(), (rootname+"_date_time").c_str(), "bmp");
ninjaKmlFiles.setTime(forecastTime);
ninjaKmlFiles.setDateTimeLegendFile(dateTimewxModelLegFileTemp, forecastTime);
ninjaKmlFiles.setWxModel(forecastIdentifier, forecastTime);

// default values for input.wxModelGoogSpeedScaling/input.googSpeedScaling,input.googColor,input.googVectorScale are KmlVector::equal_interval,"default",false respectively
Expand Down
3 changes: 3 additions & 0 deletions src/ninja/wrf3dInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ void wrf3dInitialization::set3dGrids( WindNinjaInputs &input, Mesh const& mesh )
psWarpOptions->papszWarpOptions = CSLSetNameValue(psWarpOptions->papszWarpOptions, "INIT_DEST", boost::lexical_cast<std::string>(dfNoData).c_str());
}

// set the dataset projection
int rc = srcDS->SetProjection(projString.c_str());

wrpDS = (GDALDataset*) GDALAutoCreateWarpedVRT( srcDS, srcWKT,
dstWkt.c_str(),
GRA_NearestNeighbour,
Expand Down
Loading