diff --git a/code_roscop.csv b/code_roscop.csv new file mode 100644 index 0000000000000000000000000000000000000000..9037ccaa0c8971f8ab20f0fbd201837d903c69e7 --- /dev/null +++ b/code_roscop.csv @@ -0,0 +1,71 @@ +key;types;long_name;standard_name;units;conventions;coordinates;positive;valid_min;valid_max;format;_FillValue;axis;resolution;comment;default_value;flag_values;flag_meanings;reference;coordinate_reference_frame; +string;string;string;string;string;string;string;string;numeric;numeric;string;numeric;string;numeric;string;numeric;string;string;string;string; +PRLF;int32;profile number;;1;;;;;;%4d;99999;;;Station number, a station could be have more than one cast;;;;;; +PROFILE;int32;profile number;;1;;;;;;%4d;99999;;;Station number, a station could be have more than one cast;;;;;; +LATITUDE;float32;latitude of measurement;latitude;degrees_north;;;;;;;;Y;;;;;;WGS84;urn:ogc:crs:EPSG::4326; +LONGITUDE;float32;longitude of measurement;longitude;degrees_east;;;;;;;;X;;;;;;WGS84;urn:ogc:crs:EPSG::4327; +TIME;float64;time of measurement;time;days since 1950-01-01T00:00:00Z;Relative julian days with decimal part (as parts of the day);;;0;90000;%6.6d;;T;;;;;;;; +ETDD;float32;ellapsed time;;1;;;;0;90000;%9.5f;;;;;;;;;; +DEPH;float32;depth of measurement;depth;meter;;;down;0;9000;%7.2f;1E+36;Z;;;;;;;urn:ogc:crs:EPSG::5831; +DEPTH;float32;depth of measurement;depth;meter;;;down;0;9000;%7.2f;1E+36;Z;;;;;;;urn:ogc:crs:EPSG::5831; +PRES;float32;sea water pressure;sea_water_pressure;decibar;;TIME DEPTH LATITUDE LONGITUDE;;0;9000;%7.2f;1E+36;;;Pressure (dbar) of the measurement ;;;;;; +TEMP;float32;sea water temperature;sea_water_temperature;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;Ocean temperature in Degrees Celsius ;;;;;; +PSAL;float32;practical salinity;sea_water_salinity ;1;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;Ocean practical salinity (PSS-78);;;;;; +CNDC;float32;electrical conductivity;;mS/cm;;TIME DEPTH LATITUDE LONGITUDE;;30;70;%6.3f;1E+36;;0.002;;;;;;; +DOX1;float32;dissolved oxygen;volume_fraction_of_oxygen_in_sea_water;ml/l;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%5.3f;1E+36;;0.001;Ocean oxygen in ml per liter;;;;;; +DOX2;float32;dissolved oxygen;moles_of_oxygen_per_unit_mass_in_sea_water;micromole/kg;;TIME DEPTH LATITUDE LONGITUDE;;0;450;%7.3f;1E+36;;0.001;Ocean oxygen in micromole by kg;;;;;; +DENS;float32;density;sea_water_density;kg/m3;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;Ocean density;;;;;; +SVEL;float32;sound velocity;speed_of_sound_in_sea_water;meter/second;;TIME DEPTH LATITUDE LONGITUDE;;1350;1600;%7.2f;1E+36;;0.001;Ocean sound velocity;;;;;; +DRYT;float32;air temperature;air_temperature;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;Air temperature;;;;;; +WMSP;float32;wind speed - max aver per 2 mn;wind_speed;meter/second;;TIME DEPTH LATITUDE LONGITUDE;;0;200;%6.3f;1E+36;;0.001;Horizontal wind speed;;;;;; +WDIR;float32;wind direction rel. true north;wind_to_direction;degree;;TIME DEPTH LATITUDE LONGITUDE;;0;360;%5.1f;1E+36;;0.001;Horizontal wind speed;;;;;; +ATMS;float32;atmospheric pressure - sea lev;air_pressure_at_sea_level;hectoPascal;;TIME DEPTH LATITUDE LONGITUDE;;940;1030;%8.3f;1E+36;;0.001;Atmospheric pressure at sea level;;;;;; +RELH;float32;relative humidity;relative_humidity;%;;TIME DEPTH LATITUDE LONGITUDE;;0;100;%6.1f;1E+36;;0.001;Relative humidity;;;;;; +NSCT;float32;current north component;;cm/second;;TIME DEPTH LATITUDE LONGITUDE;;-100;100;%7.3f;1E+36;;0.01; Current north;;;;;; +EWCT;float32;current east component;;cm/second;;TIME DEPTH LATITUDE LONGITUDE;;-100;100;%7.3f;1E+36;;0.02;Current east;;;;;; +SSJT;float32;sea surface water jacket temperature;sea_water_temperature;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;Ocean temperature;;;;;; +SSTP;float32;sea surface water temperature;sea_water_temperature;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;Sea surface Ocean temperature;;;;;; +SSPS;float32;sea surface practical salinity;sea_water_salinity ;pss;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;Ocean salinity;;;;;; +PCO2;float32;co2 part. pres in dry/wet gas;;microatmosphere;;TIME DEPTH LATITUDE LONGITUDE;;100;700;%7.3f;1E+36;;0.001;;;;;;; +FLU2;float32;fluorescence;;milligram/m3;;TIME DEPTH LATITUDE LONGITUDE;;0;1;%8.4f;1E+36;;0.001;;;;;;; +TUR1;float32;light diffusion coefficient;;m-1;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%6.3f;1E+36;;0.001;;;;;;; +TUR2;float32;light attenuation coefficient;;m-1;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%6.3f;1E+36;;0.001;;;;;;; +TUR3;float32;light transmission;;%;;TIME DEPTH LATITUDE LONGITUDE;;0;100;%6.2f;1E+36;;0.001;;;;;;; +LGH3;float32;light irradiance corrected par;;micromole photon/(m2.s);;TIME DEPTH LATITUDE LONGITUDE;;0;3000;%8.3f;1E+36;;0.001;;;;;;; +LGHT;float32;light irradiance immerged par;;micromole photon/(m2.s);;TIME DEPTH LATITUDE LONGITUDE;;0;4000;%8.3f;1E+36;;0.001;;;;;;; +LGH3;float32;light irradiance corrected par;;micromole photon/(m2.s);;TIME DEPTH LATITUDE LONGITUDE;;0;3000;%8.3f;1E+36;;0.001;;;;;;; +LGH4;float32;light irradiance surface par;;micromole photon/(m2.s);;TIME DEPTH LATITUDE LONGITUDE;;0;3000;%8.3f;1E+36;;0.001;;;;;;; +LGH5;float32;immerged/surf irradiance ratio;;%;;TIME DEPTH LATITUDE LONGITUDE;;0;100;%6.2f;1E+36;;0.01;;;;;;; +NUMP;float32;number of particles;;number/m3;;TIME DEPTH LATITUDE LONGITUDE;;0;999999;%9.0f;1E+36;;0.001;;;;;;; +LINC;float32;long wave incoming radiation;;milligram/m3;;TIME DEPTH LATITUDE LONGITUDE;;-500;500;%+5.1f;1E+36;;0.1;;;;;;; +SSJT;float32;sea surface water jacket temperature;;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;-1.5;38;%6.3f;1E+36;;0.001;;;;;;; +DAYD;float32;decimal julian day time origin 0;;1;;TIME DEPTH LATITUDE LONGITUDE;;0.0;3660.0;%9.5f;1E+36;;0.001;;;;;;; +TE01;float32;sea temperature primary sensor;;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;-2;32;%6.3f;1E+36;;0.001;;;;;;; +TE02;float32;sea temperature secondary sensor;;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;-2;32;%6.3f;1E+36;;0.001;;;;;;; +PSA1;float32;practical salinity primary sensor;;pss;;TIME DEPTH LATITUDE LONGITUDE;;33;37;%6.3f;1E+36;;0.001;;;;;;; +PSA2;float32;practical salinity secondary sensor;;pss;;TIME DEPTH LATITUDE LONGITUDE;;33;37;%6.3f;1E+36;;0.001;;;;;;; +CND1;float32;electrical conductivity primary sensor;;mho/meter;;TIME DEPTH LATITUDE LONGITUDE;;3;7;%5.3f;1E+36;;0.001;;;;;;; +CND2;float32;electrical conductivity secondary sensor;;mho/meter;;TIME DEPTH LATITUDE LONGITUDE;;3;7;%5.3f;1E+36;;0.001;;;;;;; +DO11;float32;dissolved oxygen primary sensor;;ml/l;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%5.2f;1E+36;;0.001;;;;;;; +DO21;float32;dissolved oxygen secondary sensor;;ml/l;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%5.2f;1E+36;;0.001;;;;;;; +DO12;float32;dissolved oxygen primary sensor;;micromole/kg;;TIME DEPTH LATITUDE LONGITUDE;;0;450;%7.3f;1E+36;;0.001;;;;;;; +DO22;float32;dissolved oxygen secondary sensor;;micromole/kg;;TIME DEPTH LATITUDE LONGITUDE;;0;450;%7.3f;1E+36;;0.001;;;;;;; +DOV1;float32;dissolved oxygen primary sensor voltage;;V;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%6.4f;1E+36;;0.001;;;;;;; +DOV2;float32;dissolved oxygen secondary sensor voltage;;V;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%6.4f;1E+36;;0.001;;;;;;; +DVT1;float32;dissolved oxygen primary sensor dv/dt;;dv/dt;;TIME DEPTH LATITUDE LONGITUDE;;-1;1;%+7.5f;1E+36;;0.001;;;;;;; +DVT2;float32;dissolved oxygen secondary sensor dv/dt;;dv/dt;;TIME DEPTH LATITUDE LONGITUDE;;-1;1;%+7.5f;1E+36;;0.002;;;;;;; +NTIW;float32;nitrite (no2-n) ;moles_of_nitrite_per_unit_mass_in_sea_water;micromole/kg;;TIME DEPTH LATITUDE LONGITUDE;;0;100;%7.3f;1E+36;;0.001;;;;;;; +NTRI;float32;nitrite (no2-n) ;moles_concentration_of_nitrite_in_sea_water;millimole/m3;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%6.3f;1E+36;;0.001;;;;;;; +NTAW;float32;nitrate (no3-n) ;moles_of_nitrate_per_unit_mass_in_sea_water;micromole/kg;;TIME DEPTH LATITUDE LONGITUDE;;0;90;%5.2f;1E+36;;0.001;;;;;;; +NTRA;float32;nitrate (no3-n) ;moles_concentration_of_nitrate_in_sea_water;millimole/m3;;TIME DEPTH LATITUDE LONGITUDE;;0;56;%6.3f;1E+36;;0.001;;;;;;; +NTZW;float32;nitrate + nitrite;moles_of_nitrate_and_nitrite_per_unit_mass_in_sea_water;micromole/kg;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%6.3f;1E+36;;0.001;;;;;;; +NTRZ;float32;nitrate + nitrite;moles_concentration_of_nitrate_and_nitrite_in_sea_water;millimole/m3;;TIME DEPTH LATITUDE LONGITUDE;;0;100;%6.2f;1E+36;;0.001;;;;;;; +PHOW;float32;phosphate (po4-p);moles_of_phosphate_per_unit_mass_in_sea_water;micromole/kg;;TIME DEPTH LATITUDE LONGITUDE;;0;10;%5.3f;1E+36;;0.001;;;;;;; +PHOS;float32;phosphate (po4-p);moles_phosphate_of_nitrate_in_sea_water;millimole/m3;;TIME DEPTH LATITUDE LONGITUDE;;0;4;%6.3f;1E+36;;0.001;;;;;;; +PHPT;float32;total pheophytin;;milligramm/m3;;TIME DEPTH LATITUDE LONGITUDE;;0;99;%5.2f;1E+36;;0.01;;;;;;; +WETT;float32;wet bulb temperature;;degree_Celsius;;TIME DEPTH LATITUDE LONGITUDE;;0;90;%5.1f;1E+36;;0.001;;;;;;; +HEIG;float32;atmospheric height;;meter;;TIME DEPTH LATITUDE LONGITUDE;up;0;40000;%8.2f;1E+36;;0.1;;;;;;urn:ogc:crs:EPSG::5829; +NAVG;int32;averaged data cycle number;;1;;;;0;999;%3.0f;99999;;;;;;;;; +BOTL;int32;sea water sample bottle number;;1;;;;1;36;%3d;99999;;;;;;;;; +TYPECAST;int32;type of cast: unknow=0, phy=1, bio=2, geo=3;;1;;;;0.0;9.0;%1d;99999;;;;;;;;; +BATH;float32;bathymetric depth;;meter;;;;0;11000;%6.1f;1E+36;;0.1;;;;;;; diff --git a/ctd.py b/ctd.py index f5abb65650b196816d778c50f67e9041a0fd9aa2..2cf4a68231d827ec558d32763a0680ee338e3fda 100644 --- a/ctd.py +++ b/ctd.py @@ -17,6 +17,7 @@ options are: -e, --echo : display processed file name -q, --quiet : don't display output -o, --output=<file> : output file name without extention, default is pirata_fr24 + -r --roscop=<file> : load file for code roscop description --cycle_mesure=<name> : cycle_mesure name --plateforme=<name> : ship or plateforme name --date_debut=JJ/MM/YYYY : starting date from cycle_mesure @@ -38,14 +39,14 @@ example: $ python3 ctd.py --cycle_mesure=PIRATA-FR29 --institut=IRD --plateforme="THALASSA" --sn=09P01263 --type=SBE911+ --pi=BOURLES --date_debut=01/03/2019 --date_fin=04/04/2019 data/asc/fr29???.hdr --echo --local --ascii """ -import sys, re, getopt, string, fileinput +import sys, re, getopt, string, fileinput, csv from datetime import datetime # a lire dans la premier fichier seasave_version = "7.21b" # initialize constants -VERSION = "V1.0 J Grelet - IRD - US191 IMAGO, Plouzane - may 2011" +VERSION = "V1.1 J Grelet - IRD - US191 IMAGO, Plouzane - March 2019" DEGREE = 176 CODE = -1 CONTEXTE = "PIRATA" @@ -166,6 +167,13 @@ def entete_xml(fd): fd.write(" </ENTETE>\n") fd.write(" <DATA>\n") +#------------------------------------------------------------------------------ +# read code roscop file +#------------------------------------------------------------------------------ +def codeRoscop(file): + print("Code roscop file: %s" % code_roscop) + sys.exit() + # display help with no arg on command-line # ---------------------------------------- if len(sys.argv) == 1: @@ -175,15 +183,15 @@ if len(sys.argv) == 1: # ----------------------- try: - # The return value consists of two elements: the first is a list of - # (option, value) pairs; the second is the list of program arguments + # The return args consists of two elements: the first is a list of + # (option, arg) pairs; the second is the list of program arguments # left after the option list was stripped # see optparse, a powerful library for parsing command-line options # The gnu version of getopt means that option and non-option # arguments may be intermixed # ------------------------------------------------------------------ - options, args = getopt.gnu_getopt(sys.argv[1:], 'ed:qo:hvs', - ['echo', 'debug=', 'quiet', 'output=', 'help', 'version', + options, args = getopt.gnu_getopt(sys.argv[1:], 'ed:qo:hv', + ['echo', 'debug=', 'quiet', 'output=', 'help', 'version', 'roscop=', 'cycle_mesure=', 'plateforme=', 'date_debut=', 'date_fin=', 'institut=', 'code_oopc=', 'pi=', 'ascii', 'xml', 'odv', 'netcdf', 'all', 'local', 'secondary', 'sn=', 'type=']) @@ -196,33 +204,36 @@ except getopt.GetoptError as err: # iterate over options list # ------------------------- -for option, value in options: +for option, arg in options: if option in ('-e', '--echo'): echo = True elif option in ('-q', '--quiet'): quiet = False elif option in ('-d', '--debug'): - debug = int(value) + debug = int(arg) elif option in ('-o', '--output'): - outputfile = value + outputfile = arg elif option in ('-h', '--help'): - usage() + usage() elif option in ('-v', '--version'): - version() + version() + elif option == '--roscop': + code_roscop = arg + codeRoscop(code_roscop) elif option == '--cycle_mesure': - cycle_mesure = value + cycle_mesure = arg elif option == '--plateforme': - plateforme = value + plateforme = arg elif option == '--date_debut': - date_debut = value + date_debut = arg elif option == '--date_fin': - date_fin = value + date_fin = arg elif option == '--institut': - institut = value + institut = arg elif option == '--code_oopc': - code_oopc = value + code_oopc = arg elif option == '--pi': - pi = value + pi = arg elif option == '--ascii': ascii = True elif option == '--xml':