plugin_src/data_handler/netcdf.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <netcdf.h>
#include <assert.h>
#include "crusde_api.h"
Include dependency graph for netcdf.c:

Defines

#define NDIMS   4
#define ERRCODE   2
#define ERR(e)   {crusde_error("%s, %d: %s", __FILE__, __LINE__, nc_strerror(e)); }

Functions

const char * get_name ()
const char * get_version ()
const char * get_authors ()
PluginCategory get_category ()
void request_plugins ()
void register_output_fields ()
const char * get_description ()
void run ()
void clear ()
void init ()
 Initialize members that depend on registered values.
void register_parameter ()
void set_model_data (double **data, int dim_x, int dim_y)

Variables

int status
int nc_id = -1
int NLAT
int NLON
int NTIM
int NDIR
int lat_dimid = -1
int lon_dimid = -1
int t_dimid = -1
int dir_dimid = -1
int lat_varid = -1
int lon_varid = -1
int data_varid = -1
int t_varid = -1
int dir_varid = -1
int dimids [NDIMS]
double ** data_out
boolean data_written
char * filename
static const char * netcdf_history = "written by CrusDe\'s netCDF Plugin, direction indices are: "
static const char * netcdf_latitude = "latitude"
static const char * netcdf_longitude = "longitude"
static const char * netcdf_longname = "experiment name"
static const char * netcdf_time = "time"
static const char * netcdf_direction = "direction"
static const char * netcdf_deg_east = "meters_east"
static const char * netcdf_deg_north = "meters_north"
static const char * netcdf_meters = "m"
static const char * netcdf_days = "days"

Detailed Description

This data handler writes CrusDe results to a 4-D netcdf file following the COARDS conventions ( ftp://ftp.unidata.ucar.edu/pub/netcdf/Conventions/COARDS/coards_conventions ). The four dimensions, and so the dimension names, are:

latitude, longitude, time, direction.

This plugin creates a netCDF file with either the filename given in the experiment definition or the default name for output (experiment.nc) on initialization. At each time step the the model results are saved to this file for all directions (x,y,z, other). The file gets deleted during unloading if no data was written.


Define Documentation

#define ERR (  )     {crusde_error("%s, %d: %s", __FILE__, __LINE__, nc_strerror(e)); }

Referenced by clear(), init(), and run().

#define ERRCODE   2
#define NDIMS   4

Referenced by init(), and run().


Function Documentation

void clear (  ) 

Clean-up before this plug-in gets unloaded.

References data_written, ERR, filename, free(), nc_id, and status.

const char* get_authors (  ) 
PluginCategory get_category (  ) 

returns DATAOUT_PLUGIN

References DATAOUT_PLUGIN.

const char* get_description (  ) 
const char* get_name (  ) 
const char* get_version (  ) 
void init (  ) 

Initialize members that depend on registered values.

This function must not be called before register_parameter() unless none of the necessary values depends on parameters provided by the user, which are only set after they have been registered. This function is called some time after register_parameter().

References crusde_get_dimensions(), crusde_get_gridsize(), crusde_get_min_x(), crusde_get_min_y(), crusde_get_out_file(), crusde_get_size_t(), crusde_get_size_x(), crusde_get_size_y(), crusde_stepsize(), data_out, data_varid, dimids, dir_dimid, dir_varid, ERR, filename, lat_dimid, lat_varid, lon_dimid, lon_varid, nc_id, NDIMS, NDIR, netcdf_days, netcdf_deg_east, netcdf_deg_north, netcdf_direction, netcdf_history, netcdf_latitude, netcdf_longitude, netcdf_longname, netcdf_meters, netcdf_time, NLAT, NLON, NTIM, status, t_dimid, and t_varid.

void register_output_fields (  ) 

empty

void register_parameter (  ) 
void request_plugins (  ) 

empty

void run (  ) 
void set_model_data ( double **  data,
int  dim_x,
int  dim_y 
)

set pointer to modelling result

References data_out.


Variable Documentation

double** data_out

Referenced by init(), run(), and set_model_data().

int data_varid = -1

Referenced by init(), and run().

boolean data_written

Referenced by clear(), and run().

int dimids[NDIMS]

Referenced by init().

int dir_dimid = -1

Referenced by init().

int dir_varid = -1

Referenced by init().

char* filename
int lat_dimid = -1

Referenced by init().

int lat_varid = -1

Referenced by init().

int lon_dimid = -1

Referenced by init().

int lon_varid = -1

Referenced by init().

int nc_id = -1

Referenced by clear(), init(), and run().

int NDIR

Referenced by init(), and run().

const char* netcdf_days = "days" [static]

Referenced by init().

const char* netcdf_deg_east = "meters_east" [static]

Referenced by init().

const char* netcdf_deg_north = "meters_north" [static]

Referenced by init().

const char* netcdf_direction = "direction" [static]

Referenced by init().

const char* netcdf_history = "written by CrusDe\'s netCDF Plugin, direction indices are: " [static]

Referenced by init().

const char* netcdf_latitude = "latitude" [static]

Referenced by init().

const char* netcdf_longitude = "longitude" [static]

Referenced by init().

const char* netcdf_longname = "experiment name" [static]

Referenced by init().

const char* netcdf_meters = "m" [static]

Referenced by init().

const char* netcdf_time = "time" [static]

Referenced by init().

int NLAT

Referenced by init(), and run().

int NLON

Referenced by init(), and run().

int NTIM

Referenced by init().

int status

Referenced by clear(), init(), and run().

int t_dimid = -1

Referenced by init().

int t_varid = -1

Referenced by init().


Generated on Tue Feb 16 15:18:27 2010 for CrusDe by  doxygen 1.6.1-20091004