PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
Classes | Namespaces | Functions
io_helpers.cc File Reference
#include <cassert>
#include <cmath>
#include <cstddef>
#include <memory>
#include <array>
#include <vector>
#include "pism/util/ConfigInterface.hh"
#include "pism/util/Context.hh"
#include "pism/util/Grid.hh"
#include "pism/util/Logger.hh"
#include "pism/util/Profiling.hh"
#include "pism/util/Time.hh"
#include "pism/util/VariableMetadata.hh"
#include "pism/util/error_handling.hh"
#include "pism/util/interpolation.hh"
#include "pism/util/io/File.hh"
#include "pism/util/io/IO_Flags.hh"
#include "pism/util/io/LocalInterpCtx.hh"
#include "pism/util/io/io_helpers.hh"
#include "pism/util/pism_utilities.hh"
#include "pism/util/projection.hh"

Go to the source code of this file.

Classes

struct  pism::io::StartCountInfo
 

Namespaces

 pism
 
 pism::io
 Input and output code (NetCDF wrappers, etc)
 

Functions

static void pism::io::regrid (const Grid &grid, const LocalInterpCtx &lic, double const *input_array, double *output_array)
 Bi-(or tri-)linear interpolation. More...
 
static StartCountInfo pism::io::compute_start_and_count (std::vector< AxisType > &dim_types, std::array< int, 4 > start_in, std::array< int, 4 > count_in)
 
void pism::io::define_dimension (const File &file, unsigned long int length, const VariableMetadata &metadata)
 Define a dimension and the associated coordinate variable. Set attributes. More...
 
void pism::io::define_time (const File &file, const Context &ctx)
 Prepare a file for output. More...
 
void pism::io::define_time (const File &file, const std::string &name, const std::string &calendar, const std::string &units, units::System::Ptr unit_system)
 
void pism::io::append_time (const File &file, const Config &config, double time_seconds)
 Prepare a file for output. More...
 
void pism::io::append_time (const File &file, const std::string &name, double value)
 Append to the time dimension. More...
 
static void pism::io::define_dimensions (const SpatialVariableMetadata &var, const Grid &grid, const File &file)
 Define dimensions a variable depends on. More...
 
static void pism::io::write_dimension_data (const File &file, const std::string &name, const std::vector< double > &data)
 
void pism::io::write_dimensions (const SpatialVariableMetadata &var, const Grid &grid, const File &file)
 
static bool pism::io::use_transposed_io (std::vector< AxisType > dimension_types)
 
static std::vector< AxisType > pism::io::dimension_types (const File &file, const std::string &var_name, std::shared_ptr< units::System > unit_system)
 
static void pism::io::read_distributed_array (const File &file, const Grid &grid, const std::string &var_name, unsigned int z_count, unsigned int t_start, double *output)
 Read an array distributed according to the grid. More...
 
static std::vector< double > pism::io::read_for_interpolation (const File &file, const std::string &variable_name, const Grid &internal_grid, const LocalInterpCtx &lic)
 
void pism::io::define_spatial_variable (const SpatialVariableMetadata &metadata, const Grid &grid, const File &file, io::Type default_type)
 Define a NetCDF variable corresponding to a VariableMetadata object. More...
 
void pism::io::read_spatial_variable (const SpatialVariableMetadata &variable, const Grid &grid, const File &file, unsigned int time, double *output)
 Read a variable from a file into an array output. More...
 
void pism::io::write_spatial_variable (const SpatialVariableMetadata &metadata, const Grid &grid, const File &file, const double *input)
 Write a double array to a file. More...
 
static void pism::io::check_grid_overlap (const grid::InputGridInfo &input, const Grid &internal, const std::vector< double > &z_internal)
 
void pism::io::check_input_grid (const grid::InputGridInfo &input_grid, const Grid &internal_grid, const std::vector< double > &internal_z_levels)
 Check that x, y, and z coordinates of the input grid are strictly increasing. More...
 
void pism::io::regrid_spatial_variable (SpatialVariableMetadata &variable, const Grid &internal_grid, const LocalInterpCtx &lic, const File &file, double *output)
 Regrid from a NetCDF file into a distributed array output. More...
 
void pism::io::define_timeseries (const VariableMetadata &var, const std::string &dimension_name, const File &file, io::Type nctype)
 Define a NetCDF variable corresponding to a time-series. More...
 
void pism::io::read_timeseries (const File &file, const VariableMetadata &metadata, const Logger &log, std::vector< double > &data)
 Read a time-series variable from a NetCDF file to a vector of doubles. More...
 
void pism::io::write_timeseries (const File &file, const VariableMetadata &metadata, size_t t_start, const std::vector< double > &data)
 Write a time-series data to a file. More...
 
void pism::io::define_time_bounds (const VariableMetadata &var, const std::string &dimension_name, const std::string &bounds_name, const File &file, io::Type nctype)
 
void pism::io::read_time_bounds (const File &file, const VariableMetadata &metadata, const Logger &log, std::vector< double > &data)
 
void pism::io::write_time_bounds (const File &file, const VariableMetadata &metadata, size_t t_start, const std::vector< double > &data)
 
void pism::io::read_time_info (const Logger &log, std::shared_ptr< units::System > unit_system, const File &file, const std::string &time_name, const std::string &time_units, std::vector< double > &times, std::vector< double > &bounds)
 
bool pism::io::file_exists (MPI_Comm com, const std::string &filename)
 
void pism::io::read_attributes (const File &file, const std::string &variable_name, VariableMetadata &variable)
 
void pism::io::write_attributes (const File &file, const VariableMetadata &variable, io::Type nctype)
 Write variable attributes to a NetCDF file. More...
 
void pism::io::read_valid_range (const File &file, const std::string &name, VariableMetadata &variable)
 Read the valid range information from a file. More...
 
std::string pism::io::time_dimension (units::System::Ptr unit_system, const File &file, const std::string &variable_name)
 
void pism::io::move_if_exists (MPI_Comm com, const std::string &file_to_move, int rank_to_use)
 Moves the file aside (file.nc -> file.nc~). More...
 
void pism::io::remove_if_exists (MPI_Comm com, const std::string &file_to_remove, int rank_to_use)
 Check if a file is present are remove it. More...