add gitignore
This commit is contained in:
parent
df80d03bd7
commit
7428b5a6f0
0
src/.gitignore → .gitignore
vendored
0
src/.gitignore → .gitignore
vendored
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <netcdfcpp.h>
|
#include "../lib/netcdfcpp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <netcdfcpp.h>
|
#include "../lib/netcdfcpp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -69,14 +69,14 @@ int main()
|
|||||||
// handling to the calling program. In the case of this example, we
|
// handling to the calling program. In the case of this example, we
|
||||||
// just exit with an NC_ERR error code.
|
// just exit with an NC_ERR error code.
|
||||||
NcError err(NcError::verbose_nonfatal);
|
NcError err(NcError::verbose_nonfatal);
|
||||||
|
|
||||||
// Create the file.
|
// Create the file.
|
||||||
NcFile dataFile("pres_temp_4D.nc", NcFile::Replace);
|
NcFile dataFile("pres_temp_4D.nc", NcFile::Replace);
|
||||||
|
|
||||||
// Check to see if the file was created.
|
// Check to see if the file was created.
|
||||||
if(!dataFile.is_valid())
|
if(!dataFile.is_valid())
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
|
|
||||||
// Define the dimensions. NetCDF will hand back an ncDim object for
|
// Define the dimensions. NetCDF will hand back an ncDim object for
|
||||||
// each.
|
// each.
|
||||||
NcDim *lvlDim, *latDim, *lonDim, *recDim;
|
NcDim *lvlDim, *latDim, *lonDim, *recDim;
|
||||||
@ -87,16 +87,16 @@ int main()
|
|||||||
if (!(lonDim = dataFile.add_dim("longitude", NLON)))
|
if (!(lonDim = dataFile.add_dim("longitude", NLON)))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
// Add an unlimited dimension...
|
// Add an unlimited dimension...
|
||||||
if (!(recDim = dataFile.add_dim("time")))
|
if (!(recDim = dataFile.add_dim("time", NREC)))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
|
|
||||||
// Define the coordinate variables.
|
// Define the coordinate variables.
|
||||||
NcVar *latVar, *lonVar;
|
NcVar *latVar, *lonVar;
|
||||||
if (!(latVar = dataFile.add_var("latitude", ncFloat, latDim)))
|
if (!(latVar = dataFile.add_var("latitude", ncFloat, latDim)))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
if (!(lonVar = dataFile.add_var("longitude", ncFloat, lonDim)))
|
if (!(lonVar = dataFile.add_var("longitude", ncFloat, lonDim)))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
|
|
||||||
// Define units attributes for coordinate vars. This attaches a
|
// Define units attributes for coordinate vars. This attaches a
|
||||||
// text attribute to each of the coordinate variables, containing
|
// text attribute to each of the coordinate variables, containing
|
||||||
// the units.
|
// the units.
|
||||||
@ -104,7 +104,7 @@ int main()
|
|||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
if (!lonVar->add_att("units", "degrees_east"))
|
if (!lonVar->add_att("units", "degrees_east"))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
|
|
||||||
// Define the netCDF variables for the pressure and temperature
|
// Define the netCDF variables for the pressure and temperature
|
||||||
// data.
|
// data.
|
||||||
NcVar *presVar, *tempVar;
|
NcVar *presVar, *tempVar;
|
||||||
@ -114,19 +114,19 @@ int main()
|
|||||||
if (!(tempVar = dataFile.add_var("temperature", ncFloat, recDim,
|
if (!(tempVar = dataFile.add_var("temperature", ncFloat, recDim,
|
||||||
lvlDim, latDim, lonDim)))
|
lvlDim, latDim, lonDim)))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
|
|
||||||
// Define units attributes for data variables.
|
// Define units attributes for data variables.
|
||||||
if (!presVar->add_att("units", "hPa"))
|
if (!presVar->add_att("units", "hPa"))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
if (!tempVar->add_att("units", "celsius"))
|
if (!tempVar->add_att("units", "celsius"))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
|
|
||||||
// Write the coordinate variable data to the file.
|
// Write the coordinate variable data to the file.
|
||||||
if (!latVar->put(lats, NLAT))
|
if (!latVar->put(lats, NLAT))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
if (!lonVar->put(lons, NLON))
|
if (!lonVar->put(lons, NLON))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
|
|
||||||
// Write the pretend data. This will write our surface pressure and
|
// Write the pretend data. This will write our surface pressure and
|
||||||
// surface temperature data. The arrays only hold one timestep
|
// surface temperature data. The arrays only hold one timestep
|
||||||
// worth of data. We will just rewrite the same data for each
|
// worth of data. We will just rewrite the same data for each
|
||||||
@ -139,7 +139,7 @@ int main()
|
|||||||
if (!tempVar->put_rec(&temp_out[0][0][0], rec))
|
if (!tempVar->put_rec(&temp_out[0][0][0], rec))
|
||||||
return NC_ERR;
|
return NC_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The file is automatically closed by the destructor. This frees
|
// The file is automatically closed by the destructor. This frees
|
||||||
// up any internal netCDF resources associated with the file, and
|
// up any internal netCDF resources associated with the file, and
|
||||||
// flushes any buffers.
|
// flushes any buffers.
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <netcdfcpp.h>
|
#include "../lib/netcdfcpp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <netcdfcpp.h>
|
#include "../lib/netcdfcpp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <netcdfcpp.h>
|
#include "../lib/netcdfcpp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <netcdfcpp.h>
|
#include "../lib/netcdfcpp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user