add gitignore

This commit is contained in:
张壹 2021-04-19 09:39:09 +08:00
parent df80d03bd7
commit 7428b5a6f0
7 changed files with 16 additions and 16 deletions

View File

View File

@ -17,7 +17,7 @@
*/
#include <iostream>
#include <netcdfcpp.h>
#include "../lib/netcdfcpp.h"
using namespace std;

View File

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

View File

@ -18,7 +18,7 @@
#include <iostream>
#include <cstring>
#include <netcdfcpp.h>
#include "../lib/netcdfcpp.h"
using namespace std;

View File

@ -17,7 +17,7 @@
*/
#include <iostream>
#include <netcdfcpp.h>
#include "../lib/netcdfcpp.h"
using namespace std;

View File

@ -15,7 +15,7 @@
*/
#include <iostream>
#include <netcdfcpp.h>
#include "../lib/netcdfcpp.h"
using namespace std;

View File

@ -16,7 +16,7 @@
*/
#include <iostream>
#include <netcdfcpp.h>
#include "../lib/netcdfcpp.h"
using namespace std;