#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <netcdf.h>
#include <assert.h>
#include "crusde_api.h"
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" |
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 ERR | ( | e | ) | {crusde_error("%s, %d: %s", __FILE__, __LINE__, nc_strerror(e)); } |
#define ERRCODE 2 |
void clear | ( | ) |
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 | ( | ) |
empty
void request_plugins | ( | ) |
empty
void run | ( | ) |
does the writing to the file
References crusde_get_dimensions(), crusde_info(), crusde_model_step(), data_out, data_varid, data_written, ERR, filename, k, l, n, nc_id, NDIMS, NDIR, NLAT, NLON, and status.
void set_model_data | ( | double ** | data, | |
int | dim_x, | |||
int | dim_y | |||
) |
set pointer to modelling result
References data_out.
double** data_out |
Referenced by init(), run(), and set_model_data().
int data_varid = -1 |
boolean data_written |
char* filename |
Referenced by clear(), PluginManager::deleteEntry(), 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().