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] [--version]
[grid timesteps ...]
Convert a Marthe GridFile to netCDF format.
positional arguments:
grid timesteps Paths to grid and timesteps 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 (field) to read, default is None: i.e
variable will be parsed from file and ONLY the first
variable will be read. Pass 'all' to get all
variables.
--as2d, -d Store grid as 2D (or more), default is 1D for space
dimension
--xyfactor XYFACTOR, -x XYFACTOR
Transformation factor for coordinates. Optional,
default is 1 (no transformation).
--version, -V Show version and exit
gridmarthe Copyright (C) 2025 BRGM.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, see GNU General Public Lisence v3 for copying.
# minimal setup: call ncmart with a grid file and a timestep file
# this will write the output with input filename and 'nc' extension
!ncmart ./data/chasim_hallue.out ./data/hallue.pastp
# print variables headers and dimensions with netcdf/nco tools
!ncdump -h ./data/chasim_hallue.nc
netcdf chasim_hallue {
dimensions:
time = 205 ;
zone = 927 ;
variables:
double charge(time, zone) ;
charge:_FillValue = NaN ;
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" ;
int zone(zone) ;
int izone(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 :period = "1995-2012" ;
string :frequency = "30 day(s)" ;
string :creation_date = "Created on 2025-12-09T15:47:09Z 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 codefor hydro-systems modelling. report BRGM/RP-69660-FR)." ;
string :resolution_units = "m" ;
string :projection = "epsg:27572" ;
string :domain = "FR-France" ;
}