Command line executable to convert Marthe Grid file to netCDF
At the installation an executable ncmart is added to PATH and can be used to easily convert
a Marthe grid file to NetCDF format.
nb: the next commands are shell commands, the ‘!’ mark is only here for the python notebook version.
# how to use: print help message
!ncmart -h
usage: ncmart [-h] [--output OUTPUT] [--variable VARIABLE] [--as2d]
[--xyfactor XYFACTOR]
chasim pastp [chasim pastp ...]
Convert a Marthe GridFile to netCDF format.
positional arguments:
chasim pastp Paths to chasim and pastp files are expected
options:
-h, --help show this help message and exit
--output OUTPUT, -o OUTPUT
Output filename. Default is input.nc
--variable VARIABLE, -v VARIABLE
Variable to read, default is None; i.e variable will
be parse from file and ONLY the first variable will be
read.
--as2d, -d Store grid as 2D (or more), default is 1D for space
dimension
--xyfactor XYFACTOR, -x XYFACTOR
Transformation factor for coordinates. Optionnal,
default is 1 (no transformation).
# minimal setup: call ncmart with a grid file and a timestep file
!ncmart chasim_hallue.out hallue.pastp
# print variables headers and dimensions with nco tools
!ncdump -h chasim_hallue.nc
netcdf chasim_hallue {
dimensions:
time = 205 ;
zone = 927 ;
variables:
float charge(time, zone) ;
charge:_FillValue = NaNf ;
string charge:varname = "CHARGE" ;
string charge:units = "m" ;
charge:missing_value = 9999. ;
string charge:standard_name = "water_table_level" ;
string charge:long_name = "groundwater head" ;
float x(zone) ;
x:_FillValue = NaNf ;
string x:units = "m" ;
string x:axis = "X" ;
string x:coverage_content_type = "coordinate" ;
float y(zone) ;
y:_FillValue = NaNf ;
string y:units = "m" ;
string y:axis = "Y" ;
string y:coverage_content_type = "coordinate" ;
float dx(zone) ;
dx:_FillValue = NaNf ;
float dy(zone) ;
dy:_FillValue = NaNf ;
int64 time(time) ;
string time:units = "days since 1995-07-31 00:00:00" ;
string time:calendar = "proleptic_gregorian" ;
int64 zone(zone) ;
// global attributes:
string :conventions = "CF-1.10" ;
string :title = "Modélisation du bassin de la SOMME Nappe_Libre" ;
:marthe_grid_version = 9. ;
string :original_dimensions = "x,y,z [grids]: 53 54 1" ;
string :lon_resolution = "0.5" ;
string :lat_resolution = "0.5" ;
:scale_factor = 1. ;
string :nested_grid = "False" ;
string :extend = "xymin : 596.75 2542.25; xymax: 622.75 2568.75" ;
string :frequency = "30 day(s)" ;
string :period = "1995-2012" ;
string :creation_date = "Created on 2025-03-26T12:54:41Z UTC" ;
string :institution = "BRGM, French Geological Survey, Orléans, France" ;
string :comment = "Hydrogeological model created with MARTHE code (Thiery, D. 2020. Guidelines for MARTHE v7.8 computer code for hydro-systems modelling. report BRGM/RP-69660-FR)." ;
string :resolution_units = "m" ;
string :projection = "epsg:27572" ;
string :domain = "FR-France" ;
}