From dedac1b286e21c255e58f30bc9637a7780b0b668 Mon Sep 17 00:00:00 2001 From: Tiago Quintino Date: Mon, 25 Mar 2013 14:23:07 +0000 Subject: [PATCH] bring master in sync with p4 main --- AUTHORS | 1 + ChangeLog | 458 +---- Makefile.am | 14 +- VERSION.cmake | 2 +- config/config.guess | 422 +++-- config/config.sub | 91 +- config/depcomp | 226 +-- config/install-sh | 726 +++---- config/missing | 226 +-- configure.ac | 72 +- definitions/Makefile.am | 7 + definitions/budg/boot.def | 2 +- definitions/budg/mars_labeling.def | 2 +- definitions/budg/section.1.def | 2 +- definitions/budg/section.4.def | 2 +- definitions/bufr/boot.def | 2 +- definitions/bufr/old_section.1.def | 2 +- definitions/bufr/section.0.def | 2 +- definitions/bufr/section.1.def | 2 +- definitions/bufr/section.2.def | 2 +- definitions/bufr/section.3.def | 2 +- definitions/bufr/section.4.def | 2 +- definitions/bufr/section.5.def | 2 +- definitions/grib1/2.98.131.table | 2 +- definitions/grib1/boot.def | 2 +- definitions/grib1/data.grid_ieee.def | 2 +- definitions/grib1/data.grid_second_order.def | 2 +- .../data.grid_second_order_constant_width.def | 2 +- .../data.grid_second_order_general_grib1.def | 2 +- .../data.grid_second_order_row_by_row.def | 2 +- definitions/grib1/data.grid_simple.def | 2 +- definitions/grib1/data.grid_simple_matrix.def | 2 +- definitions/grib1/data.spectral_complex.def | 2 +- definitions/grib1/data.spectral_ieee.def | 2 +- definitions/grib1/data.spectral_simple.def | 2 +- definitions/grib1/gds_not_present_bitmap.def | 2 +- definitions/grib1/grid_21.def | 2 +- definitions/grib1/grid_22.def | 2 +- definitions/grib1/grid_23.def | 2 +- definitions/grib1/grid_24.def | 2 +- definitions/grib1/grid_25.def | 2 +- definitions/grib1/grid_26.def | 2 +- definitions/grib1/grid_61.def | 2 +- definitions/grib1/grid_62.def | 2 +- definitions/grib1/grid_63.def | 2 +- definitions/grib1/grid_64.def | 2 +- definitions/grib1/grid_definition_0.def | 2 +- definitions/grib1/grid_definition_1.def | 2 +- definitions/grib1/grid_definition_10.def | 2 +- definitions/grib1/grid_definition_13.def | 2 +- definitions/grib1/grid_definition_14.def | 2 +- definitions/grib1/grid_definition_192.78.def | 2 +- definitions/grib1/grid_definition_192.98.def | 2 +- definitions/grib1/grid_definition_193.98.def | 2 +- definitions/grib1/grid_definition_20.def | 2 +- definitions/grib1/grid_definition_24.def | 2 +- definitions/grib1/grid_definition_3.def | 2 +- definitions/grib1/grid_definition_30.def | 2 +- definitions/grib1/grid_definition_34.def | 2 +- definitions/grib1/grid_definition_4.def | 2 +- definitions/grib1/grid_definition_5.def | 2 +- definitions/grib1/grid_definition_50.def | 2 +- definitions/grib1/grid_definition_60.def | 2 +- definitions/grib1/grid_definition_70.def | 2 +- definitions/grib1/grid_definition_8.def | 2 +- definitions/grib1/grid_definition_80.def | 2 +- definitions/grib1/grid_definition_90.def | 2 +- .../grib1/grid_definition_gaussian.def | 2 +- definitions/grib1/grid_definition_latlon.def | 2 +- .../grid_definition_spherical_harmonics.def | 2 +- .../grib1/grid_first_last_resandcomp.def | 2 +- definitions/grib1/grid_rotation.def | 2 +- definitions/grib1/grid_stretching.def | 2 +- definitions/grib1/local.1.def | 2 +- definitions/grib1/local.214.1.def | 2 +- definitions/grib1/local.214.244.def | 2 +- definitions/grib1/local.214.245.def | 2 +- definitions/grib1/local.253.def | 2 +- definitions/grib1/local.254.def | 2 +- definitions/grib1/local.46.def | 2 +- definitions/grib1/local.54.def | 2 +- definitions/grib1/local.7.1.def | 2 +- definitions/grib1/local.80.def | 2 +- definitions/grib1/local.98.1.def | 2 +- definitions/grib1/local.98.10.def | 2 +- definitions/grib1/local.98.11.def | 2 +- definitions/grib1/local.98.14.def | 2 +- definitions/grib1/local.98.15.def | 2 +- definitions/grib1/local.98.16.def | 2 +- definitions/grib1/local.98.17.def | 2 +- definitions/grib1/local.98.18.def | 2 +- definitions/grib1/local.98.19.def | 2 +- definitions/grib1/local.98.190.def | 2 +- definitions/grib1/local.98.191.def | 2 +- definitions/grib1/local.98.192.def | 2 +- definitions/grib1/local.98.2.def | 2 +- definitions/grib1/local.98.20.def | 2 +- definitions/grib1/local.98.21.def | 2 +- definitions/grib1/local.98.218.def | 2 +- definitions/grib1/local.98.23.def | 2 +- definitions/grib1/local.98.24.def | 2 +- definitions/grib1/local.98.25.def | 2 +- definitions/grib1/local.98.26.def | 2 +- definitions/grib1/local.98.28.def | 2 +- definitions/grib1/local.98.29.def | 2 +- definitions/grib1/local.98.3.def | 2 +- definitions/grib1/local.98.31.def | 2 +- definitions/grib1/local.98.32.def | 2 +- definitions/grib1/local.98.33.def | 2 +- definitions/grib1/local.98.35.def | 2 +- definitions/grib1/local.98.36.def | 2 +- definitions/grib1/local.98.37.def | 2 +- definitions/grib1/local.98.38.def | 2 +- definitions/grib1/local.98.39.def | 2 +- definitions/grib1/local.98.4.def | 2 +- definitions/grib1/local.98.5.def | 2 +- definitions/grib1/local.98.50.def | 2 +- definitions/grib1/local.98.6.def | 2 +- definitions/grib1/local.98.7.def | 2 +- definitions/grib1/local.98.8.def | 2 +- definitions/grib1/local.98.9.def | 2 +- definitions/grib1/local.98.def | 2 +- definitions/grib1/localConcepts/kwbc/name.def | 2 + .../grib1/localConcepts/kwbc/paramId.def | 2 + .../grib1/localConcepts/kwbc/shortName.def | 2 + .../grib1/localConcepts/kwbc/units.def | 2 + definitions/grib1/local_no_mars.98.1.def | 2 +- definitions/grib1/local_no_mars.98.24.def | 2 +- definitions/grib1/mars_labeling.23.def | 2 +- definitions/grib1/mars_labeling.4.def | 2 +- definitions/grib1/mars_labeling.def | 2 +- definitions/grib1/predefined_grid.def | 2 +- definitions/grib1/scanning_mode.def | 2 +- definitions/grib1/section.0.def | 2 +- definitions/grib1/section.3.def | 2 +- definitions/grib1/section.5.def | 2 +- definitions/grib2/localConcepts/ecmf/name.def | 158 ++ .../grib2/localConcepts/ecmf/paramId.def | 158 ++ .../grib2/localConcepts/ecmf/shortName.def | 160 +- .../grib2/localConcepts/ecmf/units.def | 160 +- definitions/gts/boot.def | 2 +- definitions/mars/default_labeling.def | 2 +- definitions/tide/boot.def | 2 +- definitions/tide/mars_labeling.def | 2 +- definitions/tide/section.1.def | 2 +- definitions/tide/section.4.def | 2 +- doxygen/grib_api_wiz.cfg | 8 +- doxygen/make_dox_web.sh | 2 +- examples/C/Makefile.am | 36 +- examples/C/fieldset.c | 3 - examples/C/get.c | 2 - examples/C/get.sh | 7 + examples/C/iterator.c | 3 - examples/C/list.c | 4 +- examples/C/mars_param.c | 7 +- examples/C/multi.sh | 12 +- examples/C/multi2.c | 73 + examples/C/multi_write.c | 10 +- examples/C/nearest.c | 8 +- examples/C/points.c | 6 - examples/C/precision.c | 10 +- examples/C/print_data.c | 2 - examples/C/set.c | 3 - examples/C/set_bitmap.c | 10 +- examples/C/set_missing.c | 9 +- examples/C/set_pv.c | 15 +- examples/C/values_check.c | 2 +- examples/F77/example.F | 2 +- examples/F77/files_fortran.F | 2 +- examples/F77/get_fortran.F | 2 +- examples/F77/iterator_fortran.F | 2 +- examples/F77/keys_iterator_fortran.F | 4 +- examples/F77/missing_value.F | 2 +- examples/F77/msg_fortran.F | 2 +- examples/F77/multi_fortran.F | 2 +- examples/F77/nearest_fortran.F | 6 +- examples/F77/precision_fortran.F | 2 +- examples/F77/print_data_fortran.F | 2 +- examples/F77/set_fortran.F | 2 +- examples/F77/set_missing_fortran.F | 2 +- examples/F77/set_pv_fortran.F | 2 +- examples/F90/keys_iterator_fortran.f90 | 10 +- examples/F90/precision.f90 | 3 - examples/F90/read_from_file.f90 | 2 +- examples/F90/read_message.f90 | 9 +- examples/F90/set.f90 | 1 - examples/F90/set_missing.f90 | 1 - examples/extra/ens_mean.f90 | 2 - examples/extra/f_clone.f90 | 2 - examples/extra/message_count_multi.f90 | 2 - examples/get_fortran.F | 2 +- examples/iterator_fortran.F | 2 +- examples/keys_iterator_fortran.F | 2 +- examples/multi_fortran.F | 2 +- examples/precision_fortran.F | 2 +- examples/print_data_fortran.F | 2 +- examples/python/binary_message.py | 24 +- examples/python/clone.py | 30 +- examples/python/count_messages.py | 26 +- examples/python/get.py | 30 +- examples/python/index.py | 36 +- examples/python/iterator.py | 24 +- examples/python/keys_iterator.py | 26 +- examples/python/keys_iterator_bufr.py | 58 + examples/python/keys_iterator_gts.py | 55 + examples/python/multi_write.py | 18 +- examples/python/nearest.py | 16 +- examples/python/print_data.py | 20 +- examples/python/samples.py | 26 +- examples/python/set.py | 44 +- examples/python/set_missing.py | 24 +- examples/python/set_pv.py | 26 +- examples/set_fortran.F | 2 +- examples/set_pv_fortran.F | 2 +- fortran/create_grib_f90.sh | 4 +- fortran/grib_f77.c | 4 +- fortran/grib_f90.f90.head | 1 + fortran/grib_f90.f90.tail | 32 +- fortran/grib_f90_int.f90 | 9 + fortran/grib_f90_long_int.f90 | 9 + fortran/grib_fortran.c | 42 +- fortran/grib_fortran_prototypes.h | 33 +- fortran/grib_types.f90 | 8 + fortran/same_int_long.f90 | 8 + .../definitions/grib1/local.98.35.def | 39 + .../definitions/grib1/section.4.def | 160 ++ license.pl | 17 +- mars_tests/Makefile.am | 12 + mars_tests/include.sh | 53 + mars_tests/ls.sh | 60 + perf/jmeter.awk | 16 +- perf/time.sh | 11 +- perl/GRIB-API/lib/GRIB/API.pm | 2 +- python/Makefile.am | 58 +- python/eccode.i | 8 + python/eccode.py | 1676 +++++++++++++++++ python/eccode_swig.i | 209 ++ python/extrules.am | 10 +- python/grib_interface.c | 45 +- python/grib_interface.h | 5 +- python/gribapi.c | 13 +- python/gribapi_swig.i | 5 +- python/setup.py.in | 10 +- python/swig_wrap_array.c | 126 +- python/swig_wrap_array.py | 536 +++--- python/swig_wrap_numpy.c | 126 +- python/swig_wrap_numpy.py | 560 +++--- python/test_general.py | 72 +- src/Makefile.am | 542 +++--- src/action_class_concept.c | 4 +- src/action_class_section.c | 7 +- src/action_class_template.c | 6 +- src/action_class_write.c | 105 +- src/errors.pl | 9 +- src/functions.c | 10 + src/grib2c.pl | 8 + src/grib_accessor_class.c | 2 +- src/grib_accessor_class_bits.c | 1 + src/grib_accessor_class_box.c | 6 - ...accessor_class_change_scanning_direction.c | 10 +- src/grib_accessor_class_codeflag.c | 2 +- src/grib_accessor_class_codetable.c | 247 +-- src/grib_accessor_class_data_2order_packing.c | 4 +- src/grib_accessor_class_data_png_packing.c | 8 +- ...sor_class_from_scale_factor_scaled_value.c | 72 +- src/grib_accessor_class_g1fcperiod.c | 6 +- src/grib_accessor_class_g1step_range.c | 70 +- src/grib_accessor_class_g2_mars_labeling.c | 118 +- src/grib_accessor_class_g2step_range.c | 26 +- src/grib_accessor_class_laplacian.c | 2 +- src/grib_accessor_class_long.c | 6 +- src/grib_accessor_class_mars_param.c | 11 +- src/grib_accessor_class_md5.c | 6 +- src/grib_accessor_class_nearest.c | 7 - src/grib_accessor_class_number_of_points.c | 1 + src/grib_accessor_class_number_of_values.c | 5 +- src/grib_accessor_class_padto.c | 6 +- src/grib_accessor_class_scale.c | 2 +- src/grib_accessor_class_sprintf.c | 8 +- src/grib_accessor_classes_hash.c | 10 + src/grib_api.h | 103 +- src/grib_api_internal.h | 52 +- src/grib_api_prototypes.h | 34 +- src/grib_box_class.c | 5 - src/grib_box_class_gen.c | 6 - src/grib_box_class_reduced_gaussian.c | 7 - src/grib_box_class_regular_gaussian.c | 7 - src/grib_buffer.c | 11 +- src/grib_concept_index.c | 3 - src/grib_context.c | 161 +- src/grib_db.c | 12 +- src/grib_dumper_class_debug.c | 24 +- src/grib_dumper_class_default.c | 18 +- src/grib_dumper_class_keys.c | 6 +- src/grib_dumper_class_wmo.c | 32 +- src/grib_emoslib.h | 11 +- src/grib_errors.c | 10 + src/grib_expression_class.h | 12 + src/grib_expression_factory.h | 12 + src/grib_fieldset.c | 12 +- src/grib_filepool.c | 52 +- src/grib_gaussian_reduced.c | 3 - src/grib_handle.c | 294 ++- src/grib_ibmfloat.c | 4 +- src/grib_ieeefloat.c | 6 +- src/grib_index.c | 2 - src/grib_io.c | 276 ++- src/grib_jasper_encoding.c | 17 +- src/grib_keys_iterator.c | 5 +- src/grib_lex.c | 1389 +++++++------- src/grib_memory.c | 10 + src/grib_nearest_class_gen.c | 7 - src/grib_nearest_class_latlon_reduced.c | 6 - src/grib_nearest_class_reduced.c | 6 - src/grib_nearest_class_regular.c | 6 - src/grib_nearest_class_sh.c | 6 - src/grib_openjpeg_encoding.c | 1 - src/grib_rules.c | 8 +- src/grib_templates.c | 78 +- src/grib_timer.c | 18 +- src/grib_util.c | 872 ++++----- src/grib_value.c | 1632 ++++++++-------- src/grib_yacc.c | 428 ++--- src/grib_yacc.h | 2 +- src/hash.c | 10 + src/md5.c | 138 +- src/md5.h | 43 +- tests/Makefile.am | 8 +- tests/badgrib.sh | 2 +- tests/bitmap.sh | 2 +- tests/bitsPerValue.sh | 2 +- tests/bpv_limit.sh | 2 +- tests/budg.sh | 2 +- tests/change_scanning.sh | 2 +- tests/compare.sh | 2 +- tests/concept.sh | 2 +- tests/convert.sh | 2 +- tests/debug.sh | 2 +- tests/decimalPrecision.sh | 2 +- tests/definitions.sh | 2 +- tests/double_cmp.sh | 2 +- tests/fortran_interface.sh | 6 +- tests/get_fail.sh | 2 +- tests/grib1to2.sh | 2 +- tests/grib2to1.sh | 2 +- tests/gridType.sh | 2 +- tests/include.sh | 3 +- tests/index.sh | 2 +- tests/iterator.sh | 2 +- tests/jpeg.sh | 2 +- tests/julian.sh | 2 +- tests/level.sh | 2 +- tests/list.sh | 2 +- tests/list_all_keys.ksh | 3 +- tests/local.sh | 34 +- tests/ls.sh | 2 +- tests/missing.sh | 2 +- tests/multi.sh | 2 +- tests/multi_from_message.sh | 2 +- tests/padding.sh | 2 +- tests/read_any.sh | 2 +- tests/set.sh | 2 +- tests/statistics.sh | 2 +- tests/step.sh | 4 +- tests/tigge_conversions.sh | 2 +- tests/tiny.sh | 2 +- tests/unit_tests.c | 1307 +++++++++++++ tests/unit_tests.sh | 14 + tigge/jma.pl | 4 +- tools/Makefile.am | 4 +- tools/big2gribex.c | 3 - tools/gg_sub_area_check.c | 10 + tools/grib_cmp.c | 3 - tools/grib_convert.c | 2 - tools/grib_copy.c | 68 +- tools/grib_corruption_check.c | 10 + tools/grib_count.c | 13 +- tools/grib_debug.c | 2 - tools/grib_dump.c | 8 +- tools/grib_filter.c | 58 +- tools/grib_gen.c | 3 - tools/grib_get.c | 2 - tools/grib_get_data.c | 2 - tools/grib_index_build.c | 2 - tools/grib_info.c | 3 - tools/grib_keys.c | 11 +- tools/grib_ls.c | 25 +- tools/grib_moments.c | 10 + tools/grib_nearest_land.c | 4 - tools/grib_options.c | 53 +- tools/grib_packing.c | 4 - tools/grib_points.c | 2 - tools/grib_repair.c | 18 +- tools/grib_set.c | 2 - tools/grib_tools.c | 261 ++- tools/grib_tools.h | 10 +- tools/wingetopt.c | 85 + tools/wingetopt.h | 22 + tools/xref.pl | 6 +- version.sh | 14 +- 400 files changed, 10745 insertions(+), 6527 deletions(-) create mode 100644 definitions/grib1/localConcepts/kwbc/name.def create mode 100644 definitions/grib1/localConcepts/kwbc/paramId.def create mode 100644 definitions/grib1/localConcepts/kwbc/shortName.def create mode 100644 definitions/grib1/localConcepts/kwbc/units.def create mode 100644 examples/C/multi2.c create mode 100644 examples/python/keys_iterator_bufr.py create mode 100644 examples/python/keys_iterator_gts.py create mode 100644 grib_api_for_mars/definitions/grib1/local.98.35.def create mode 100644 grib_api_for_mars/definitions/grib1/section.4.def create mode 100755 mars_tests/Makefile.am create mode 100644 mars_tests/include.sh create mode 100755 mars_tests/ls.sh create mode 100644 python/eccode.i create mode 100644 python/eccode.py create mode 100644 python/eccode_swig.i create mode 100644 src/grib_expression_class.h create mode 100644 src/grib_expression_factory.h create mode 100644 tests/unit_tests.c create mode 100755 tests/unit_tests.sh create mode 100644 tools/wingetopt.c create mode 100644 tools/wingetopt.h diff --git a/AUTHORS b/AUTHORS index f3ab3b067..ee836d8bd 100755 --- a/AUTHORS +++ b/AUTHORS @@ -3,3 +3,4 @@ Enrico Fucile Baudoin Raoult Cristian Codorean Jean-Baptiste Filippi + diff --git a/ChangeLog b/ChangeLog index a2ed62153..faf99ce12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,457 +1,5 @@ -21-01-2013 Shahram Najm --- released version 1.10.0 - * Updated copyright notices to Apache Licence Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - * Availability of grib2netcdf tool from grib_api - * Support in grib_api for Lambert Conformal grid (grib_get_data) - * Updated GRIB edition 2 definitions with the latest WMO V9 templates/tables - * ERA-CLIM: Added support for Simulated Radiances - * LWDA: Added support to Long Window 4DVar - * ERA-CLIM: New stream (ensemble supplementary data) and origin (Hadley Centre) - * GRIB definitions of new variables from LISFLOOD hydrological model - * Added Local Definition 21 (Sensitive area predictions) for GRIB edition 2 - * Provided user-friendly function in API to check if a key is defined (grib_is_defined) - * Python: Provided function to set key values in one go (like grib_set -s) - * New MARS codes for surface parameters (effective total cloudiness) - * Corrected ifs_samples installation path - * New streams for ensemble data added to the parameter database - * New mars streams added for ensemble data assimilation - * Added pseudo-grib (budg) sample file for IFS - * Added new centre codes for COSMO, Ireland and Austria - * Bug fix: python interface missing __version__ - * Bug fix: on make dist, definitions and sample go to /usr/share instead of /usr/share/grib_api/ - * Bug fix: padding.sh fails in Debian automatic build machines - * Bug fix: Lambert azimuthal equal area - * Bug fix: Assertion when trying to encode the level information of some cloud cover fields - * Bug fix: ERA-CLIM: Support for existing streams EDMM, EDMO, EWMM, EWMO - * Bug fix: Netcdfs generated by grib_to_netcdf seem to be upside down - * Bug fix: python binding without numpy support grib_get_array(gid,'pv',float) - * Bug fix: grib_dump crashing with some second order packed files - * Bug fix: running grib_to_netcdf on a non regular lat/lon grid grib file results in invalid netcdf - * Bug fix: Assertion: Interpolation (or truncation) of GRIB 2 data into T21 - * Bug fix: Make sure that grib_filter checks all disk writes. - * Bug fix: if "configure" is run without --prefix, IFS_SAMPLES_PATH starts with "NONE" - * Bug fix: grib_to_netcdf: long_name/units incorrect - * Bug fix: grib_filter error: converting edition 1 to 2: unable to get extraDimensionPresent as long - * Bug fix: grib_check Fortran definition is inconsistent with other Fortran definition: - uses "integer" instead of "integer(kind=kindOfInt)" as status variable - * Bug fix: Remove redundant MARS type and stream entries for TIGGE - * Bug fix: Remove layer information from grib_api concepts for soil parameters - * Bug fix: grib_api 1.10.0 with MARS client: Interpolation failed - * Bug fix: Remove parameter 500011: 2m Temperature - * Bug fix: Remove new grib2 representations for parameters: 210004 and 210061 - * Bug fix: Wrong short name for centre 82 in 0.table - * Bug fix: configure option disable-vector actually enables it! - * Bug fix: LWDA: Support for Errors in Analysis +The changelog is now online. Please see: + +https://software.ecmwf.int/wiki/display/GRIB/History+of+Changes -19-10-2012 Shahram Najm --- released version 1.9.18 - * Updated sample gribs with recent changes for Reduced Gaussian N1024 and N2000 - * Updated GRIB2 definitions with the latest WMO version 8 templates/tables - * Added missing parts in Grid Definition Template 3.120 - * Added GRIB2 template 4.32 (simulated satellite data) - * Removed redundant MARS files for type and stream combinations - * Bug fix: Segmentation violation: calling grib_set on 'values' (decimal scale factor) - * Bug fix: grib_get_data returns incorrect lat-lon values for some GRIBS - * Bug fix: grib_filter does not fail with a non-zero return code when setting an invalid key - * Bug fix: Cannot set paramId to 228170 (Field Capacity) for grib edition 2 - * Bug fix: grib_api compilation fails when enabling pthreads in recent Linux distributions - * Bug fix: Segmentation violation when GRIB_DEFINITION_PATH contains colon - * Bug fix: Compilation failure: problems with GRIB_INLINE: undefined reference to stdio_read etc - * Bug fix: Setting step to the new value in GRIB2 creates wrong [day,hour]endOfOverallTimeInterval - * Bug fix: grib_keys -L should show the real contents of SAMPLES PATH - * Bug fix: Crash: Running the fortran example get_data - * Bug fix: grib_filter with verbose option -v writes out lots of blank lines - * Bug fix: tools/grib1to2.sh depends on /usr/bin/ksh which is a non standard location and breaks RPMs - * Bug fix: GRIB1: Problem with derive probability for wave height larger than 8m - * Bug fix: Bug when printing thickness of layers (typeOfLevel = depthBelowLandLayer) - * Bug fix: Correct typos in parameter database - * Bug fix: test script second_order.sh not working on some stricter shells - * Bug fix: Compilation failure: tools/grib_compare.c - error on SX9 with the "end" variable - * Bug fix: Build fails in Solaris 10: Wrong Fortran module include - -16-03-2012 Shahram Najm --- released version 1.9.16 - * Disabled boustrophedonic ordering in second order packing. - * Fixed the python bug in setting keys of type "double". - * New parameters have been added to the parameter database and to the definition files. - * Fixed a problem producing unwanted padding between messages when converting some fields from second order packing - * Improved thread safety in relation to the creation of an index. Creating a new grib_handle or indexing different files is thread safe. - * Fixed grib_dump not to display zeros when all values were missing. - * Fixed minor bugs - -17-03-2011 Enrico Fucile --- released version 1.9.9 - * Several changes have been made to the internal functions used by the interpolation package in EMOSLIB 381 - to make the results of the grib_api based interpolation as close as possible to the GRIBEX based one. - * laplacianOperator for spectral fields is always computed. If the computation is not required please - set the key computeLaplacianOperator=0. Default behaviour is computeLaplacianOperator=1. - * New parameters have been added to the parameter database and to the definition files regarding - the MACC project. - * Second order packing (packingType=grid_second_order) is producing smaller fields as the default setting - is to use the boustrophedonic option. - -25-02-2011 Enrico Fucile --- released version 1.9.8 - * WARNING: A significant change in the fortran interface has been done for which some - software using the previous versions could exhibits memory allocation problems due - to unreleased memory associated with the GRIB messages. In the previous versions - (starting from version 1.6.1) the argument IGRIB of the functions GRIB_NEW_FROM_FILE, - GRIB_NEW_FROM_MESSAGE, GRIB_NEW_FROM_INDEX, GRIB_CLONE was an input and output argument. - In the new version IGRIB is output only and the grib message associated with IGRIB will - never be released by the GRIB_NEW_FROM_FILE function. This means that to release the memory - associated to the message a call to GRIB_RELEASE(IGRIB) has to be introduced when the message - is not needed any more. In the previous version the memory was released when a value of IGRIB - associated with a valid message was passed to the function. It has been realised that this - behaviour was source of unexpected results when the IGRIB variables used in the user code were - not initialised to a non valid IGRIB value (zero or negative integer). We strongly advise the - users to revise the existing code using previous grib_api versions or to link to the new library, - add the appropriate GRIB_RELEASE calls and test it for memory allocation. - - For convenience we report an example of code which could cause problems and has to be reviewed. - - integer :: IGRIB1 - integer :: IGRIB2 - - call grib_new_from_file(IGRIB1,...) - ... do something ... - call grib_new_from_file(IGRIB2,...) - ... do something ... - - IGRIB1 and IGRIB2 are not initialised to zero and we don't know which value is assigned to them. - It could be IGRIB1=IGRIB2=5 or any other number greather or equal to zero. If this happens at the - second call of grib_new_from_file IGRIB1 will be replaced by IGRIB2 producing very dangerous - consequences as the IGRIB1 doesn't point any more to the GRIB message it was supposed to. - Please revise your code in view of this example or link to the new version and add a call - to the GRIB_RELEASE function to release the memory when the which is not any more released in the new version. - - * Second order packing algorithm rewritten and working in GRIB edition 1 and 2 with - packingType=grid_second_order. - * This version is ready to be used with the new GRIB1 and GRIB2 interpolation function (INTF2) - available in EMOSLIB. - * A significant change in the fortran interface has been done for which some software using the - previous versions could exhibits memory allocation problems due to unreleased memory associated - with the GRIB messages. In the previous versions (starting from version 1.6.1) the argument IGRIB - of the function GRIB_NEW_FROM_FILE(IFILE,IGRIB) was an input and output argument. - In the new version is output only and the grib message associated with IGRIB will never be released - by the GRIB_NEW_FROM_FILE function. This means that to release the memory associated to the message - a call to GRIB_RELEASE(IGRIB) has to be introduced when the message is not needed any more. In the - previous version the memory was released when a value of IGRIB associated with a valid message was - passed to the function. It has been realised that this behaviour was source of unexpected results - when the IGRIB variables used in the user code were not initialised to a non valid IGRIB value - (zero or negative integer). - * Review and update of the code tables. - * Added new parameters. Full list of parameters accessible from - http://www.ecmwf.int/publications/manuals/d/gribapi/param/ - * Bug fixes. - -14-10-2010 Enrico Fucile --- released version 1.9.5 - * Python interface available with the configure option --enable-python. - See http://www.ecmwf.int/publications/manuals/grib_api/namespacegribapi.html - and http://www.ecmwf.int/publications/manuals/grib_api/grib_examples.html - * Available new environment variable GRIB_API_IO_BUFFER_SIZE defining the size in bytes of the buffer - used in the IO calls from Fortran and in the tools. - * Performance improvements and partial vectorisation for the NEC SX platform. - * Review and update of the code tables. - * Update of paramId, shortName, name key values and release of a new parameter database web interface. - * Added a new key called 'global' for regular_gg and reduced_gg which can take the values 1 ( =True) or 0 (=False). - This is used to specify whether the grid is global or not. Setting global=1 will set the grid parameters computed - only from N and Ni. It is used in the conversion from one edition to the other. - * Available new environment variable GRIB_API_NO_ABORT. Default value is 0 and when it is set to 1 the library will not - abort on failing asserts. - * Bug fixes. - - -07-05-2010 Enrico Fucile --- released version 1.9.0 - * Setting paramId or converting from one edition to the other when a parameter is not - defined in the paramId.def file will result in a failure. - * Improved performance in reading/cloning a message. - * Changed the indexing system and provided new functions to write the index on a file - grib_index_write and read it grib_index_read - * Provided a new tool to build an index from a set of files: grib_index_build. - * The tool grib_compare is able to compare two index files, going through the grib messages - indexed in the first and searching for them in the second. - * definition files and library have been updated to be used in operational status in the - IFS cycle 36R2 - * grib_ls has slightly changed format. - * A -j option is provided in grib_ls (-l only) to have the output in json format. - * BUFR messages are read, but only very basic decoding is provided. - * Parameters have been updated. - * Native type of paramId has been changed from string to integer. - * Several small bug fixes. - -23-07-2009 Enrico Fucile --- released version 1.8.0 - * Improved conversion from edition 1 to 2. Set edition=2 will do the conversion - from edition 1 to 2 also of the parameter information. - * shortName, paramId and units are defined for all the official WMO parameters - and for local parameters used at ECMWF and NCEP - * grib_compare has been modified to compare grib 1 and 2 (option -e). - Other important chages have been done on grib_compare to have a more powerful tool to compare headers and - values. New options are provided to choose the tolerance and new namespaces are available to - compare only the relevant part of information. The new namespaces are. - parameter,geography,vertical,time,local,data. - * For some ECMWF local definitions the conversion rules have been included in grib_api. - * A new key cfName is provided for the netcdf CF name. It is at the moment defined - only for some parameters. - * The parameter information is generated from a parameter database maintained at ECMWF - and accessible from a new section in the grib_api web pages. - * A new key typeOfLevel valid for grib edition 1 and 2, with the following values has been introduced - 'surface', 'cloudBase', 'cloudTop', 'isothermZero', 'adiabaticCondensation', 'maxWind', - 'tropopause', 'nominalTop', 'seaBottom', 'isobaricInhPa', 'isobaricInPa', 'isobaricLayer', - 'meanSea', 'isobaricLayerHighPrecision', 'isobaricLayerMixedPrecision', 'heightAboveSea', - 'heightAboveSeaLayer', 'heightAboveGroundHighPrecision', 'heightAboveGround', 'heightAboveGroundLayer' - 'sigma', 'sigmaLayer', 'sigmaLayerHighPrecision', 'hybrid', 'hybridLayer', 'depthBelowLand', - 'depthBelowLandLayer', 'theta', 'thetaLayer', 'pressureFromGround', 'pressureFromGroundLayer', - 'potentialVorticity', 'depthBelowSea', 'entireAtmosphere', 'entireOcean', 'oceanWave', 'oceanMixedLayer' - * The open source library OpenJpeg can be used in place of Jasper for the jpeg 2000 coding. - --with-openjpeg options in the configure. - * decimalPrecision can be used also with grid_jpeg packing. - * parameterName,parameterUnits are provided from the code tables. - * packingError is also available for spherical harmonics packing. It provieds the error due to simple packing. - * option -l added in grib_get - * option -F added in grib_get and grib_ls to control the format of floating point keys. - * grib_ls output has been changed due to the introduction of the new typeOfLevel key - * Subroutine grib_is_missing added in the Fortran interface to check if a header value is missing. - * Changed step behaviour. If the step is "instant" and the value doesn't fit into one byte (in grib 1) - * an appropriate value of timeRangeIndicator is found to code the value in two bytes instead of 1. - * In grib_filter the function "append" has been added to append a message to a file as opposed to "write" which is - writing from the beginning of the file. - * A new grib_count function is available to count (very fate) the number of messages in a list of files. - * The value of the key level is zero in both edition when it is not relevant for the message and it is - missing in grib edition 2. - * The indexing routines have been improved to process string keys. - -06-03-2009 Enrico Fucile --- released version 1.7.0 - * New indexing routines. - Example: index.f90 - (http://www.ecmwf.int/publications/manuals/grib_api/grib_examples.html) - * New keys stepType,stepUnits,stepRange,startStep,endStep. - * New keys swapScanningX, swapScanningY, swapScanningLat, swapScanningLon. To - swap the field respect one axis. They swap data and fix the header accordingly. - * "Improved" error messages. - * write multi fields. Previous versions of grib_api were able only to read multi - fields, now you can also write multi fields. We don't suggest to you this - feature, it is included only to be compliant with FM-92 spec. - Examples: multi.f90, multi_write.f90 - (http://www.ecmwf.int/publications/manuals/grib_api/grib_examples.html) - * function grib_new_from_template is deprecated and it will be replaced with - grib_new_from_samples. Also the environment variable GRIB_TEMPLATES_PATH is - replaced by GRIB_SAMPLES_PATH. Please replace "template" with "samples" in all - the C functions also. The behavior is the same. I made a new example showing the - best practice to use samples. The technique of cloning is strongly recommended. - Example: samples.f90 - (http://www.ecmwf.int/publications/manuals/grib_api/grib_examples.html) - * New key decimalPrecision provided. Used in the previous example. Regarding - decimalPrecision and bitsPerValue the following problem was found in the - previous version. If after loading from file or from sample (template) or - cloning a constant field you set some non constant values the library doesn't - know the bitsPerValue or the decimalPrecision you want to code (those are zero - in the constant field). The result could have been a field coded with a poor - precision. Starting with the new 1.7.0 version in these ambiguous cases grib_api - is using 24 bits to pack the field (safe value). We always suggest to set - explicitly the bitsPerValue or decimalPrecision or to clone non constant fields - with those values properly set. - * grib_copy, grib_set. A key name in square brackets can be used in the output - file name. The key will be replaced with its value in the processed grib - message. This will provide an easy way for splitting fields as the file name - will be dependent on some key values. Example: - grib_copy input.grib "output_[shortName]_[date]_[step].grib" - Please remember to quote the file name otherwise you can get strange behaviors - due to the shell. - * New key packingError. The error introduced by the packing algorithm is - returned with this key. It is available only for some packing algorithms. All - the packed values are affected by this error in the sense that - original value before packing = unpacked value ± packingError - packingError is different for different fields (also for different steps of the - same parameter/level/run). - * all the nearest functions are returning the distance from the grid point in - Km, using the radius coded in the message. - * key bitmapPresent now available also in grib 2. Example: bitmap.f90 - (http://www.ecmwf.int/publications/manuals/grib_api/grib_examples.html) - -30-09-2008 Enrico Fucile --- released version 1.6.4 - * Fields containing a bitmap with all missing values can be coded in grib1 and grib2 - * Multifields grib2 messages can be loaded from memory. - * local definition 31 added - * Better use of memory - * minor bug fixes - -16-07-2008 Enrico Fucile --- released version 1.6.1 - * More efficient use of memory and improvement of performance. - * Thread safe version available through the --enable-pthread configure option. - * New computation of kindOfInt, kindOfLong, kindOfDouble, kindOfFloat, kindOfSize - to allow safe arguments handing between Fortran 90 and C. - * A new key bitmap is provided to get the full bitmap as a string with the grib_filter - instruction: print "[bitmap]"; - * all the tools are failing on error and can be forced to proceed execution with - the option -f . The only exception is grib_ls because we already have an identical - tool failing (grib_get). - * new error messages from the Fortran 90 interface will give you some more chance to debug - your code. - * New function grib_count_in_file available from Fortran and C to count the messages in a file. - See example: examples/F90/count_messages.f90 - * In the Fortran 90 interface any valid grib id passed to a grib_new_from_file or grib_new_from_message - will be released before being assigned to a new grib message. - Example - call grib_new_from_file(ifile,igrib, iret) - do while (iret /= GRIB_END_OF_FILE) - ... do something with the message pointed by igrib - ... igrib will have the same value, but - ... it will point to a different message each cycle - ... the message from the previous cycle will be released - ... no need for grib_release(igrib) - call grib_new_from_file(ifile,igrib, iret) - enddo - If you want to keep the grib message in memory remember to pass a negative grib id. - Example - call grib_count_in_file(ifile,n) - allocate (igrib(n)) - do i=1,n - call grib_new_from_file(ifile,igrib(i), iret) - ... - enddo - ... remember to release the grib ids to free memory - do i=1,n - call grib_release(igrib(i)) - enddo - * grib_filter is now able to print with a format, number of colums and a separator for array keys. - The format is expressed with a % followed by a C like (printf) format declarator. - The number of columns is started with ! - The separator string is delimited by ' ' - Examples - print "[values!6%.5f',']" values with 5 digits precision in 6 columns separated by , - print "[latitudes%.3f!1]" latitudes with 3 digits precision in a column - print "pl={[pl!7', ']}" pl (number of point for each latitude) in 7 columns separated by ', ' - * New keys: - julianDay - latLonValues array containing latitude(1),longitude(1),value(1), latitude(2),longitude(2),value(2),..., - latitude(N),longitude(N),value(N) (N=number of points in the grid) - latitudes latitude(1),latitude(2),...,latitude(N) (N=number of points in the grid) - longitudes longitude(1),longitude(2),...,longitude(N) (N=number of points in the grid) - distinctLatitudes list of distinct latitudes - distinctLongitudes list of distinct longitudes - * minor bug fixes - -03-06-2008 Enrico Fucile --- released version 1.5.0 - * Review of packing algorithms. Improvement of performance mainly on big endian - platforms. - * Modified the internal retrieval of keys, improving performance in getting and setting - keys. - * Implemented memory management. An efficient tecnique to reuse memory is implemented. - --disable-memory-management configure option available to disable the memory managemet - and use system malloc/free. - * Some experimental multithreaded packing is available for big endian machines. - A configure option --enable-omp-packing is provided to enable the openMP instructions - contained in the new packing. The environment variable OMP_NUM_THREADS sets the number - of threads used in the packing algorithm. - * grib_filter improvement: - * it is now possible to set array keys like values or pl as follows: - values = { 0.1, 3.2, 7.5 }; - * it is now possible to print array keys like values or pl as follows: - print "values=[values]"; - it is also possible to print on a file ("test.out") doing: - print("test.out") "values=[values]"; - * better error messages are printed - * it does not fail if an undefined key is used in a write or print statement - * New keys or changed keys: - * a scale factor and an offset can be applied to the data values through the keys - "scaleValuesBy" and "offsetValuesBy". - * setBitsPerValue is the new key to be used to change the number of bits per value. - It also executes the repacking. - * The keys periodOfTime is now working also when indicatorOfUnitOfTimeRange=0 (time units is - minutes) - * Concepts can be defined by the user. Concepts are a way to link the value of a key to - a combination of values of other keys. They are used to define the short_name and the - name. - * minor bug fixes - -07-02-2008 Enrico Fucile --- released version 1.4.0 - * New Fortan 90 interface. Main featues: - * unique grib_get/grib_set subroutines to get/set any variable type. - * status code is an optional argument in all the subroutines (when omitted - the program will exit in case of error) - * new subroutine grib_get_data to get the latitude/longitude/values arrays. - * new subroutine grib_get_element to get one or several elements of an array key - through their index. - * new subroutine grib_nearest function to get the nearest grid point of a given lat/lon. - It accepts in input also arrays of latitude/longitudes to find the nearest points in one - single call. A land sea mask mode is also available to get the nearest land point. - * New Fortran 90 examples and documentation. - * New grib_keys tool to obtain the list of keys available for a specified type of grib. - * Modified the -l option in grib_ls (see documentation or type grib_ls without arguments) - * fixed a bug in the grib_filter and added the -o option for the output file. - * minor bug fixes. - -12-11-2007 Enrico Fucile --- released version 1.3.0 - * grib_ls -l lat/lon/mode to retrieve values in the nearest grid points of a given - latitude longitude point - * grib_ls -B"order by" to order the output using some keys - * grib_ls -i index. To extract the value in the index grid point. - * new grib_dump exposing a minimum set of keys which are the ones suggested for the - standard use. Some options added to the grib_dump. The output of this new - grib_dump is ready to be coupled to the new grib_gen which will be released in the - next version. - * grib_copy -r to repack data fixing problems in the original file - * improved keys search for faster tools - * grib_get_data and grib_iterator working with all scanning mode - * new experimental functions introduced, not available in the fortran - interface: grib_fieldset_new,grib_fieldset_apply_order_by,grib_fieldset_next_handle - grib_nearest_new,grib_nearest_find,grib_nearest_delete - * some examples on the grib_fieldset and grib_nearest are added. - * The management of the missing data in grib_get_data is changed. Please refer to the help - obtained executing grib_get_data without arguments. - * Added the key stepRange which is native type string. It can represent start and end of a - cumulation or a max of min interval. Example stepRange=24-36 for a precipitation means that it - is cumulated between 24 and 36. It also addresses the problems with the big steps which don't - fit in the grib1 P1 and P2. - * Added key numberOfCodedValues. It is different from numberOfValues only if a bitmap is present and - the difference between the two should be numberOfMissingValues. - * Added the option -g to grib_copy, grib_set, grib_convert, grib_filter to preserve GTS headers - wrapping the grib message - * fixed some bugs in the fortran interface - * fixed a bug in reading the signed floats with the grib_convert. - -01-09-2007 Enrico Fucile --- released version 1.2.0 - * changed license. Now grib_api is distributed under LGPL see LICENSE file in distribution. - * changed io functions and configure.ac to support files larger than 2GB - * as a consequence to the large file support the key offset has native type double - * added support for predefined grids - * modified grib_handle_new_from_file to read messages with wrong message length. - In this case an error will be raised. - * A new -M option is provided for all the tools to turn off the multi-field grib - support. - * Changed behaviour of grib_copy. Default is quiet and option -v (verbose) is available. - -09-07-2007 Enrico Fucile --- released version 1.1.0 - * fixed a bug affecting constant fields. - * rewritten the ibm floating point encoding/decoding routines gaining a factor of 7 in performance - * fixed a problem in the configure affecting compilation of fortran programs on AIX platforms - * Added some new keys: - * max,min,average (maximum, minimum and average respectively of the data ) - * numberOfDataPoints(alias numberOfPoints) computed from the grid description - * numberOfValues is the same as the numberOfPoints if a bitmap is not present - otherwise it takes into account the bitmap - * numberOfMissing (alias numberOfMissingValues) number of missing values in the field - It's easy to check if a field is constant by simply comparing max,min,average - and some information about bitmap and missing values can be found comparing numberOfValues - numberOfPoints, numberOfMissing. - * added some new tests - * added a new example on how to print all the data when the iterator is not available. - * grib_tools are now failing with an error when the input file does not contain any - valid grib message - * added management of reduced gaussian non global fields. - -17-04-2007 Enrico Fucile - * grib_api version 1.0 released diff --git a/Makefile.am b/Makefile.am index 7701fb382..12d29f3bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,7 @@ else PYTHON_OPT = endif -SUBDIRS = src tools definitions samples ifs_samples/grib1 ifs_samples/grib1_mlgrib2 ifs_samples/grib1_mlgrib2_ieee64 tests tigge $(FORTRAN_MOD) examples/C $(F90_CHECK) $(PERL_OPT) python examples/python +SUBDIRS = src tools definitions samples ifs_samples/grib1 ifs_samples/grib1_mlgrib2 ifs_samples/grib1_mlgrib2_ieee64 tests mars_tests tigge $(FORTRAN_MOD) examples/C $(F90_CHECK) $(PERL_OPT) python examples/python EXTRA_DIST = README AUTHORS NOTICE LICENSE ChangeLog version.sh html \ src/extrules.am \ @@ -93,12 +93,12 @@ EXTRA_DIST = README AUTHORS NOTICE LICENSE ChangeLog version.sh html \ data/spherical_pressure_level.grib1 \ data/missing.grib2 \ data/gfs.c255.grib2 \ - data/constant_field.grib1 \ - data/reduced_gaussian_pressure_level_constant.grib1 \ - data/reduced_latlon_surface_constant.grib1 \ - data/regular_gaussian_pressure_level_constant.grib1 \ - data/regular_latlon_surface_constant.grib1 \ - data/reduced_gaussian_sub_area.grib1 \ + data/constant_field.grib1 \ + data/reduced_gaussian_pressure_level_constant.grib1 \ + data/reduced_latlon_surface_constant.grib1 \ + data/regular_gaussian_pressure_level_constant.grib1 \ + data/regular_latlon_surface_constant.grib1 \ + data/reduced_gaussian_sub_area.grib1 \ data/constant_field.grib1 \ data/60_model_levels \ data/list_points \ diff --git a/VERSION.cmake b/VERSION.cmake index f29f069f6..281de7474 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -1,2 +1,2 @@ -set( ${PROJECT_NAME}_VERSION_STR "1.10.4" ) +set( ${PROJECT_NAME}_VERSION_STR "2.0.0" ) diff --git a/config/config.guess b/config/config.guess index 666c5ad92..fed1d3a1b 100755 --- a/config/config.guess +++ b/config/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. -timestamp='2009-11-20' +timestamp='2008-01-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,16 +27,16 @@ timestamp='2009-11-20' # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` @@ -139,16 +139,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -180,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ + | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -213,19 +203,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) - echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in @@ -290,13 +280,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-${VENDOR}-sysv4 + echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-amigaos + echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-morphos + echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -311,7 +301,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-${VENDOR}-riscos + echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp @@ -334,33 +324,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -419,7 +390,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-${VENDOR}-mint${UNAME_RELEASE} + echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} @@ -669,7 +640,7 @@ EOF # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -730,9 +701,9 @@ EOF exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-${VENDOR}-osf1mk + echo ${UNAME_MACHINE}-unknown-osf1mk else - echo ${UNAME_MACHINE}-${VENDOR}-osf1 + echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -792,19 +763,19 @@ EOF echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) - echo sparc-${VENDOR}-bsdi${UNAME_RELEASE} + echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) - echo i386-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) - echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) @@ -820,24 +791,21 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:*) + *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-${VENDOR}-interix${UNAME_RELEASE} + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) - echo ia64-${VENDOR}-interix${UNAME_RELEASE} + echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -848,25 +816,111 @@ EOF echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-${VENDOR}-cygwin + echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) - echo powerpcle-${VENDOR}-cygwin + echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) - echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -877,115 +931,105 @@ EOF EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac - objdump --private-headers /bin/sh | grep -q ld.so.1 + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu - else - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnueabi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-${VENDOR}-linux-gnu - exit ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-${VENDOR}-linux-gnu - exit ;; - padre:Linux:*:*) - echo sparc-${VENDOR}-linux-gnu - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;; - PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;; - *) echo hppa-${VENDOR}-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit ;; - ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux-gnu + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux-gnu + echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1006,16 +1050,16 @@ EOF echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-${VENDOR}-stop + echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-atheos + echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-${VENDOR}-lynxos${UNAME_RELEASE} + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp @@ -1035,7 +1079,7 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then @@ -1058,11 +1102,8 @@ EOF pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 @@ -1074,7 +1115,7 @@ EOF if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-${VENDOR}-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1100,30 +1141,20 @@ EOF 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-${VENDOR}-lynxos${UNAME_RELEASE} + echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-${VENDOR}-lynxos${UNAME_RELEASE} + echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE} + echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE} + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} @@ -1173,7 +1204,7 @@ EOF if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-${VENDOR}-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. @@ -1185,9 +1216,6 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1206,6 +1234,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-9:SUPER-UX:*:*) + echo sx9-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1215,16 +1246,6 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} @@ -1264,13 +1285,13 @@ EOF else UNAME_MACHINE="$cputype" fi - echo ${UNAME_MACHINE}-${VENDOR}-plan9 + echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) - echo pdp10-${VENDOR}-tops10 + echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) - echo pdp10-${VENDOR}-tenex + echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 @@ -1279,16 +1300,16 @@ EOF echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) - echo pdp10-${VENDOR}-tops20 + echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) - echo pdp10-${VENDOR}-its + echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1306,9 +1327,6 @@ EOF i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config/config.sub b/config/config.sub index 2a55a5075..6759825a5 100755 --- a/config/config.sub +++ b/config/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. -timestamp='2009-11-20' +timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -32,16 +32,13 @@ timestamp='2009-11-20' # Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -125,7 +122,6 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -152,13 +148,10 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; - -bluegene*) - os=-cnk - ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -256,16 +249,13 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ @@ -278,7 +268,6 @@ case $basic_machine in | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ - | moxie \ | mt \ | msp430 \ | nios | nios2 \ @@ -287,22 +276,20 @@ case $basic_machine in | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ - | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k | z80) + | z8k) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) + m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none @@ -342,17 +329,14 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ @@ -373,22 +357,21 @@ case $basic_machine in | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ - | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-* | z80-*) + | z8k-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) @@ -456,10 +439,6 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; - aros) - basic_machine=i386-pc - os=-aros - ;; aux) basic_machine=m68k-apple os=-aux @@ -476,18 +455,10 @@ case $basic_machine in basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; c90) basic_machine=c90-cray os=-unicos ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -555,10 +526,6 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp @@ -732,9 +699,6 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) - basic_machine=microblaze-xilinx - ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1164,10 +1128,6 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; none) basic_machine=none-none os=-none @@ -1206,7 +1166,7 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) @@ -1256,9 +1216,6 @@ case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1279,11 +1236,10 @@ case $os in # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ @@ -1292,7 +1248,7 @@ case $os in | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ @@ -1302,7 +1258,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1432,9 +1388,6 @@ case $os in -zvmoe) os=-zvmoe ;; - -dicos*) - os=-dicos - ;; -none) ;; *) @@ -1632,7 +1585,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -cnk*|-aix*) + -aix*) vendor=ibm ;; -beos*) diff --git a/config/depcomp b/config/depcomp index df8eea7e4..9e5522d04 100755 --- a/config/depcomp +++ b/config/depcomp @@ -1,10 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2009-04-28.21; # UTC +scriptversion=2003-11-08.23 -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free -# Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +16,9 @@ scriptversion=2009-04-28.21; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -42,18 +43,17 @@ Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF - exit $? + exit 0 ;; -v | --v*) echo "depcomp $scriptversion" - exit $? + exit 0 ;; esac @@ -61,10 +61,18 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -85,34 +93,12 @@ if test "$depmode" = dashXmstdout; then depmode=dashmstdout fi -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u="sed s,\\\\\\\\,/,g" - depmode=msvisualcpp -fi - case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else @@ -199,14 +185,14 @@ sgi) ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' -' ' ' >> "$depfile" - echo >> "$depfile" +' ' ' >> $depfile + echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" + >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -222,39 +208,34 @@ aix) # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u "$@" -M fi stat=$? + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + rm -f "$tmpdepfile" exit $stat fi - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done if test -f "$tmpdepfile"; then + outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -302,51 +283,6 @@ icc) rm -f "$tmpdepfile" ;; -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" - # Add `dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. @@ -358,43 +294,27 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. @@ -416,7 +336,7 @@ dashmstdout) # Remove the call to Libtool. if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do + while test $1 != '--mode=compile'; do shift done shift @@ -467,39 +387,32 @@ makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do + while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift - cleared=no eat=no - for arg - do + cleared=no + for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac - if test $eat = yes; then - eat=no - continue - fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done - obj_suffix=`echo "$object" | sed 's/^.*\././'` + obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" @@ -519,7 +432,7 @@ cpp) # Remove the call to Libtool. if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do + while test $1 != '--mode=compile'; do shift done shift @@ -545,8 +458,7 @@ cpp) done "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" @@ -557,27 +469,13 @@ cpp) msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - IFS=" " for arg do case "$arg" in - -o) - shift - ;; - $object) - shift - ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift @@ -590,23 +488,16 @@ msvisualcpp) ;; esac done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - none) exec "$@" ;; @@ -625,6 +516,5 @@ exit 0 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" +# time-stamp-end: "$" # End: diff --git a/config/install-sh b/config/install-sh index 6781b987b..36f96f3e0 100755 --- a/config/install-sh +++ b/config/install-sh @@ -1,520 +1,276 @@ #!/bin/sh +# # install - install a program, script, or datafile - -scriptversion=2009-04-28.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. +# This comes from X11R5 (mit/util/scripts/install.sh). # -# Copyright (C) 1994 X Consortium +# Copyright 1991 by the Massachusetts Institute of Technology # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. -nl=' -' -IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi +doit="${DOITPROG-}" -# Put in absolute file names if you don't have them in your path; -# or use environment vars. -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} +# put in absolute paths if you don't have them in your path; or use env. vars. -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" rmcmd="$rmprog -f" -stripcmd= +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" -src= -dst= -dir_arg= -dst_arg= +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; -copy_on_change=false -no_target_directory= + -d) dir_arg=true + shift + continue;; -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. + -o) chowncmd="$chownprog $2" + shift + shift + continue;; -Options: - --help display this help and exit. - --version display version info and exit. + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. + -s) stripcmd=$stripprog + shift + continue;; -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; -while test $# -ne 0; do - case $1 in - -c) ;; + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + *) if [ x"$src" = x ] then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" + src=$1 else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 fi - trap '' 0;; - esac;; + shift + continue;; esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi done -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/#inst.$$# + rmtmp=$dstdir/#rm.$$# + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} diff --git a/config/missing b/config/missing index 28055d2ae..6a37006e8 100755 --- a/config/missing +++ b/config/missing @@ -1,10 +1,6 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. - -scriptversion=2009-04-28.21; # UTC - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -18,7 +14,9 @@ scriptversion=2009-04-28.21; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -31,8 +29,6 @@ if test $# -eq 0; then fi run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. @@ -42,24 +38,18 @@ else configure_ac=configure.in fi -msg="missing on your system" - -case $1 in +case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in -h|--h|--he|--hel|--help) echo "\ @@ -77,7 +67,6 @@ Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c @@ -85,18 +74,11 @@ Supported PROGRAM values: lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. - -Send bug reports to ." - exit $? + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? + echo "missing 0.4 - GNU automake" ;; -*) @@ -105,69 +87,42 @@ Send bug reports to ." exit 1 ;; -esac - -# normalize program name to check for. -program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). This is about non-GNU programs, so use $1 not -# $program. -case $1 in - lex*|yacc*) - # Not GNU programs, they don't have --version. - ;; - - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) + aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 fi - ;; -esac -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $program in - aclocal*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; - autoconf*) + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; - autoheader*) + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -175,7 +130,7 @@ WARNING: \`$1' is $msg. You should only need it if test -z "$files" && files="config.h" touch_files= for f in $files; do - case $f in + case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; @@ -185,8 +140,13 @@ WARNING: \`$1' is $msg. You should only need it if ;; automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -195,16 +155,21 @@ WARNING: \`$1' is $msg. You should only need it if while read f; do touch "$f"; done ;; - autom4te*) + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU + You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else @@ -218,108 +183,111 @@ WARNING: \`$1' is needed, but is $msg. fi ;; - bison*|yacc*) + bison|yacc) echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h - if test $# -ne 1; then + if [ $# -ne 1 ]; then eval LASTARG="\${$#}" - case $LASTARG in + case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then + if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then + if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi - if test ! -f y.tab.h; then + if [ ! -f y.tab.h ]; then echo >y.tab.h fi - if test ! -f y.tab.c; then + if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; - lex*|flex*) + lex|flex) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c - if test $# -ne 1; then + if [ $# -ne 1 ]; then eval LASTARG="\${$#}" - case $LASTARG in + case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then + if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi - if test ! -f lex.yy.c; then + if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; - help2man*) + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" - exit $? + exit 1 fi ;; - makeinfo*) + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 touch $file ;; - tar*) + tar) shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error @@ -332,13 +300,13 @@ WARNING: \`$1' is $msg. You should only need it if fi firstarg="$1" if shift; then - case $firstarg in + case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac - case $firstarg in + case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 @@ -355,10 +323,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments. *) echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing + it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 @@ -366,11 +334,3 @@ WARNING: \`$1' is needed, and is $msg. esac exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/configure.ac b/configure.ac index b230f80ce..3568d6982 100755 --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,7 @@ AC_SUBST(PERLDIR) dnl Checks for programs. -AC_PROG_CC(xlc_r xlc gcc cc pgcc) +AC_PROG_CC(xlc_r xlc gcc cc pgcc) AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S @@ -72,15 +72,20 @@ AC_PROG_FC(pgf90 xlf90 gfortran f90 ifort) dnl check availability of pthreads AC_ARG_ENABLE([pthread], [AS_HELP_STRING([--enable-pthread],[enable POSIX threads [by default disabled]])], - GRIB_PTHREADS=1 , GRIB_PTHREADS=0 + [pthreads=${enableval}] , [pthreads=no] ) +if test "x${pthreads}" = xyes; then + GRIB_PTHREADS=1 +else + GRIB_PTHREADS=0 +fi if test $GRIB_PTHREADS -eq 1 then -AC_GRIB_PTHREADS -AC_GRIB_LINUX_PTHREADS + AC_GRIB_PTHREADS + AC_GRIB_LINUX_PTHREADS else -GRIB_LINUX_PTHREADS=0 + GRIB_LINUX_PTHREADS=0 fi AC_DEFINE_UNQUOTED(GRIB_PTHREADS,$GRIB_PTHREADS,1->pthreads enabled 0->pthreads disabled) @@ -123,10 +128,10 @@ AC_CHECK_FUNC([posix_memalign], AC_ARG_ENABLE([align-memory], [AS_HELP_STRING([--enable-align-memory],[enable memory alignment [by default disabled]])], -AC_DEFINE_UNQUOTED(GRIB_MEM_ALIGN,1,memory alignment required) , - ) + AC_DEFINE_UNQUOTED(GRIB_MEM_ALIGN,1,memory alignment required), +) -dnl use vectorised code +dnl use vectorised code AC_ARG_ENABLE([vector], [AS_HELP_STRING([--enable-vector],[enable vectorised code [by default disabled]] )], [vectorise=${enableval}],[vectorise=no]) @@ -162,6 +167,7 @@ fi AC_SUBST(DEVEL_RULES) AC_SUBST(GRIB_DEVEL) +AM_CONDITIONAL([WITH_MARS_TESTS], [test $GRIB_DEVEL -eq 1]) dnl Large file support AC_FUNC_FSEEKO @@ -206,7 +212,13 @@ AC_SUBST(GRIB_DEFINITION_PATH) dnl Fortran interface AC_ARG_ENABLE([fortran], [AS_HELP_STRING([--disable-fortran],[disable fortran interface [by default enabled]])], - without_fortran=1,without_fortran=0) + [with_fortran=${enableval}], [with_fortran=yes]) + +if test "x${with_fortran}" = xyes; then + without_fortran=0 +else + without_fortran=1 +fi if test "x$FC" = "x" then @@ -256,7 +268,7 @@ then AC_MSG_ERROR([unable to find compiler flag for modules inclusion]) fi F90_MODULE_FLAG=$ax_cv_f90_modflag - AC_SUBST([F90_MODULE_FLAG]) + AC_SUBST([F90_MODULE_FLAG]) fi dnl ifs_samples @@ -306,9 +318,8 @@ AC_SUBST(EMOS_LIB) dnl timer AC_ARG_ENABLE([timer], [AS_HELP_STRING([--enable-timer],[enable timer [by default disabled]])], - with_timer=1,with_timer=0) -if test ${with_timer} -eq 1 -then + [with_timer=${enableval}], [with_timer=no]) +if test "x${with_timer}" = xyes; then AC_DEFINE(GRIB_TIMER,1,1->Timer on 0->Timer off) else AC_DEFINE(GRIB_TIMER,0,1->Timer on 0->Timer off) @@ -318,9 +329,8 @@ fi dnl multithread packing AC_ARG_ENABLE([omp-packing], [AS_HELP_STRING([--enable-omp-packing],[enable OpenMP multithreaded packing [by default disabled]])], - with_omp=1,with_omp=0) -if test ${with_omp} -eq 1 -then + [with_omp=${enableval}], [with_omp=no]) +if test "x${with_omp}" = xyes; then AC_DEFINE(OMP_PACKING,1,1->OpenMP packing 0->single thread packing) else AC_DEFINE(OMP_PACKING,0,1->OpenMP packing 0->single thread packing) @@ -332,12 +342,12 @@ AC_ARG_WITH([netcdf], with_netcdf=0 if test $netcdf_dir != 'none' then - with_netcdf=1 - CFLAGS="$CFLAGS -I${netcdf_dir}/include" + with_netcdf=1 + CFLAGS="$CFLAGS -I${netcdf_dir}/include" LDFLAGS="$LDFLAGS -L${netcdf_dir}/lib" AC_CHECK_LIB(netcdf,nc_open,netcdf_ok=1,netcdf_ok=0) - if test $netcdf_ok -eq 0 - then + if test $netcdf_ok -eq 0 + then AC_MSG_NOTICE([ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CONFIGURATION ERROR: netcdf test not passed. @@ -348,7 +358,7 @@ then test 0 -eq 1 exit fi - LIBS="-lnetcdf $LIBS" + LIBS="-lnetcdf $LIBS" AC_DEFINE(HAVE_NETCDF,1,NETCDF enabled) fi @@ -401,16 +411,16 @@ then AC_SUBST(LIB_OPENJPEG) elif test $jasper_ok -eq 1 then - jpeg_ok=1 + jpeg_ok=1 LIB_JASPER='-ljasper' LIBS="$LIB_JASPER $LIBS" AC_DEFINE(HAVE_LIBJASPER,1,Define if you have JPEG version 2 "Jasper" library) AC_SUBST(LIB_JASPER) fi - if test $jpeg_ok -eq 0 - then - AC_MSG_NOTICE([ + if test $jpeg_ok -eq 0 + then + AC_MSG_NOTICE([ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CONFIGURATION ERROR: jpeg library (jasper or openjpeg) required. @@ -570,12 +580,12 @@ then has_numpy=`$PYTHON -c "import numpy;print numpy" 2> /dev/null` if test "x$has_numpy" = "x" then - AC_MSG_RESULT(no) - AC_MSG_ERROR([NumPy is not installed. Use --disable-numpy if you want to disable Numpy from the build.]) + AC_MSG_RESULT(no) + AC_MSG_ERROR([NumPy is not installed. Use --disable-numpy if you want to disable Numpy from the build.]) else - AC_MSG_RESULT(yes) - NUMPY_INCLUDE=`$PYTHON -c "import numpy;print numpy.get_include()"` - AC_SUBST(NUMPY_INCLUDE) + AC_MSG_RESULT(yes) + NUMPY_INCLUDE=`$PYTHON -c "import numpy;print numpy.get_include()"` + AC_SUBST(NUMPY_INCLUDE) fi else data_handler=array @@ -623,7 +633,7 @@ AC_CHECK_FUNCS([bzero gettimeofday]) AX_LINUX_DISTRIBUTION -AC_OUTPUT( Makefile src/Makefile fortran/Makefile tools/Makefile definitions/Makefile samples/Makefile ifs_samples/grib1/Makefile ifs_samples/grib1_mlgrib2/Makefile ifs_samples/grib1_mlgrib2_ieee64/Makefile tests/Makefile examples/C/Makefile examples/F90/Makefile tigge/Makefile perl/GRIB-API/Makefile.PL perl/Makefile python/Makefile examples/python/Makefile rpms/grib_api.spec rpms/grib_api.pc rpms/grib_api_f90.pc) +AC_OUTPUT( Makefile src/Makefile fortran/Makefile tools/Makefile definitions/Makefile samples/Makefile ifs_samples/grib1/Makefile ifs_samples/grib1_mlgrib2/Makefile ifs_samples/grib1_mlgrib2_ieee64/Makefile tests/Makefile mars_tests/Makefile examples/C/Makefile examples/F90/Makefile tigge/Makefile perl/GRIB-API/Makefile.PL perl/Makefile python/Makefile examples/python/Makefile rpms/grib_api.spec rpms/grib_api.pc rpms/grib_api_f90.pc) AC_MSG_NOTICE([ diff --git a/definitions/Makefile.am b/definitions/Makefile.am index b433fb2cd..224eac67d 100644 --- a/definitions/Makefile.am +++ b/definitions/Makefile.am @@ -254,6 +254,13 @@ dist_definitionsgrib1_localConcepts_edzw_DATA = \ grib1/localConcepts/edzw/shortName.def\ grib1/localConcepts/edzw/units.def +definitionsgrib1_localConcepts_kwbcdir = @GRIB_DEFINITION_PATH@/grib1/localConcepts/kwbc +dist_definitionsgrib1_localConcepts_kwbc_DATA = \ + grib1/localConcepts/kwbc/name.def\ + grib1/localConcepts/kwbc/paramId.def\ + grib1/localConcepts/kwbc/shortName.def\ + grib1/localConcepts/kwbc/units.def + definitionsgrib1_localConcepts_lfpwdir = @GRIB_DEFINITION_PATH@/grib1/localConcepts/lfpw dist_definitionsgrib1_localConcepts_lfpw_DATA = \ grib1/localConcepts/lfpw/name.def\ diff --git a/definitions/budg/boot.def b/definitions/budg/boot.def index 6978541d5..04b4c84af 100644 --- a/definitions/budg/boot.def +++ b/definitions/budg/boot.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/budg/mars_labeling.def b/definitions/budg/mars_labeling.def index 3edf8c352..aa7b3768d 100644 --- a/definitions/budg/mars_labeling.def +++ b/definitions/budg/mars_labeling.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/budg/section.1.def b/definitions/budg/section.1.def index 96dc74707..8a581b178 100644 --- a/definitions/budg/section.1.def +++ b/definitions/budg/section.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/budg/section.4.def b/definitions/budg/section.4.def index f3e9a7710..9ac581abb 100644 --- a/definitions/budg/section.4.def +++ b/definitions/budg/section.4.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/boot.def b/definitions/bufr/boot.def index f69571e29..76752b2fd 100644 --- a/definitions/bufr/boot.def +++ b/definitions/bufr/boot.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/old_section.1.def b/definitions/bufr/old_section.1.def index 9379195c5..d29069a79 100644 --- a/definitions/bufr/old_section.1.def +++ b/definitions/bufr/old_section.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/section.0.def b/definitions/bufr/section.0.def index 5e007f62b..aecd766c6 100644 --- a/definitions/bufr/section.0.def +++ b/definitions/bufr/section.0.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/section.1.def b/definitions/bufr/section.1.def index 2b3a2f6bd..005e0a3e9 100644 --- a/definitions/bufr/section.1.def +++ b/definitions/bufr/section.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/section.2.def b/definitions/bufr/section.2.def index bbf300e13..4732a504d 100644 --- a/definitions/bufr/section.2.def +++ b/definitions/bufr/section.2.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/section.3.def b/definitions/bufr/section.3.def index 7b0fc97c3..9aa9d3fa2 100644 --- a/definitions/bufr/section.3.def +++ b/definitions/bufr/section.3.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/section.4.def b/definitions/bufr/section.4.def index 9eed3a171..d70adccf4 100644 --- a/definitions/bufr/section.4.def +++ b/definitions/bufr/section.4.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/bufr/section.5.def b/definitions/bufr/section.5.def index dfc18d5a9..221096135 100644 --- a/definitions/bufr/section.5.def +++ b/definitions/bufr/section.5.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/2.98.131.table b/definitions/grib1/2.98.131.table index 948f4bb1a..fbf6780d2 100644 --- a/definitions/grib1/2.98.131.table +++ b/definitions/grib1/2.98.131.table @@ -71,4 +71,4 @@ 228 228 TPP Total precipitation probability percentage 229 229 SWHP Significant wave height probability percentage 232 232 MWPP Mean wave period probability percentage -255 255 - Indicates a missing value +255 255 - Indicates a missing value diff --git a/definitions/grib1/boot.def b/definitions/grib1/boot.def index 0739bd553..17b8e7a63 100644 --- a/definitions/grib1/boot.def +++ b/definitions/grib1/boot.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.grid_ieee.def b/definitions/grib1/data.grid_ieee.def index 78918a6d4..6ba577ef5 100644 --- a/definitions/grib1/data.grid_ieee.def +++ b/definitions/grib1/data.grid_ieee.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.grid_second_order.def b/definitions/grib1/data.grid_second_order.def index 5f9bbff2e..e23ddcf7a 100644 --- a/definitions/grib1/data.grid_second_order.def +++ b/definitions/grib1/data.grid_second_order.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.grid_second_order_constant_width.def b/definitions/grib1/data.grid_second_order_constant_width.def index e6bb4d791..609b0529d 100644 --- a/definitions/grib1/data.grid_second_order_constant_width.def +++ b/definitions/grib1/data.grid_second_order_constant_width.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.grid_second_order_general_grib1.def b/definitions/grib1/data.grid_second_order_general_grib1.def index c8e2f2f4c..f52492a71 100644 --- a/definitions/grib1/data.grid_second_order_general_grib1.def +++ b/definitions/grib1/data.grid_second_order_general_grib1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.grid_second_order_row_by_row.def b/definitions/grib1/data.grid_second_order_row_by_row.def index b50d079f6..df5854f14 100644 --- a/definitions/grib1/data.grid_second_order_row_by_row.def +++ b/definitions/grib1/data.grid_second_order_row_by_row.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.grid_simple.def b/definitions/grib1/data.grid_simple.def index 0603b91d6..a1f863c36 100644 --- a/definitions/grib1/data.grid_simple.def +++ b/definitions/grib1/data.grid_simple.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.grid_simple_matrix.def b/definitions/grib1/data.grid_simple_matrix.def index c3c8fd2bc..1b3343fb2 100644 --- a/definitions/grib1/data.grid_simple_matrix.def +++ b/definitions/grib1/data.grid_simple_matrix.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.spectral_complex.def b/definitions/grib1/data.spectral_complex.def index 5e8ff7bd4..4bc781778 100644 --- a/definitions/grib1/data.spectral_complex.def +++ b/definitions/grib1/data.spectral_complex.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.spectral_ieee.def b/definitions/grib1/data.spectral_ieee.def index ba2dde8fb..36043c7d7 100644 --- a/definitions/grib1/data.spectral_ieee.def +++ b/definitions/grib1/data.spectral_ieee.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/data.spectral_simple.def b/definitions/grib1/data.spectral_simple.def index 6cfd7139b..fd2499e9e 100644 --- a/definitions/grib1/data.spectral_simple.def +++ b/definitions/grib1/data.spectral_simple.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/gds_not_present_bitmap.def b/definitions/grib1/gds_not_present_bitmap.def index 315676409..4fe3073e1 100644 --- a/definitions/grib1/gds_not_present_bitmap.def +++ b/definitions/grib1/gds_not_present_bitmap.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_21.def b/definitions/grib1/grid_21.def index da80e5825..9623391ce 100644 --- a/definitions/grib1/grid_21.def +++ b/definitions/grib1/grid_21.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_22.def b/definitions/grib1/grid_22.def index 506dded25..30a60062b 100644 --- a/definitions/grib1/grid_22.def +++ b/definitions/grib1/grid_22.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_23.def b/definitions/grib1/grid_23.def index 66cb46fdd..f62ca59f3 100644 --- a/definitions/grib1/grid_23.def +++ b/definitions/grib1/grid_23.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_24.def b/definitions/grib1/grid_24.def index bc6a1417e..4826ab9a0 100644 --- a/definitions/grib1/grid_24.def +++ b/definitions/grib1/grid_24.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_25.def b/definitions/grib1/grid_25.def index 8757dffaa..df52ff50e 100644 --- a/definitions/grib1/grid_25.def +++ b/definitions/grib1/grid_25.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_26.def b/definitions/grib1/grid_26.def index 5169574e3..3b2c7f3e0 100644 --- a/definitions/grib1/grid_26.def +++ b/definitions/grib1/grid_26.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_61.def b/definitions/grib1/grid_61.def index 973f208ab..677ba7438 100644 --- a/definitions/grib1/grid_61.def +++ b/definitions/grib1/grid_61.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_62.def b/definitions/grib1/grid_62.def index d97606011..3e23c4279 100644 --- a/definitions/grib1/grid_62.def +++ b/definitions/grib1/grid_62.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_63.def b/definitions/grib1/grid_63.def index 1f33173c2..012c8487b 100644 --- a/definitions/grib1/grid_63.def +++ b/definitions/grib1/grid_63.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_64.def b/definitions/grib1/grid_64.def index b3568a91d..2971f34de 100644 --- a/definitions/grib1/grid_64.def +++ b/definitions/grib1/grid_64.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_0.def b/definitions/grib1/grid_definition_0.def index 39e49932c..75a3b822c 100644 --- a/definitions/grib1/grid_definition_0.def +++ b/definitions/grib1/grid_definition_0.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_1.def b/definitions/grib1/grid_definition_1.def index 8ffd1d4fd..195e2ff8d 100644 --- a/definitions/grib1/grid_definition_1.def +++ b/definitions/grib1/grid_definition_1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_10.def b/definitions/grib1/grid_definition_10.def index 6b07a956c..3d55303c5 100644 --- a/definitions/grib1/grid_definition_10.def +++ b/definitions/grib1/grid_definition_10.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_13.def b/definitions/grib1/grid_definition_13.def index f6f6fa1b3..a178d17e0 100644 --- a/definitions/grib1/grid_definition_13.def +++ b/definitions/grib1/grid_definition_13.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_14.def b/definitions/grib1/grid_definition_14.def index 0a5156777..aeaa42e78 100644 --- a/definitions/grib1/grid_definition_14.def +++ b/definitions/grib1/grid_definition_14.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_192.78.def b/definitions/grib1/grid_definition_192.78.def index 25db40a72..be7403232 100755 --- a/definitions/grib1/grid_definition_192.78.def +++ b/definitions/grib1/grid_definition_192.78.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_192.98.def b/definitions/grib1/grid_definition_192.98.def index c740876af..0435ce745 100644 --- a/definitions/grib1/grid_definition_192.98.def +++ b/definitions/grib1/grid_definition_192.98.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_193.98.def b/definitions/grib1/grid_definition_193.98.def index 6c3340167..c9c1c23ff 100644 --- a/definitions/grib1/grid_definition_193.98.def +++ b/definitions/grib1/grid_definition_193.98.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_20.def b/definitions/grib1/grid_definition_20.def index 43106fc7a..ac8fdf52e 100644 --- a/definitions/grib1/grid_definition_20.def +++ b/definitions/grib1/grid_definition_20.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_24.def b/definitions/grib1/grid_definition_24.def index 2b451117c..1177976cb 100644 --- a/definitions/grib1/grid_definition_24.def +++ b/definitions/grib1/grid_definition_24.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_3.def b/definitions/grib1/grid_definition_3.def index c73a18005..58ffac96d 100644 --- a/definitions/grib1/grid_definition_3.def +++ b/definitions/grib1/grid_definition_3.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_30.def b/definitions/grib1/grid_definition_30.def index 08b93b351..f78678a8e 100644 --- a/definitions/grib1/grid_definition_30.def +++ b/definitions/grib1/grid_definition_30.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_34.def b/definitions/grib1/grid_definition_34.def index af1d9b138..df8c3182a 100644 --- a/definitions/grib1/grid_definition_34.def +++ b/definitions/grib1/grid_definition_34.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_4.def b/definitions/grib1/grid_definition_4.def index 85ec48eb9..587a7e519 100644 --- a/definitions/grib1/grid_definition_4.def +++ b/definitions/grib1/grid_definition_4.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_5.def b/definitions/grib1/grid_definition_5.def index 1bceb7d6d..deaf66be1 100644 --- a/definitions/grib1/grid_definition_5.def +++ b/definitions/grib1/grid_definition_5.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_50.def b/definitions/grib1/grid_definition_50.def index 85e826440..bff21aa3e 100644 --- a/definitions/grib1/grid_definition_50.def +++ b/definitions/grib1/grid_definition_50.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_60.def b/definitions/grib1/grid_definition_60.def index c0908f07a..e3274e586 100644 --- a/definitions/grib1/grid_definition_60.def +++ b/definitions/grib1/grid_definition_60.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_70.def b/definitions/grib1/grid_definition_70.def index 60abda636..4b4a6a359 100644 --- a/definitions/grib1/grid_definition_70.def +++ b/definitions/grib1/grid_definition_70.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_8.def b/definitions/grib1/grid_definition_8.def index 510820c31..14cb280a3 100644 --- a/definitions/grib1/grid_definition_8.def +++ b/definitions/grib1/grid_definition_8.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_80.def b/definitions/grib1/grid_definition_80.def index 3b1fe3f21..753733962 100644 --- a/definitions/grib1/grid_definition_80.def +++ b/definitions/grib1/grid_definition_80.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_90.def b/definitions/grib1/grid_definition_90.def index e071c587a..2ac05ead1 100644 --- a/definitions/grib1/grid_definition_90.def +++ b/definitions/grib1/grid_definition_90.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_gaussian.def b/definitions/grib1/grid_definition_gaussian.def index 2b7e092ed..388b0161b 100644 --- a/definitions/grib1/grid_definition_gaussian.def +++ b/definitions/grib1/grid_definition_gaussian.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_latlon.def b/definitions/grib1/grid_definition_latlon.def index 80f77c8de..ee6745b35 100644 --- a/definitions/grib1/grid_definition_latlon.def +++ b/definitions/grib1/grid_definition_latlon.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_definition_spherical_harmonics.def b/definitions/grib1/grid_definition_spherical_harmonics.def index c9c296790..031675735 100644 --- a/definitions/grib1/grid_definition_spherical_harmonics.def +++ b/definitions/grib1/grid_definition_spherical_harmonics.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_first_last_resandcomp.def b/definitions/grib1/grid_first_last_resandcomp.def index aba416416..55f65782e 100644 --- a/definitions/grib1/grid_first_last_resandcomp.def +++ b/definitions/grib1/grid_first_last_resandcomp.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_rotation.def b/definitions/grib1/grid_rotation.def index 0e649e665..f18587049 100644 --- a/definitions/grib1/grid_rotation.def +++ b/definitions/grib1/grid_rotation.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/grid_stretching.def b/definitions/grib1/grid_stretching.def index fd38380db..884fb099f 100644 --- a/definitions/grib1/grid_stretching.def +++ b/definitions/grib1/grid_stretching.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.1.def b/definitions/grib1/local.1.def index b630ec7c0..85aa1ee31 100644 --- a/definitions/grib1/local.1.def +++ b/definitions/grib1/local.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.214.1.def b/definitions/grib1/local.214.1.def index 7feb6bcbc..ce7e4c28e 100644 --- a/definitions/grib1/local.214.1.def +++ b/definitions/grib1/local.214.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.214.244.def b/definitions/grib1/local.214.244.def index 9fa9a92b3..cf928f7e8 100644 --- a/definitions/grib1/local.214.244.def +++ b/definitions/grib1/local.214.244.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.214.245.def b/definitions/grib1/local.214.245.def index 0afdfcebf..9259b7ed6 100644 --- a/definitions/grib1/local.214.245.def +++ b/definitions/grib1/local.214.245.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.253.def b/definitions/grib1/local.253.def index 923ba8199..87736ad1d 100644 --- a/definitions/grib1/local.253.def +++ b/definitions/grib1/local.253.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.254.def b/definitions/grib1/local.254.def index 6a42f65d0..7f04840a3 100644 --- a/definitions/grib1/local.254.def +++ b/definitions/grib1/local.254.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.46.def b/definitions/grib1/local.46.def index a69f24d78..03bf4a832 100644 --- a/definitions/grib1/local.46.def +++ b/definitions/grib1/local.46.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.54.def b/definitions/grib1/local.54.def index 2227db96f..1fcfe7a40 100644 --- a/definitions/grib1/local.54.def +++ b/definitions/grib1/local.54.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.7.1.def b/definitions/grib1/local.7.1.def index 5388fdd44..938315e6a 100644 --- a/definitions/grib1/local.7.1.def +++ b/definitions/grib1/local.7.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.80.def b/definitions/grib1/local.80.def index 4b3a245fd..0470b7036 100644 --- a/definitions/grib1/local.80.def +++ b/definitions/grib1/local.80.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.1.def b/definitions/grib1/local.98.1.def index 0ecc734c5..4dea22c29 100644 --- a/definitions/grib1/local.98.1.def +++ b/definitions/grib1/local.98.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.10.def b/definitions/grib1/local.98.10.def index 51a0e2a41..e4ce686a7 100644 --- a/definitions/grib1/local.98.10.def +++ b/definitions/grib1/local.98.10.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.11.def b/definitions/grib1/local.98.11.def index fd8fef3d4..c1677c8ff 100644 --- a/definitions/grib1/local.98.11.def +++ b/definitions/grib1/local.98.11.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.14.def b/definitions/grib1/local.98.14.def index 0379df571..b910dc74d 100644 --- a/definitions/grib1/local.98.14.def +++ b/definitions/grib1/local.98.14.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.15.def b/definitions/grib1/local.98.15.def index 3025c5309..40f9217f7 100644 --- a/definitions/grib1/local.98.15.def +++ b/definitions/grib1/local.98.15.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.16.def b/definitions/grib1/local.98.16.def index 05b98c354..3534522f5 100644 --- a/definitions/grib1/local.98.16.def +++ b/definitions/grib1/local.98.16.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.17.def b/definitions/grib1/local.98.17.def index 225134826..93ca9caec 100644 --- a/definitions/grib1/local.98.17.def +++ b/definitions/grib1/local.98.17.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.18.def b/definitions/grib1/local.98.18.def index 6482e657e..574534124 100644 --- a/definitions/grib1/local.98.18.def +++ b/definitions/grib1/local.98.18.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.19.def b/definitions/grib1/local.98.19.def index 834b7a49c..b1a4ef759 100644 --- a/definitions/grib1/local.98.19.def +++ b/definitions/grib1/local.98.19.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.190.def b/definitions/grib1/local.98.190.def index 1d0cd660e..c53e07c97 100644 --- a/definitions/grib1/local.98.190.def +++ b/definitions/grib1/local.98.190.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.191.def b/definitions/grib1/local.98.191.def index ff9e3bda3..6dd4c4713 100644 --- a/definitions/grib1/local.98.191.def +++ b/definitions/grib1/local.98.191.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.192.def b/definitions/grib1/local.98.192.def index f13b45faf..ba519dc6e 100644 --- a/definitions/grib1/local.98.192.def +++ b/definitions/grib1/local.98.192.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.2.def b/definitions/grib1/local.98.2.def index 53acd7e8e..de060a6cc 100644 --- a/definitions/grib1/local.98.2.def +++ b/definitions/grib1/local.98.2.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.20.def b/definitions/grib1/local.98.20.def index b2650e120..908349ae2 100644 --- a/definitions/grib1/local.98.20.def +++ b/definitions/grib1/local.98.20.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.21.def b/definitions/grib1/local.98.21.def index 10c2b14f1..972123f19 100644 --- a/definitions/grib1/local.98.21.def +++ b/definitions/grib1/local.98.21.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.218.def b/definitions/grib1/local.98.218.def index 9ec77a9c5..677d5bb73 100644 --- a/definitions/grib1/local.98.218.def +++ b/definitions/grib1/local.98.218.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.23.def b/definitions/grib1/local.98.23.def index 157c949ac..5d578a2d4 100644 --- a/definitions/grib1/local.98.23.def +++ b/definitions/grib1/local.98.23.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.24.def b/definitions/grib1/local.98.24.def index f51ed85a2..2e7b04126 100644 --- a/definitions/grib1/local.98.24.def +++ b/definitions/grib1/local.98.24.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.25.def b/definitions/grib1/local.98.25.def index a64913a06..b4097d714 100644 --- a/definitions/grib1/local.98.25.def +++ b/definitions/grib1/local.98.25.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.26.def b/definitions/grib1/local.98.26.def index b8db7859f..4a1f4134a 100644 --- a/definitions/grib1/local.98.26.def +++ b/definitions/grib1/local.98.26.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.28.def b/definitions/grib1/local.98.28.def index 1cb340712..c9d5b2051 100644 --- a/definitions/grib1/local.98.28.def +++ b/definitions/grib1/local.98.28.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.29.def b/definitions/grib1/local.98.29.def index 2317e35f4..25085dcae 100644 --- a/definitions/grib1/local.98.29.def +++ b/definitions/grib1/local.98.29.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.3.def b/definitions/grib1/local.98.3.def index 4f8408fc5..15bb96beb 100644 --- a/definitions/grib1/local.98.3.def +++ b/definitions/grib1/local.98.3.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.31.def b/definitions/grib1/local.98.31.def index 7963a7828..c53c5280b 100644 --- a/definitions/grib1/local.98.31.def +++ b/definitions/grib1/local.98.31.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.32.def b/definitions/grib1/local.98.32.def index 654a464a9..793f776f5 100644 --- a/definitions/grib1/local.98.32.def +++ b/definitions/grib1/local.98.32.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.33.def b/definitions/grib1/local.98.33.def index bec5d3b32..97b25758a 100644 --- a/definitions/grib1/local.98.33.def +++ b/definitions/grib1/local.98.33.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.35.def b/definitions/grib1/local.98.35.def index 9ca59ced4..3c12081d2 100644 --- a/definitions/grib1/local.98.35.def +++ b/definitions/grib1/local.98.35.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.36.def b/definitions/grib1/local.98.36.def index 2be4b42ba..bd2cd6371 100644 --- a/definitions/grib1/local.98.36.def +++ b/definitions/grib1/local.98.36.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.37.def b/definitions/grib1/local.98.37.def index d9ede3e8f..b518a9a32 100644 --- a/definitions/grib1/local.98.37.def +++ b/definitions/grib1/local.98.37.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.38.def b/definitions/grib1/local.98.38.def index fe3fbe463..b16a95256 100644 --- a/definitions/grib1/local.98.38.def +++ b/definitions/grib1/local.98.38.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.39.def b/definitions/grib1/local.98.39.def index 0f404918a..dc383b82a 100644 --- a/definitions/grib1/local.98.39.def +++ b/definitions/grib1/local.98.39.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.4.def b/definitions/grib1/local.98.4.def index 3768c3c9b..9127ff0aa 100644 --- a/definitions/grib1/local.98.4.def +++ b/definitions/grib1/local.98.4.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.5.def b/definitions/grib1/local.98.5.def index 3ff722f27..21715530c 100644 --- a/definitions/grib1/local.98.5.def +++ b/definitions/grib1/local.98.5.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.50.def b/definitions/grib1/local.98.50.def index e1e3c2f04..c220b73c0 100644 --- a/definitions/grib1/local.98.50.def +++ b/definitions/grib1/local.98.50.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.6.def b/definitions/grib1/local.98.6.def index 3e69998bd..1192420a2 100644 --- a/definitions/grib1/local.98.6.def +++ b/definitions/grib1/local.98.6.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.7.def b/definitions/grib1/local.98.7.def index 1b2c6176b..1703e83e8 100644 --- a/definitions/grib1/local.98.7.def +++ b/definitions/grib1/local.98.7.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.8.def b/definitions/grib1/local.98.8.def index e25383c55..e0017b0a4 100644 --- a/definitions/grib1/local.98.8.def +++ b/definitions/grib1/local.98.8.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.9.def b/definitions/grib1/local.98.9.def index 8633f944e..1b5e9d7f4 100644 --- a/definitions/grib1/local.98.9.def +++ b/definitions/grib1/local.98.9.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local.98.def b/definitions/grib1/local.98.def index 77b4550ad..adb1aa2c4 100644 --- a/definitions/grib1/local.98.def +++ b/definitions/grib1/local.98.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/localConcepts/kwbc/name.def b/definitions/grib1/localConcepts/kwbc/name.def new file mode 100644 index 000000000..704ff9aad --- /dev/null +++ b/definitions/grib1/localConcepts/kwbc/name.def @@ -0,0 +1,2 @@ +'Snow Depth' = { table2Version=128; indicatorOfParameter =141; } + diff --git a/definitions/grib1/localConcepts/kwbc/paramId.def b/definitions/grib1/localConcepts/kwbc/paramId.def new file mode 100644 index 000000000..9dbc6d661 --- /dev/null +++ b/definitions/grib1/localConcepts/kwbc/paramId.def @@ -0,0 +1,2 @@ +'260056' = { table2Version=128; indicatorOfParameter =141; } + diff --git a/definitions/grib1/localConcepts/kwbc/shortName.def b/definitions/grib1/localConcepts/kwbc/shortName.def new file mode 100644 index 000000000..f0835a6fe --- /dev/null +++ b/definitions/grib1/localConcepts/kwbc/shortName.def @@ -0,0 +1,2 @@ +'sd' = { table2Version=128; indicatorOfParameter =141; } + diff --git a/definitions/grib1/localConcepts/kwbc/units.def b/definitions/grib1/localConcepts/kwbc/units.def new file mode 100644 index 000000000..024d497a5 --- /dev/null +++ b/definitions/grib1/localConcepts/kwbc/units.def @@ -0,0 +1,2 @@ +'m of water equivalent' = { table2Version=128; indicatorOfParameter =141; } + diff --git a/definitions/grib1/local_no_mars.98.1.def b/definitions/grib1/local_no_mars.98.1.def index 9d66df949..e9934b248 100644 --- a/definitions/grib1/local_no_mars.98.1.def +++ b/definitions/grib1/local_no_mars.98.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/local_no_mars.98.24.def b/definitions/grib1/local_no_mars.98.24.def index dca45e187..6a9a0ca59 100644 --- a/definitions/grib1/local_no_mars.98.24.def +++ b/definitions/grib1/local_no_mars.98.24.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/mars_labeling.23.def b/definitions/grib1/mars_labeling.23.def index 9e691ff03..2cef152eb 100644 --- a/definitions/grib1/mars_labeling.23.def +++ b/definitions/grib1/mars_labeling.23.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/mars_labeling.4.def b/definitions/grib1/mars_labeling.4.def index 84a84180d..d941d0e52 100644 --- a/definitions/grib1/mars_labeling.4.def +++ b/definitions/grib1/mars_labeling.4.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/mars_labeling.def b/definitions/grib1/mars_labeling.def index 44ac07f1a..f1b449bb1 100644 --- a/definitions/grib1/mars_labeling.def +++ b/definitions/grib1/mars_labeling.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/predefined_grid.def b/definitions/grib1/predefined_grid.def index 04688c561..118eea754 100644 --- a/definitions/grib1/predefined_grid.def +++ b/definitions/grib1/predefined_grid.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/scanning_mode.def b/definitions/grib1/scanning_mode.def index 57427cfc1..c3eabcb23 100644 --- a/definitions/grib1/scanning_mode.def +++ b/definitions/grib1/scanning_mode.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/section.0.def b/definitions/grib1/section.0.def index 5e007f62b..aecd766c6 100644 --- a/definitions/grib1/section.0.def +++ b/definitions/grib1/section.0.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/section.3.def b/definitions/grib1/section.3.def index db79e75d0..4ed917c83 100644 --- a/definitions/grib1/section.3.def +++ b/definitions/grib1/section.3.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib1/section.5.def b/definitions/grib1/section.5.def index 6cbaf9f45..1eeb478b7 100644 --- a/definitions/grib1/section.5.def +++ b/definitions/grib1/section.5.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/grib2/localConcepts/ecmf/name.def b/definitions/grib2/localConcepts/ecmf/name.def index 0caa799a4..ee94ef3ca 100644 --- a/definitions/grib2/localConcepts/ecmf/name.def +++ b/definitions/grib2/localConcepts/ecmf/name.def @@ -14863,18 +14863,57 @@ parameterNumber = 255 ; } #Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio +'Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 3 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio 'Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 1 ; } #Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio +'Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 6 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; +} +#Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio 'Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 2 ; } #Sea Salt Aerosol (5 - 20 um) Mixing Ratio +'Sea Salt Aerosol (5 - 20 um) Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 6 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (5 - 20 um) Mixing Ratio 'Sea Salt Aerosol (5 - 20 um) Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; @@ -14900,42 +14939,113 @@ parameterNumber = 4 ; } #Dust Aerosol (0.55 - 0.9 um) Mixing Ratio +'Dust Aerosol (0.55 - 0.9 um) Mixing Ratio' = { + discipline = 0; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 9 ; + scaledValueOfFirstSize = 55 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.55 - 0.9 um) Mixing Ratio 'Dust Aerosol (0.55 - 0.9 um) Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 5 ; } #Dust Aerosol (0.9 - 20 um) Mixing Ratio +'Dust Aerosol (0.9 - 20 um) Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 9 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.9 - 20 um) Mixing Ratio 'Dust Aerosol (0.9 - 20 um) Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 6 ; } #Hydrophobic Organic Matter Aerosol Mixing Ratio +'Hydrophobic Organic Matter Aerosol Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62016 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Organic Matter Aerosol Mixing Ratio 'Hydrophobic Organic Matter Aerosol Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 7 ; } #Hydrophilic Organic Matter Aerosol Mixing Ratio +'Hydrophilic Organic Matter Aerosol Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62015 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Organic Matter Aerosol Mixing Ratio 'Hydrophilic Organic Matter Aerosol Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 8 ; } #Hydrophobic Black Carbon Aerosol Mixing Ratio +'Hydrophobic Black Carbon Aerosol Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62014 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Black Carbon Aerosol Mixing Ratio 'Hydrophobic Black Carbon Aerosol Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 9 ; } #Hydrophilic Black Carbon Aerosol Mixing Ratio +'Hydrophilic Black Carbon Aerosol Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62013 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Black Carbon Aerosol Mixing Ratio 'Hydrophilic Black Carbon Aerosol Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 10 ; } #Sulphate Aerosol Mixing Ratio +'Sulphate Aerosol Mixing Ratio' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62006 ; + typeOfSizeInterval = 255 ; + } +#Sulphate Aerosol Mixing Ratio 'Sulphate Aerosol Mixing Ratio' = { discipline = 192 ; parameterCategory = 210 ; @@ -15160,6 +15270,14 @@ parameterNumber = 61 ; } #Methane +'Methane' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 2 ; + } +#Methane 'Methane' = { discipline = 192 ; parameterCategory = 210 ; @@ -15352,18 +15470,42 @@ parameterNumber = 121 ; } #Sulphur dioxide +'Sulphur dioxide' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 8 ; + } +#Sulphur dioxide 'Sulphur dioxide' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 122 ; } #Carbon monoxide +'Carbon monoxide' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 4 ; + } +#Carbon monoxide 'Carbon monoxide' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 123 ; } #Formaldehyde +'Formaldehyde' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 7 ; + } +#Formaldehyde 'Formaldehyde' = { discipline = 192 ; parameterCategory = 210 ; @@ -15394,6 +15536,14 @@ parameterNumber = 128 ; } #Nitrogen Oxides +'Nitrogen Oxides' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 65535 ; + } +#Nitrogen Oxides 'Nitrogen Oxides' = { discipline = 192 ; parameterCategory = 210 ; @@ -15652,6 +15802,14 @@ parameterNumber = 185 ; } #GEMS Ozone +'GEMS Ozone' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 0 ; + } +#GEMS Ozone 'GEMS Ozone' = { discipline = 192 ; parameterCategory = 210 ; diff --git a/definitions/grib2/localConcepts/ecmf/paramId.def b/definitions/grib2/localConcepts/ecmf/paramId.def index 89a280304..b6bfd0a7c 100644 --- a/definitions/grib2/localConcepts/ecmf/paramId.def +++ b/definitions/grib2/localConcepts/ecmf/paramId.def @@ -14863,18 +14863,57 @@ parameterNumber = 255 ; } #Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio +'210001' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 3 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio '210001' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 1 ; } #Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio +'210002' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 6 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; +} +#Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio '210002' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 2 ; } #Sea Salt Aerosol (5 - 20 um) Mixing Ratio +'210003' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 6 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (5 - 20 um) Mixing Ratio '210003' = { discipline = 192 ; parameterCategory = 210 ; @@ -14900,42 +14939,113 @@ parameterNumber = 4 ; } #Dust Aerosol (0.55 - 0.9 um) Mixing Ratio +'210005' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 9 ; + scaledValueOfFirstSize = 55 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.55 - 0.9 um) Mixing Ratio '210005' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 5 ; } #Dust Aerosol (0.9 - 20 um) Mixing Ratio +'210006' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 9 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.9 - 20 um) Mixing Ratio '210006' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 6 ; } #Hydrophobic Organic Matter Aerosol Mixing Ratio +'210007' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62016 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Organic Matter Aerosol Mixing Ratio '210007' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 7 ; } #Hydrophilic Organic Matter Aerosol Mixing Ratio +'210008' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62015 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Organic Matter Aerosol Mixing Ratio '210008' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 8 ; } #Hydrophobic Black Carbon Aerosol Mixing Ratio +'210009' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62014 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Black Carbon Aerosol Mixing Ratio '210009' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 9 ; } #Hydrophilic Black Carbon Aerosol Mixing Ratio +'210010' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62013 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Black Carbon Aerosol Mixing Ratio '210010' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 10 ; } #Sulphate Aerosol Mixing Ratio +'210011' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62006 ; + typeOfSizeInterval = 255 ; + } +#Sulphate Aerosol Mixing Ratio '210011' = { discipline = 192 ; parameterCategory = 210 ; @@ -15160,6 +15270,14 @@ parameterNumber = 61 ; } #Methane +'210062' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 2 ; + } +#Methane '210062' = { discipline = 192 ; parameterCategory = 210 ; @@ -15352,18 +15470,42 @@ parameterNumber = 121 ; } #Sulphur dioxide +'210122' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 8 ; + } +#Sulphur dioxide '210122' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 122 ; } #Carbon monoxide +'210123' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 4 ; + } +#Carbon monoxide '210123' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 123 ; } #Formaldehyde +'210124' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 7 ; + } +#Formaldehyde '210124' = { discipline = 192 ; parameterCategory = 210 ; @@ -15394,6 +15536,14 @@ parameterNumber = 128 ; } #Nitrogen Oxides +'210129' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 65535 ; + } +#Nitrogen Oxides '210129' = { discipline = 192 ; parameterCategory = 210 ; @@ -15652,6 +15802,14 @@ parameterNumber = 185 ; } #GEMS Ozone +'210203' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 0 ; + } +#GEMS Ozone '210203' = { discipline = 192 ; parameterCategory = 210 ; diff --git a/definitions/grib2/localConcepts/ecmf/shortName.def b/definitions/grib2/localConcepts/ecmf/shortName.def index 7eb462883..465a44a88 100644 --- a/definitions/grib2/localConcepts/ecmf/shortName.def +++ b/definitions/grib2/localConcepts/ecmf/shortName.def @@ -14863,18 +14863,57 @@ parameterNumber = 255 ; } #Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio +'aermr01' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 3 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio 'aermr01' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 1 ; } #Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio +'aermr02' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 6 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; +} +#Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio 'aermr02' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 2 ; } #Sea Salt Aerosol (5 - 20 um) Mixing Ratio +'aermr03' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 6 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (5 - 20 um) Mixing Ratio 'aermr03' = { discipline = 192 ; parameterCategory = 210 ; @@ -14900,42 +14939,113 @@ parameterNumber = 4 ; } #Dust Aerosol (0.55 - 0.9 um) Mixing Ratio +'aermr05' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 9 ; + scaledValueOfFirstSize = 55 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.55 - 0.9 um) Mixing Ratio 'aermr05' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 5 ; } #Dust Aerosol (0.9 - 20 um) Mixing Ratio +'aermr06' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 9 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.9 - 20 um) Mixing Ratio 'aermr06' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 6 ; } #Hydrophobic Organic Matter Aerosol Mixing Ratio +'aermr07' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62016 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Organic Matter Aerosol Mixing Ratio 'aermr07' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 7 ; } #Hydrophilic Organic Matter Aerosol Mixing Ratio +'aermr08' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62015 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Organic Matter Aerosol Mixing Ratio 'aermr08' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 8 ; } #Hydrophobic Black Carbon Aerosol Mixing Ratio +'aermr09' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62014 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Black Carbon Aerosol Mixing Ratio 'aermr09' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 9 ; } #Hydrophilic Black Carbon Aerosol Mixing Ratio +'aermr10' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62013 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Black Carbon Aerosol Mixing Ratio 'aermr10' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 10 ; } #Sulphate Aerosol Mixing Ratio +'aermr11' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62006 ; + typeOfSizeInterval = 255 ; + } +#Sulphate Aerosol Mixing Ratio 'aermr11' = { discipline = 192 ; parameterCategory = 210 ; @@ -15150,8 +15260,8 @@ discipline = 0 ; parameterCategory = 20 ; parameterNumber = 2 ; - constituentType = 3 ; productDefinitionTemplateNumber = 40 ; + constituentType = 3 ; } #Carbon Dioxide 'co2' = { @@ -15160,6 +15270,14 @@ parameterNumber = 61 ; } #Methane +'ch4' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 2 ; + } +#Methane 'ch4' = { discipline = 192 ; parameterCategory = 210 ; @@ -15352,18 +15470,42 @@ parameterNumber = 121 ; } #Sulphur dioxide +'so2' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 8 ; + } +#Sulphur dioxide 'so2' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 122 ; } #Carbon monoxide +'co' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 4 ; + } +#Carbon monoxide 'co' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 123 ; } #Formaldehyde +'hcho' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 7 ; + } +#Formaldehyde 'hcho' = { discipline = 192 ; parameterCategory = 210 ; @@ -15394,6 +15536,14 @@ parameterNumber = 128 ; } #Nitrogen Oxides +'nox' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 65535 ; + } +#Nitrogen Oxides 'nox' = { discipline = 192 ; parameterCategory = 210 ; @@ -15652,6 +15802,14 @@ parameterNumber = 185 ; } #GEMS Ozone +'go3' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 0 ; + } +#GEMS Ozone 'go3' = { discipline = 192 ; parameterCategory = 210 ; diff --git a/definitions/grib2/localConcepts/ecmf/units.def b/definitions/grib2/localConcepts/ecmf/units.def index 17d2e6f86..e040718ae 100644 --- a/definitions/grib2/localConcepts/ecmf/units.def +++ b/definitions/grib2/localConcepts/ecmf/units.def @@ -14863,25 +14863,64 @@ parameterNumber = 255 ; } #Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 3 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 1 ; } #Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 6 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 5 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; +} +#Sea Salt Aerosol (0.5 - 5 um) Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 2 ; } #Sea Salt Aerosol (5 - 20 um) Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 6 ; + aerosolType = 62008 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 5 ; + typeOfSizeInterval = 2 ; + } +#Sea Salt Aerosol (5 - 20 um) Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 3 ; } #Dust Aerosol (0.03 - 0.55 um) Mixing Ratio -'kg kg**-1' = { +'kg kg**-1' = { discipline = 0 ; parameterCategory = 20 ; parameterNumber = 2 ; @@ -14900,42 +14939,113 @@ parameterNumber = 4 ; } #Dust Aerosol (0.55 - 0.9 um) Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 7 ; + scaleFactorOfFirstSize = 8 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 9 ; + scaledValueOfFirstSize = 55 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.55 - 0.9 um) Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 5 ; } #Dust Aerosol (0.9 - 20 um) Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + scaleFactorOfSecondSize = 5 ; + scaleFactorOfFirstSize = 7 ; + aerosolType = 62001 ; + scaledValueOfSecondSize = 2 ; + scaledValueOfFirstSize = 9 ; + typeOfSizeInterval = 2 ; + } +#Dust Aerosol (0.9 - 20 um) Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 6 ; } #Hydrophobic Organic Matter Aerosol Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62016 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Organic Matter Aerosol Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 7 ; } #Hydrophilic Organic Matter Aerosol Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62015 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Organic Matter Aerosol Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 8 ; } #Hydrophobic Black Carbon Aerosol Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62014 ; + typeOfSizeInterval = 255 ; + } +#Hydrophobic Black Carbon Aerosol Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 9 ; } #Hydrophilic Black Carbon Aerosol Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62013 ; + typeOfSizeInterval = 255 ; + } +#Hydrophilic Black Carbon Aerosol Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 10 ; } #Sulphate Aerosol Mixing Ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 44 ; + aerosolType = 62006 ; + typeOfSizeInterval = 255 ; + } +#Sulphate Aerosol Mixing Ratio 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; @@ -15160,6 +15270,14 @@ parameterNumber = 61 ; } #Methane +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 2 ; + } +#Methane 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; @@ -15352,18 +15470,42 @@ parameterNumber = 121 ; } #Sulphur dioxide +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 8 ; + } +#Sulphur dioxide 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 122 ; } #Carbon monoxide +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 4 ; + } +#Carbon monoxide 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; parameterNumber = 123 ; } #Formaldehyde +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 7 ; + } +#Formaldehyde 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; @@ -15394,6 +15536,14 @@ parameterNumber = 128 ; } #Nitrogen Oxides +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 65535 ; + } +#Nitrogen Oxides 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; @@ -15652,6 +15802,14 @@ parameterNumber = 185 ; } #GEMS Ozone +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 2 ; + productDefinitionTemplateNumber = 40 ; + constituentType = 0 ; + } +#GEMS Ozone 'kg kg**-1' = { discipline = 192 ; parameterCategory = 210 ; diff --git a/definitions/gts/boot.def b/definitions/gts/boot.def index 6658ed7b7..451f4765e 100644 --- a/definitions/gts/boot.def +++ b/definitions/gts/boot.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/mars/default_labeling.def b/definitions/mars/default_labeling.def index e4d051ea9..bdf45c241 100644 --- a/definitions/mars/default_labeling.def +++ b/definitions/mars/default_labeling.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/tide/boot.def b/definitions/tide/boot.def index 0faade3e3..a53c076a7 100644 --- a/definitions/tide/boot.def +++ b/definitions/tide/boot.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/tide/mars_labeling.def b/definitions/tide/mars_labeling.def index 5f3e9695b..fb98a508b 100644 --- a/definitions/tide/mars_labeling.def +++ b/definitions/tide/mars_labeling.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/tide/section.1.def b/definitions/tide/section.1.def index 754dcdc06..b01f89cdf 100644 --- a/definitions/tide/section.1.def +++ b/definitions/tide/section.1.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/definitions/tide/section.4.def b/definitions/tide/section.4.def index 920259bef..eceaabe77 100644 --- a/definitions/tide/section.4.def +++ b/definitions/tide/section.4.def @@ -2,7 +2,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/doxygen/grib_api_wiz.cfg b/doxygen/grib_api_wiz.cfg index 981e49ec7..f6d36241c 100644 --- a/doxygen/grib_api_wiz.cfg +++ b/doxygen/grib_api_wiz.cfg @@ -8,7 +8,6 @@ PROJECT_NUMBER = OUTPUT_DIRECTORY = CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = "The $name class" \ @@ -30,7 +29,6 @@ STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 @@ -67,7 +65,6 @@ GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages @@ -105,7 +102,7 @@ INPUT = grib_api.dox \ ../tools/grib_keys.dox \ ../tools/grib_copy.dox \ ../tools/grib_index_build.dox \ - ../python/gribapi.py + ../python/eccode.py FILE_PATTERNS = *.c \ *.cc \ *.cxx \ @@ -184,7 +181,6 @@ HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = @@ -285,8 +281,6 @@ DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO diff --git a/doxygen/make_dox_web.sh b/doxygen/make_dox_web.sh index dd7504b3b..37c17f572 100755 --- a/doxygen/make_dox_web.sh +++ b/doxygen/make_dox_web.sh @@ -1,6 +1,6 @@ #!/bin/sh -./prepare_pydocs.pl < ../python/gribapi.py > gribapi.py +./prepare_pydocs.pl < ../python/eccode.py > eccode.py cd ../tools ./make_dox.ksh diff --git a/examples/C/Makefile.am b/examples/C/Makefile.am index 81ecb5249..14b84bb7c 100644 --- a/examples/C/Makefile.am +++ b/examples/C/Makefile.am @@ -5,26 +5,26 @@ TESTS = iterator.sh get.sh print_data.sh set.sh keys_iterator.sh multi.sh multi_ precision.sh list.sh noinst_PROGRAMS = nearest set_bitmap iterator get print_data set set_missing keys_iterator \ - set_data mars_param values_check box nc multi multi_write precision set_pv list sections_copy + set_data mars_param values_check box multi multi2 multi_write precision set_pv list sections_copy bin_PROGRAMS = points -box_SOURCES = box.c -set_data_SOURCES = set_data.c -mars_param_SOURCES = mars_param.c -values_check_SOURCES = values_check.c -nc_SOURCES = nc.c -nearest_SOURCES = nearest.c -multi_write_SOURCES = multi_write.c -get_SOURCES = get.c -print_data_SOURCES = print_data.c -set_SOURCES = set.c -set_missing_SOURCES = set_missing.c -set_bitmap_SOURCES = set_bitmap.c -multi_SOURCES = multi.c -keys_iterator_SOURCES = keys_iterator.c -iterator_SOURCES = iterator.c -set_pv_SOURCES = set_pv.c -points_SOURCES = points.c +box_SOURCES = box.c +set_data_SOURCES = set_data.c +mars_param_SOURCES = mars_param.c +values_check_SOURCES = values_check.c +nearest_SOURCES = nearest.c +multi_write_SOURCES = multi_write.c +get_SOURCES = get.c +print_data_SOURCES = print_data.c +set_SOURCES = set.c +set_missing_SOURCES = set_missing.c +set_bitmap_SOURCES = set_bitmap.c +multi_SOURCES = multi.c +multi2_SOURCES = multi2.c +keys_iterator_SOURCES = keys_iterator.c +iterator_SOURCES = iterator.c +set_pv_SOURCES = set_pv.c +points_SOURCES = points.c list_SOURCES = list.c sections_copy_SOURCES = sections_copy.c diff --git a/examples/C/fieldset.c b/examples/C/fieldset.c index 6f5a70365..2f3405816 100644 --- a/examples/C/fieldset.c +++ b/examples/C/fieldset.c @@ -13,9 +13,6 @@ * * Description: how to use a fieldset. * - * - * - * */ #include diff --git a/examples/C/get.c b/examples/C/get.c index 7805f67c9..513fc7319 100644 --- a/examples/C/get.c +++ b/examples/C/get.c @@ -13,8 +13,6 @@ * * Description: how to get values using keys. * - * - * */ #include #include diff --git a/examples/C/get.sh b/examples/C/get.sh index 264ff005b..083d60598 100755 --- a/examples/C/get.sh +++ b/examples/C/get.sh @@ -1,4 +1,11 @@ #!/bin/sh +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. . ./include.sh diff --git a/examples/C/iterator.c b/examples/C/iterator.c index 20d644a9b..b9d7ada1c 100644 --- a/examples/C/iterator.c +++ b/examples/C/iterator.c @@ -13,9 +13,6 @@ * * Description: how to use an iterator on lat/lon/values. * - * - * - * */ #include diff --git a/examples/C/list.c b/examples/C/list.c index 01729805a..e53d4ae60 100644 --- a/examples/C/list.c +++ b/examples/C/list.c @@ -9,12 +9,10 @@ */ /* - * C Implementation: get + * C Implementation: list * * Description: how to get values using keys. * - * - * */ #include #include diff --git a/examples/C/mars_param.c b/examples/C/mars_param.c index 55b029a67..31d859126 100644 --- a/examples/C/mars_param.c +++ b/examples/C/mars_param.c @@ -9,12 +9,9 @@ */ /* - * C Implementation: set - * - * Description: how to set key values. - * - * + * C Implementation: mars_param * + * Description: how to query MARS params * */ #include diff --git a/examples/C/multi.sh b/examples/C/multi.sh index d2d643250..436fab5d6 100755 --- a/examples/C/multi.sh +++ b/examples/C/multi.sh @@ -11,9 +11,15 @@ if [ ! -f "${data_dir}/multi.grib2" ] then - echo SKIP: $0 - exit + echo "SKIP test 1: $0" +else + ${examples_dir}multi > /dev/null fi -${examples_dir}multi > /dev/null +if [ ! -f "${data_dir}/multi_created.grib2" ] +then + echo "SKIP test 2: $0" +else + ${examples_dir}multi2 > /dev/null +fi diff --git a/examples/C/multi2.c b/examples/C/multi2.c new file mode 100644 index 000000000..84b6d0bfb --- /dev/null +++ b/examples/C/multi2.c @@ -0,0 +1,73 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + +/* + * C Implementation: multi2.c + * + * Description: Repeatedly print data contained in a multi-field grib message + * + */ + +#include "grib_api.h" + +#include +#include +#include + +void read_data(int num_msgs); + +const int NUM_FIELDS = 4; +const int COUNT = 20; +const char* file_path = "../../data/multi_created.grib2"; + +int main(int argc, char** argv) { + int i; + + /* turn on support for multi fields messages */ + grib_multi_support_on(0); + + for(i=1; i @@ -44,7 +42,7 @@ int main(int argc, char** argv) { /* open input file */ in = fopen(filename,"r"); if(!in) { - printf("ERROR: unable to open file %s\n",filename); + printf("ERROR: unable to open input file %s\n",filename); return 1; } @@ -68,7 +66,7 @@ int main(int argc, char** argv) { /* open output file */ of=fopen(ofilename,"w"); if(!of) { - printf("ERROR: unable to open file %s\n",ofilename); + printf("ERROR: unable to open output file %s\n",ofilename); exit(1); } diff --git a/examples/C/nearest.c b/examples/C/nearest.c index ef2147169..2e48c9013 100644 --- a/examples/C/nearest.c +++ b/examples/C/nearest.c @@ -9,13 +9,9 @@ */ /* - * C Implementation: fieldset - * - * Description: how to use a fieldset. - * - * - * + * C Implementation: nearest * + * Description: how to get nearest point(s) */ #include diff --git a/examples/C/points.c b/examples/C/points.c index 6a15e84df..33002ca58 100644 --- a/examples/C/points.c +++ b/examples/C/points.c @@ -11,10 +11,6 @@ /* * C Implementation: points * - * - * - * - * */ #include @@ -124,7 +120,5 @@ int main(int argc, char** argv) { fclose(fin); } - - return ret; } diff --git a/examples/C/precision.c b/examples/C/precision.c index 5e12546b2..28419b366 100644 --- a/examples/C/precision.c +++ b/examples/C/precision.c @@ -13,9 +13,6 @@ * * Description: how to control decimal precision when packing fields. * - * - * - * */ #include #include @@ -44,13 +41,13 @@ int main(int argc, char** argv) { in = fopen(infile,"r"); if(!in) { - printf("ERROR: unable to open file %s\n",infile); + printf("ERROR: unable to open input file %s\n",infile); return 1; } out = fopen(outfile,"w"); - if(!in) { - printf("ERROR: unable to open file %s\n",outfile); + if(!out) { + printf("ERROR: unable to open output file %s\n",outfile); return 1; } @@ -121,4 +118,3 @@ int main(int argc, char** argv) { return 0; } - diff --git a/examples/C/print_data.c b/examples/C/print_data.c index 2d9188fa5..51b9a3788 100644 --- a/examples/C/print_data.c +++ b/examples/C/print_data.c @@ -13,8 +13,6 @@ * * Description: prints all the data contained in a grib file * - * - * */ #include #include diff --git a/examples/C/set.c b/examples/C/set.c index 2d204d9e3..52a12eb5f 100644 --- a/examples/C/set.c +++ b/examples/C/set.c @@ -13,9 +13,6 @@ * * Description: how to set key values. * - * - * - * */ #include #include diff --git a/examples/C/set_bitmap.c b/examples/C/set_bitmap.c index 6ad39078f..d060a7381 100644 --- a/examples/C/set_bitmap.c +++ b/examples/C/set_bitmap.c @@ -14,8 +14,6 @@ * Description: how to set a bitmap in a grib message * * - * - * */ #include @@ -28,7 +26,7 @@ int main(int argc, char** argv) { size_t size=0; FILE* in = NULL; - char* infile = "../data/regular_latlon_surface.grib1"; + char* infile = "../../data/regular_latlon_surface.grib1"; FILE* out = NULL; char* outfile = "out.grib1"; grib_handle *h = NULL; @@ -40,13 +38,13 @@ int main(int argc, char** argv) { in = fopen(infile,"r"); if(!in) { - printf("ERROR: unable to open file %s\n",infile); + printf("ERROR: unable to open input file %s\n",infile); return 1; } out = fopen(outfile,"w"); - if(!in) { - printf("ERROR: unable to open file %s\n",outfile); + if(!out) { + printf("ERROR: unable to open output file %s\n",outfile); return 1; } diff --git a/examples/C/set_missing.c b/examples/C/set_missing.c index f39ad0da3..e56a3ec26 100644 --- a/examples/C/set_missing.c +++ b/examples/C/set_missing.c @@ -13,9 +13,6 @@ * * Description: how to set a key as missing. * - * - * - * */ #include #include @@ -37,13 +34,13 @@ int main(int argc, char** argv) { in = fopen(infile,"r"); if(!in) { - printf("ERROR: unable to open file %s\n",infile); + printf("ERROR: unable to open input file %s\n",infile); return 1; } out = fopen(outfile,"w"); - if(!in) { - printf("ERROR: unable to open file %s\n",outfile); + if(!out) { + printf("ERROR: unable to open output file %s\n",outfile); return 1; } diff --git a/examples/C/set_pv.c b/examples/C/set_pv.c index ce4ad5bbb..d4bb292e6 100644 --- a/examples/C/set_pv.c +++ b/examples/C/set_pv.c @@ -9,12 +9,9 @@ */ /* - * C Implementation: set - * - * Description: how to set pv . - * - * + * C Implementation: set_pv * + * Description: how to set pv (vertical coordinate parameters) * */ #include @@ -30,7 +27,7 @@ int main(int argc, char** argv) { size_t pvsize=4; FILE* in = NULL; - char* infile = "../data/regular_latlon_surface.grib1"; + char* infile = "../../data/regular_latlon_surface.grib1"; FILE* out = NULL; char* outfile = "out.grib1"; grib_handle *h = NULL; @@ -38,13 +35,13 @@ int main(int argc, char** argv) { in = fopen(infile,"r"); if(!in) { - printf("ERROR: unable to open file %s\n",infile); + printf("ERROR: unable to open input file %s\n",infile); return 1; } out = fopen(outfile,"w"); - if(!in) { - printf("ERROR: unable to open file %s\n",outfile); + if(!out) { + printf("ERROR: unable to open output file %s\n",outfile); return 1; } diff --git a/examples/C/values_check.c b/examples/C/values_check.c index 7866d37da..71c63a337 100644 --- a/examples/C/values_check.c +++ b/examples/C/values_check.c @@ -18,7 +18,7 @@ int main(int argc, char* argv[]) { grib_values values[2]; int nvalues=2; int i; - char* name; + char* name = NULL; f=fopen(infile,"r"); if (!f) { diff --git a/examples/F77/example.F b/examples/F77/example.F index a87d45e23..cd9577823 100644 --- a/examples/F77/example.F +++ b/examples/F77/example.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/files_fortran.F b/examples/F77/files_fortran.F index 20b03212d..12d28303b 100644 --- a/examples/F77/files_fortran.F +++ b/examples/F77/files_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/get_fortran.F b/examples/F77/get_fortran.F index a4e60ab1c..a075ced46 100644 --- a/examples/F77/get_fortran.F +++ b/examples/F77/get_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/iterator_fortran.F b/examples/F77/iterator_fortran.F index 245828870..aa6890bde 100644 --- a/examples/F77/iterator_fortran.F +++ b/examples/F77/iterator_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/keys_iterator_fortran.F b/examples/F77/keys_iterator_fortran.F index addec64b8..63b294495 100644 --- a/examples/F77/keys_iterator_fortran.F +++ b/examples/F77/keys_iterator_fortran.F @@ -2,12 +2,10 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C -C -C C Fortran 77 Implementation: keys_iterator C C Description: diff --git a/examples/F77/missing_value.F b/examples/F77/missing_value.F index 9471b352f..8bc83a6fb 100644 --- a/examples/F77/missing_value.F +++ b/examples/F77/missing_value.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/msg_fortran.F b/examples/F77/msg_fortran.F index 09f6aef23..05b1fa0cd 100644 --- a/examples/F77/msg_fortran.F +++ b/examples/F77/msg_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/multi_fortran.F b/examples/F77/multi_fortran.F index d5b32370f..e1469ef87 100644 --- a/examples/F77/multi_fortran.F +++ b/examples/F77/multi_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/nearest_fortran.F b/examples/F77/nearest_fortran.F index 53e1af30b..23535c5c4 100755 --- a/examples/F77/nearest_fortran.F +++ b/examples/F77/nearest_fortran.F @@ -2,13 +2,10 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C -C - -C C Fortran Implementation: fieldset C C Description: how to use a fieldset. @@ -77,3 +74,4 @@ C return 0; } + diff --git a/examples/F77/precision_fortran.F b/examples/F77/precision_fortran.F index 8570e5834..9a7bf1849 100644 --- a/examples/F77/precision_fortran.F +++ b/examples/F77/precision_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/print_data_fortran.F b/examples/F77/print_data_fortran.F index 9471b352f..8bc83a6fb 100644 --- a/examples/F77/print_data_fortran.F +++ b/examples/F77/print_data_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/set_fortran.F b/examples/F77/set_fortran.F index 9c7de82c7..2a64dc6ef 100644 --- a/examples/F77/set_fortran.F +++ b/examples/F77/set_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/set_missing_fortran.F b/examples/F77/set_missing_fortran.F index 1513c4551..0166cc472 100644 --- a/examples/F77/set_missing_fortran.F +++ b/examples/F77/set_missing_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F77/set_pv_fortran.F b/examples/F77/set_pv_fortran.F index 16dc3f263..b59498b3d 100644 --- a/examples/F77/set_pv_fortran.F +++ b/examples/F77/set_pv_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/F90/keys_iterator_fortran.f90 b/examples/F90/keys_iterator_fortran.f90 index 340954ef8..c9e678bbb 100644 --- a/examples/F90/keys_iterator_fortran.f90 +++ b/examples/F90/keys_iterator_fortran.f90 @@ -1,3 +1,10 @@ +! Copyright 2005-2012 ECMWF. +! +! This software is licensed under the terms of the Apache Licence Version 2.0 +! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +! +! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! ! ! Description: @@ -6,9 +13,6 @@ ! keys in a message. ! ! -! Copyright: See COPYING file that comes with this distribution -! -! program keys_iterator use grib_api implicit none diff --git a/examples/F90/precision.f90 b/examples/F90/precision.f90 index 2ff85c0a2..43cc3ff7f 100644 --- a/examples/F90/precision.f90 +++ b/examples/F90/precision.f90 @@ -7,14 +7,11 @@ ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! ! -! -! ! Description: how to control decimal precision when packing fields. ! ! ! ! -! program precision use grib_api implicit none diff --git a/examples/F90/read_from_file.f90 b/examples/F90/read_from_file.f90 index dc19ea0ea..d0c2e1ae1 100644 --- a/examples/F90/read_from_file.f90 +++ b/examples/F90/read_from_file.f90 @@ -19,7 +19,7 @@ use grib_api character(len=256) :: filename integer(kind=4),dimension(intsize) :: buffer !character,dimension(size) :: buffer - integer :: len1 + integer(kind=kindOfSize_t) :: len1 ! Message identifier. integer :: igrib diff --git a/examples/F90/read_message.f90 b/examples/F90/read_message.f90 index be77217cf..119ada73b 100644 --- a/examples/F90/read_message.f90 +++ b/examples/F90/read_message.f90 @@ -12,10 +12,11 @@ program read_message use grib_api implicit none - integer :: ifile,ofile - integer :: iret,igrib - integer , dimension(50000) :: buffer - integer :: len1,step,level + integer :: ifile,ofile + integer :: iret,igrib + integer , dimension(50000) :: buffer + integer(kind=kindOfSize_t) :: len1 + integer :: step,level call grib_open_file(ifile,'../../data/index.grib','r') call grib_open_file(ofile,'out.grib','w') diff --git a/examples/F90/set.f90 b/examples/F90/set.f90 index be7868432..87981f959 100644 --- a/examples/F90/set.f90 +++ b/examples/F90/set.f90 @@ -12,7 +12,6 @@ ! ! ! -! program set use grib_api implicit none diff --git a/examples/F90/set_missing.f90 b/examples/F90/set_missing.f90 index aa7db2b17..428b6ef05 100644 --- a/examples/F90/set_missing.f90 +++ b/examples/F90/set_missing.f90 @@ -13,7 +13,6 @@ ! ! ! -! program set use grib_api implicit none diff --git a/examples/extra/ens_mean.f90 b/examples/extra/ens_mean.f90 index 1d994a290..9fc45f78e 100644 --- a/examples/extra/ens_mean.f90 +++ b/examples/extra/ens_mean.f90 @@ -6,8 +6,6 @@ ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! -! -! ! Description: Practical example of an ensemble mean using grib_api ! ! diff --git a/examples/extra/f_clone.f90 b/examples/extra/f_clone.f90 index e536e8aa8..7a24f6054 100755 --- a/examples/extra/f_clone.f90 +++ b/examples/extra/f_clone.f90 @@ -6,8 +6,6 @@ ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! -! -! ! Description: how to create a new GRIB message by cloning ! an existing message. ! diff --git a/examples/extra/message_count_multi.f90 b/examples/extra/message_count_multi.f90 index 8340b22c6..c4084b1fd 100644 --- a/examples/extra/message_count_multi.f90 +++ b/examples/extra/message_count_multi.f90 @@ -6,8 +6,6 @@ ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! -! -! ! Description: count messages in the input ! ! Author: Cristian D. Codorean diff --git a/examples/get_fortran.F b/examples/get_fortran.F index 3903ecf55..7748c2635 100644 --- a/examples/get_fortran.F +++ b/examples/get_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/iterator_fortran.F b/examples/iterator_fortran.F index 0c9b5fcbf..6fab31338 100644 --- a/examples/iterator_fortran.F +++ b/examples/iterator_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/keys_iterator_fortran.F b/examples/keys_iterator_fortran.F index 254f64b05..e69002115 100644 --- a/examples/keys_iterator_fortran.F +++ b/examples/keys_iterator_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/multi_fortran.F b/examples/multi_fortran.F index bf439e8db..811139409 100644 --- a/examples/multi_fortran.F +++ b/examples/multi_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/precision_fortran.F b/examples/precision_fortran.F index 8931f4d58..9ac1217e6 100644 --- a/examples/precision_fortran.F +++ b/examples/precision_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/print_data_fortran.F b/examples/print_data_fortran.F index dc404cb2b..fb4ac8d2b 100644 --- a/examples/print_data_fortran.F +++ b/examples/print_data_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/python/binary_message.py b/examples/python/binary_message.py index 038b9ebfc..57132f92d 100644 --- a/examples/python/binary_message.py +++ b/examples/python/binary_message.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * VERBOSE=1 # verbose error reporting @@ -13,13 +23,13 @@ def example(): gid = grib_new_from_file(f) if gid is None: break - message = grib_get_message(gid) + message = get_message(gid) - newgid = grib_new_from_message(message) - grib_write(newgid,out) - grib_release(newgid) + newgid = new_from_message(message) + write(newgid,out) + release(newgid) - grib_release(gid) + release(gid) out.close() f.close() @@ -27,7 +37,7 @@ def example(): def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/clone.py b/examples/python/clone.py index b41720e1c..88dd9b480 100644 --- a/examples/python/clone.py +++ b/examples/python/clone.py @@ -1,8 +1,18 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys import random -from gribapi import * +from eccode import * INPUT='../../data/constant_field.grib1' OUTPUT='out.grib' @@ -14,21 +24,21 @@ def example(): gid = grib_new_from_file(fin) - nx = grib_get(gid,'Ni') - ny = grib_get(gid,'Nj') + nx = get(gid,'Ni') + ny = get(gid,'Nj') for step in range(0,24,6): - clone_id = grib_clone(gid) - grib_set(clone_id,'step',step) + clone_id = clone(gid) + set(clone_id,'step',step) values = [random.random() for i in range(nx*ny)] - grib_set_values(clone_id,values) + set_values(clone_id,values) - grib_write(clone_id,fout) - grib_release(clone_id) + write(clone_id,fout) + release(clone_id) - grib_release(gid) + release(gid) fin.close() fout.close() @@ -36,7 +46,7 @@ def example(): def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/count_messages.py b/examples/python/count_messages.py index fbb34684b..b2677db93 100644 --- a/examples/python/count_messages.py +++ b/examples/python/count_messages.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/tigge_pf_ecmwf.grib2' VERBOSE=1 # verbose error reporting @@ -31,24 +41,24 @@ def example(): print "processing message number",i+1 for key in keys: - print '%s=%g' % (key,grib_get(gid,key)) + print '%s=%g' % (key,get(gid,key)) print 'There are %d, average is %g, min is %g, max is %g' % ( - grib_get_size(gid,'values'), - grib_get(gid,'average'), - grib_get(gid,'min'), - grib_get(gid,'max') + get_size(gid,'values'), + get(gid,'average'), + get(gid,'min'), + get(gid,'max') ) print '-'*100 - grib_release(gid) + release(gid) def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/get.py b/examples/python/get.py index 837b9de0a..b57fdfcee 100644 --- a/examples/python/get.py +++ b/examples/python/get.py @@ -1,7 +1,15 @@ import traceback import sys -from gribapi import * +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + +from eccode import * INPUT='../../data/reduced_latlon_surface.grib1' VERBOSE=1 # verbose error reporting @@ -23,26 +31,26 @@ def example(): if gid is None: break for key in keys: - if not grib_is_defined(gid,key): raise Exception("Key was not defined") - print '%s=%s' % (key,grib_get(gid,key)) - - if grib_is_defined(gid,"A_very_silly_girl"): raise Exception("Key was defined") + if not is_defined(gid,key): raise Exception("Key was not defined") + print '%s=%s' % (key,get(gid,key)) + if is_defined(gid,"A_very_silly_girl"): raise Exception("Key was defined") + print 'There are %d values, average is %f, min is %f, max is %f' % ( - grib_get_size(gid,'values'), - grib_get(gid,'average'), - grib_get(gid,'min'), - grib_get(gid,'max') + get_size(gid,'values'), + get(gid,'average'), + get(gid,'min'), + get(gid,'max') ) - grib_release(gid) + release(gid) f.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/index.py b/examples/python/index.py index 2b8e9b10d..15ec7e8dd 100644 --- a/examples/python/index.py +++ b/examples/python/index.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys,os -from gribapi import * +from eccode import * INPUT='../../data/index.grib' VERBOSE=1 # verbose error reporting @@ -23,45 +33,45 @@ def example(): iid = None if (os.path.exists(index_file)): - iid = grib_index_read(index_file) + iid = index_read(index_file) else: - iid = grib_index_new_from_file(INPUT,index_keys) + iid = index_new_from_file(INPUT,index_keys) # multiple files can be added to an index: - # grib_index_add_file(iid,"grib file to add") + # index_add_file(iid,"grib file to add") - grib_index_write(iid,index_file) + index_write(iid,index_file) index_vals = [] for key in index_keys: print "%sSize=%d" % ( key, - grib_index_get_size(iid,key) + index_get_size(iid,key) ) - key_vals = grib_index_get(iid,key) + key_vals = index_get(iid,key) print " ".join(key_vals) index_vals.append(key_vals) for prod in product(*index_vals): for i in range(len(index_keys)): - grib_index_select(iid,index_keys[i],prod[i]) + index_select(iid,index_keys[i],prod[i]) while 1: - gid = grib_new_from_index(iid) + gid = new_from_index(iid) if gid is None: break - print " ".join(["%s=%s" % (key,grib_get(gid,key)) for key in index_keys]) - grib_release(gid) + print " ".join(["%s=%s" % (key,get(gid,key)) for key in index_keys]) + release(gid) - grib_index_release(iid) + index_release(iid) def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/iterator.py b/examples/python/iterator.py index 9b4892aa1..4d77b235c 100644 --- a/examples/python/iterator.py +++ b/examples/python/iterator.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/reduced_latlon_surface.grib1' VERBOSE=1 # verbose error reporting @@ -13,13 +23,13 @@ def example(): gid = grib_new_from_file(f) if gid is None: break - iterid = grib_iterator_new(gid,0) + iterid = iterator_new(gid,0) - missingValue = grib_get_double(gid,"missingValue") + missingValue = get_double(gid,"missingValue") i=0 while 1: - result = grib_iterator_next(iterid) + result = iterator_next(iterid) if not result: break [lat,lon,value] = result @@ -33,15 +43,15 @@ def example(): i += 1 - grib_iterator_delete(iterid) - grib_release(gid) + iterator_delete(iterid) + release(gid) f.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/keys_iterator.py b/examples/python/keys_iterator.py index 195058bdf..285933dfe 100644 --- a/examples/python/keys_iterator.py +++ b/examples/python/keys_iterator.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/reduced_latlon_surface.grib1' VERBOSE=1 # verbose error reporting @@ -13,7 +23,7 @@ def example(): gid = grib_new_from_file(f) if gid is None: break - iterid = grib_keys_iterator_new(gid,'ls') + iterid = keys_iterator_new(gid,'ls') # Different types of keys can be skipped # grib_skip_computed(iterid) @@ -23,20 +33,20 @@ def example(): # grib_skip_read_only(iterid) # grib_skip_function(iterid) - while grib_keys_iterator_next(iterid): - keyname = grib_keys_iterator_get_name(iterid) - keyval = grib_get_string(iterid,keyname) + while keys_iterator_next(iterid): + keyname = keys_iterator_get_name(iterid) + keyval = get_string(iterid,keyname) print "%s = %s" % (keyname,keyval) - grib_keys_iterator_delete(iterid) - grib_release(gid) + keys_iterator_delete(iterid) + release(gid) f.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/keys_iterator_bufr.py b/examples/python/keys_iterator_bufr.py new file mode 100644 index 000000000..4f0489880 --- /dev/null +++ b/examples/python/keys_iterator_bufr.py @@ -0,0 +1,58 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +import traceback +import sys + +from eccode import * + +INPUT='../../data/gts.bufr' +VERBOSE=1 # verbose error reporting + +def example(): + f = open(INPUT) + + while 1: + bid = bufr_new_from_file(f) + if bid is None: break + + iterid = keys_iterator_new(bid) + + # Different types of keys can be skipped + # skip_computed(iterid) + # skip_coded(iterid) + # skip_edition_specific(iterid) + # skip_duplicates(iterid) + # skip_read_only(iterid) + # skip_function(iterid) + + while keys_iterator_next(iterid): + keyname = keys_iterator_get_name(iterid) + keyval = get_string(iterid,keyname) + print "%s = %s" % (keyname,keyval) + + keys_iterator_delete(iterid) + release(bid) + + f.close() + +def main(): + try: + example() + except InternalError,err: + if VERBOSE: + traceback.print_exc(file=sys.stderr) + else: + print >>sys.stderr,err.msg + + return 1 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/examples/python/keys_iterator_gts.py b/examples/python/keys_iterator_gts.py new file mode 100644 index 000000000..504f802ca --- /dev/null +++ b/examples/python/keys_iterator_gts.py @@ -0,0 +1,55 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +import traceback +import sys + +from eccode import * + +INPUT='../../data/gts.bufr' +VERBOSE=1 # verbose error reporting + +def example(): + f = open(INPUT) + + while 1: + bid = gts_new_from_file(f) + if bid is None: break + + iterid = keys_iterator_new(bid) + + # Different types of keys can be skipped + # skip_computed(iterid) + # skip_coded(iterid) + # skip_read_only(iterid) + + while keys_iterator_next(iterid): + keyname = keys_iterator_get_name(iterid) + keyval = get_string(iterid,keyname) + print "%s = %s" % (keyname,keyval) + + keys_iterator_delete(iterid) + release(bid) + + f.close() + +def main(): + try: + example() + except InternalError,err: + if VERBOSE: + traceback.print_exc(file=sys.stderr) + else: + print >>sys.stderr,err.msg + + return 1 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/examples/python/multi_write.py b/examples/python/multi_write.py index 0553692d3..f62d59ff3 100644 --- a/examples/python/multi_write.py +++ b/examples/python/multi_write.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/sample.grib2' OUTPUT='out.grib' @@ -16,20 +26,20 @@ def example(): mgid = grib_multi_new() for step in range(12,132,12): - grib_set(gid,"step",step) + set(gid,"step",step) grib_multi_append(gid,4,mgid) grib_multi_write(mgid,fout) grib_multi_release(mgid) - grib_release(gid) + release(gid) fin.close() fout.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/nearest.py b/examples/python/nearest.py index 2fceb5d7a..194093a60 100644 --- a/examples/python/nearest.py +++ b/examples/python/nearest.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/reduced_gaussian_lsm.grib1' VERBOSE=1 # verbose error reporting @@ -24,13 +34,13 @@ def example(): print "-"*100 - grib_release(gid) + release(gid) f.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/print_data.py b/examples/python/print_data.py index 9db2276b5..e45506d22 100644 --- a/examples/python/print_data.py +++ b/examples/python/print_data.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/regular_latlon_surface.grib1' VERBOSE=1 # verbose error reporting @@ -10,22 +20,22 @@ def example(): f = open(INPUT) gid = grib_new_from_file(f) - values = grib_get_values(gid) + values = get_values(gid) for i in xrange(len(values)): print "%d %.10e" % (i+1,values[i]) print '%d values found in %s' % (len(values),INPUT) for key in ('max','min','average'): - print '%s=%.10e' % (key,grib_get(gid,key)) + print '%s=%.10e' % (key,get(gid,key)) - grib_release(gid) + release(gid) f.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/samples.py b/examples/python/samples.py index 09503cb3d..eda9f69d4 100644 --- a/examples/python/samples.py +++ b/examples/python/samples.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/tp_ecmwf.grib' OUTPUT='out.grib' @@ -27,7 +37,7 @@ def example(): gid = grib_new_from_file(fin) if gid is None: break - curr_vals = grib_get_values(gid) + curr_vals = get_values(gid) if prev_vals is None: result = prev_vals = curr_vals @@ -44,16 +54,16 @@ def example(): keys['startStep'] += 12 keys['endStep'] += 12 - clone_id = grib_clone(sample_id) + clone_id = clone(sample_id) for key in keys: - grib_set(clone_id,key,keys[key]) + set(clone_id,key,keys[key]) - grib_set_values(clone_id,result * 1000) + set_values(clone_id,result * 1000) - grib_write(clone_id,fout) + write(clone_id,fout) - grib_release(gid) + release(gid) fin.close() fout.close() @@ -61,7 +71,7 @@ def example(): def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/set.py b/examples/python/set.py index d203ccc94..6c683d967 100644 --- a/examples/python/set.py +++ b/examples/python/set.py @@ -9,7 +9,7 @@ import sys # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. -from gribapi import * +from eccode import * from datetime import date INPUT='../../data/regular_latlon_surface_constant.grib1' @@ -23,44 +23,44 @@ def example(): dt = date.today() today = "%d%02d%02d" % (dt.year,dt.month,dt.day) - grib_set(gid,'dataDate',int(today)) - grib_set(gid,'centre',80) + set(gid,'dataDate',int(today)) + set(gid,'centre',80) - centreIntVal = grib_get(gid,'centre',int) - centreStrVal = grib_get(gid,'centre',str) - dateStrVal = grib_get(gid,'dataDate',str) + centreIntVal = get(gid,'centre',int) + centreStrVal = get(gid,'centre',str) + dateStrVal = get(gid,'dataDate',str) assert(centreIntVal == 80) assert(centreStrVal == 'cnmc') assert(dateStrVal == today) - print 'get centre as a integer - centre = %d' % centreIntVal + print 'get centre as an integer - centre = %d' % centreIntVal print 'get centre as a string - centre = %s' % centreStrVal print 'get date as a string - date = %s' % dateStrVal - + # Now do the same but using set_key_vals, setting keys all at once - grib_set_key_vals(gid, 'level=1,centre=98') # with a String - assert(grib_get(gid,'centre',str) == 'ecmf') - assert(grib_get(gid,'level',int) == 1) + set_key_vals(gid, 'level=1,centre=98') # with a String + assert(get(gid,'centre',str) == 'ecmf') + assert(get(gid,'level',int) == 1) - grib_set_key_vals(gid, ['level=2', 'centre=kwbc']) # with a Tuple - assert(grib_get(gid,'centre',int) == 7) - assert(grib_get(gid,'level',int) == 2) + set_key_vals(gid, ['level=2', 'centre=kwbc']) # with a Tuple + assert(get(gid,'centre',int) == 7) + assert(get(gid,'level',int) == 2) - grib_set_key_vals(gid, {'level': 3, 'centre': 84}) # with a Dictionary - assert(grib_get(gid,'centre',str) == 'lfpw') - assert(grib_get(gid,'level',int) == 3) + set_key_vals(gid, {'level': 3, 'centre': 84}) # with a Dictionary + assert(get(gid,'centre',str) == 'lfpw') + assert(get(gid,'level',int) == 3) - grib_gts_header(True) - grib_gts_header(False) + gts_header(True) + gts_header(False) - grib_write(gid,fout) - grib_release(gid) + write(gid,fout) + release(gid) fin.close() fout.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/set_missing.py b/examples/python/set_missing.py index fd7dd9a61..ea76e7101 100644 --- a/examples/python/set_missing.py +++ b/examples/python/set_missing.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * INPUT='../../data/tigge/tigge_ecmf_pl_t.grib' OUTPUT='out.grib' @@ -14,20 +24,20 @@ def example(): gid = grib_new_from_file(fin) # set type of level to surface - grib_set(gid,'typeOfFirstFixedSurface','sfc') - grib_set_missing(gid,'scaleFactorOfFirstFixedSurface') - grib_set_missing(gid,'scaledValueOfFirstFixedSurface') + set(gid,'typeOfFirstFixedSurface','sfc') + set_missing(gid,'scaleFactorOfFirstFixedSurface') + set_missing(gid,'scaledValueOfFirstFixedSurface') - grib_write(gid,fout) + write(gid,fout) - grib_release(gid) + release(gid) fin.close() fout.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/python/set_pv.py b/examples/python/set_pv.py index dcd552c55..24a9cbcaa 100644 --- a/examples/python/set_pv.py +++ b/examples/python/set_pv.py @@ -1,7 +1,17 @@ +# +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + import traceback import sys -from gribapi import * +from eccode import * VERBOSE=1 # verbose error reporting @@ -21,20 +31,20 @@ def example(): fout = open('out.grib1','w') gid = grib_new_from_samples('reduced_gg_sfc_grib1') - grib_set(gid,'typeOfLevel','hybrid') - grib_set(gid,'level',2) - grib_set(gid,'PVPresent',1) - grib_set_array(gid,'pv',pv) + set(gid,'typeOfLevel','hybrid') + set(gid,'level',2) + set(gid,'PVPresent',1) + set_array(gid,'pv',pv) - grib_write(gid,fout) + write(gid,fout) - grib_release(gid) + release(gid) fout.close() def main(): try: example() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/examples/set_fortran.F b/examples/set_fortran.F index c865ef0ce..cad4f7694 100644 --- a/examples/set_fortran.F +++ b/examples/set_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/examples/set_pv_fortran.F b/examples/set_pv_fortran.F index c5a2c02d2..0024012bd 100644 --- a/examples/set_pv_fortran.F +++ b/examples/set_pv_fortran.F @@ -2,7 +2,7 @@ C Copyright 2005-2012 ECMWF. C C This software is licensed under the terms of the Apache Licence Version 2.0 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -C +C C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. C diff --git a/fortran/create_grib_f90.sh b/fortran/create_grib_f90.sh index cb8c619d1..7ace1d21e 100755 --- a/fortran/create_grib_f90.sh +++ b/fortran/create_grib_f90.sh @@ -3,10 +3,10 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. - +# same=`./same_int_long` if [ $same -eq 1 ] diff --git a/fortran/grib_f77.c b/fortran/grib_f77.c index 2162d763e..31aaf8aa5 100644 --- a/fortran/grib_f77.c +++ b/fortran/grib_f77.c @@ -11,11 +11,11 @@ #include "grib_api_internal.h" #include "grib_fortran_prototypes.h" -int grib_read_file_(int* fid, char* buffer, int* nbytes) { +int grib_read_file_(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_file_(fid,buffer,nbytes); } -int grib_read_file__(int* fid, char* buffer, int* nbytes) { +int grib_read_file__(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_file_(fid,buffer,nbytes); } diff --git a/fortran/grib_f90.f90.head b/fortran/grib_f90.f90.head index 736c86010..46558a435 100644 --- a/fortran/grib_f90.f90.head +++ b/fortran/grib_f90.f90.head @@ -6,6 +6,7 @@ ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! +! !> Module grib_api !> !> The grib_api module provides the Fortran 90 interface of the GRIB API. diff --git a/fortran/grib_f90.f90.tail b/fortran/grib_f90.f90.tail index 503543056..d9db77e0b 100644 --- a/fortran/grib_f90.f90.tail +++ b/fortran/grib_f90.f90.tail @@ -526,7 +526,7 @@ subroutine grib_read_bytes_char ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile character(len=1),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -553,7 +553,7 @@ subroutine grib_read_bytes_int4 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile integer(kind=4),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -580,7 +580,7 @@ subroutine grib_read_bytes_real4 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile real(kind=4),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -607,7 +607,7 @@ subroutine grib_read_bytes_real8 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile real(kind=8),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -633,8 +633,8 @@ !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_read_from_file_int4 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile - integer(kind=4),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -660,8 +660,8 @@ !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_read_from_file_real4 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile - real(kind=4),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + real(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -688,7 +688,7 @@ subroutine grib_read_from_file_real8 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile real(kind=8),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -715,7 +715,7 @@ subroutine grib_read_from_file_char ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile character(len=1),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret @@ -744,7 +744,7 @@ subroutine grib_write_bytes_char ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile character(len=1), dimension(:),intent(in) :: buffer - integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfSize_t), intent(in) :: nbytes integer(kind=kindOfInt),optional,intent(out) :: status integer(kind=kindOfInt) :: iret @@ -771,7 +771,7 @@ subroutine grib_write_bytes_int4 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile integer(kind=4), dimension(:),intent(in) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional,intent(out) :: status integer(kind=kindOfInt) :: iret @@ -797,8 +797,8 @@ !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_write_bytes_real4 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile - real(kind=4), dimension(:),intent(in) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + real(kind=4), dimension(:),intent(in) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional,intent(out) :: status integer(kind=kindOfInt) :: iret @@ -824,8 +824,8 @@ !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_write_bytes_real8 ( ifile, buffer, nbytes, status ) integer(kind=kindOfInt),intent(in) :: ifile - real(kind=8), dimension(:),intent(in) :: buffer - integer(kind=kindOfInt), intent(inout) :: nbytes + real(kind=8), dimension(:),intent(in) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes integer(kind=kindOfInt),optional,intent(out) :: status integer(kind=kindOfInt) :: iret diff --git a/fortran/grib_f90_int.f90 b/fortran/grib_f90_int.f90 index 1916ec3f8..17333d094 100644 --- a/fortran/grib_f90_int.f90 +++ b/fortran/grib_f90_int.f90 @@ -1,3 +1,12 @@ +! Copyright 2005-2012 ECMWF. +! +! This software is licensed under the terms of the Apache Licence Version 2.0 +! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +! +! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + + !> Get the distinct values of the key in argument contained in the index. The key must belong to the index. !> !> diff --git a/fortran/grib_f90_long_int.f90 b/fortran/grib_f90_long_int.f90 index 6955f6b19..86f8b83eb 100644 --- a/fortran/grib_f90_long_int.f90 +++ b/fortran/grib_f90_long_int.f90 @@ -1,3 +1,12 @@ +! Copyright 2005-2012 ECMWF. +! +! This software is licensed under the terms of the Apache Licence Version 2.0 +! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +! +! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + + !> Get the distinct values of the key in argument contained in the index. The key must belong to the index. !> !> diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.c index db23120ca..b23aed232 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.c @@ -707,51 +707,47 @@ static int clear_keys_iterator(int keys_iterator_id){ return ret; } -int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, int* nbytes) { +int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbytes) { grib_context* c; int err=0; - size_t size=(size_t)*nbytes; FILE* f=get_file(*fid); if (f) { c=grib_context_get_default( ); - err=grib_read_any_headers_only_from_file(c,f,buffer,&size); - *nbytes=size; - return err; + err=grib_read_any_headers_only_from_file(c,f,buffer,nbytes); + return err; } else { return GRIB_INVALID_FILE; } } -int grib_f_read_any_headers_only_from_file__(int* fid, char* buffer, int* nbytes) { +int grib_f_read_any_headers_only_from_file__(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_any_headers_only_from_file_(fid,buffer,nbytes); } -int grib_f_read_any_headers_only_from_file(int* fid, char* buffer, int* nbytes) { +int grib_f_read_any_headers_only_from_file(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_any_headers_only_from_file_(fid,buffer,nbytes); } -int grib_f_read_any_from_file_(int* fid, char* buffer, int* nbytes) { +int grib_f_read_any_from_file_(int* fid, char* buffer, size_t* nbytes) { grib_context* c; int err=0; - size_t size=(size_t)*nbytes; FILE* f=get_file(*fid); if (f) { c=grib_context_get_default( ); - err=grib_read_any_from_file(c,f,buffer,&size); - *nbytes=size; - return err; + err=grib_read_any_from_file(c,f,buffer,nbytes); + return err; } else { return GRIB_INVALID_FILE; } } -int grib_f_read_any_from_file__(int* fid, char* buffer, int* nbytes) { +int grib_f_read_any_from_file__(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_any_from_file_(fid,buffer,nbytes); } -int grib_f_read_any_from_file(int* fid, char* buffer, int* nbytes) { +int grib_f_read_any_from_file(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_any_from_file_(fid,buffer,nbytes); } -int grib_f_write_file_(int* fid, char* buffer, int* nbytes) { +int grib_f_write_file_(int* fid, char* buffer, size_t* nbytes) { grib_context* c; FILE* f=get_file(*fid); @@ -768,14 +764,14 @@ int grib_f_write_file_(int* fid, char* buffer, int* nbytes) { return GRIB_INVALID_FILE; } } -int grib_f_write_file__(int* fid, char* buffer, int* nbytes) { +int grib_f_write_file__(int* fid, char* buffer, size_t* nbytes) { return grib_f_write_file_(fid,buffer,nbytes); } -int grib_f_write_file(int* fid, char* buffer, int* nbytes) { +int grib_f_write_file(int* fid, char* buffer, size_t* nbytes) { return grib_f_write_file_(fid,buffer,nbytes); } -int grib_f_read_file_(int* fid, char* buffer, int* nbytes) { +int grib_f_read_file_(int* fid, char* buffer, size_t* nbytes) { grib_context* c; FILE* f=get_file(*fid); @@ -793,10 +789,10 @@ int grib_f_read_file_(int* fid, char* buffer, int* nbytes) { } } -int grib_f_read_file__(int* fid, char* buffer, int* nbytes) { +int grib_f_read_file__(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_file_(fid,buffer,nbytes); } -int grib_f_read_file(int* fid, char* buffer, int* nbytes) { +int grib_f_read_file(int* fid, char* buffer, size_t* nbytes) { return grib_f_read_file_(fid,buffer,nbytes); } @@ -1134,7 +1130,7 @@ int grib_f_keys_iterator_get_name_(int* iterid,char* name,int len) { fort_char_clean(name,len); - sprintf(buf, "%s", grib_keys_iterator_get_name(kiter)); + sprintf(buf,"%s",grib_keys_iterator_get_name(kiter)); lsize=strlen(buf); if (len < lsize) return GRIB_ARRAY_TOO_SMALL; @@ -1356,7 +1352,7 @@ int grib_f_headers_only_new_from_file_(int* fid, int* gid){ grib_handle *h = NULL; if(f){ - h = grib_handle_headers_only_new_from_file(0,f,&err); + h=eccode_grib_new_from_file ( 0, f,1,&err); if(h){ push_handle(h,gid); return GRIB_SUCCESS; @@ -1971,7 +1967,7 @@ int grib_f_set_missing(int* gid, char* key, int len){ } int grib_f_is_missing_(int* gid, char* key,int* isMissing,int len){ - int err=0; + int err=0; grib_handle *h = get_handle(*gid); char buf[1024]; if(!h) return GRIB_INVALID_GRIB; diff --git a/fortran/grib_fortran_prototypes.h b/fortran/grib_fortran_prototypes.h index 2ad3fb454..a20a99a70 100644 --- a/fortran/grib_fortran_prototypes.h +++ b/fortran/grib_fortran_prototypes.h @@ -1,17 +1,26 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ /* grib_fortran.c */ -int grib_f_read_any_headers_only_from_file_(int *fid, char *buffer, int *nbytes); -int grib_f_read_any_headers_only_from_file__(int *fid, char *buffer, int *nbytes); -int grib_f_read_any_headers_only_from_file(int *fid, char *buffer, int *nbytes); -int grib_f_read_any_from_file_(int *fid, char *buffer, int *nbytes); -int grib_f_read_any_from_file__(int *fid, char *buffer, int *nbytes); -int grib_f_read_any_from_file(int *fid, char *buffer, int *nbytes); -int grib_f_write_file_(int *fid, char *buffer, int *nbytes); -int grib_f_write_file__(int *fid, char *buffer, int *nbytes); -int grib_f_write_file(int *fid, char *buffer, int *nbytes); -int grib_f_read_file_(int *fid, char *buffer, int *nbytes); -int grib_f_read_file__(int *fid, char *buffer, int *nbytes); -int grib_f_read_file(int *fid, char *buffer, int *nbytes); +int grib_f_read_any_headers_only_from_file_(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_any_headers_only_from_file__(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_any_headers_only_from_file(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_any_from_file_(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_any_from_file__(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_any_from_file(int *fid, char *buffer, size_t *nbytes); +int grib_f_write_file_(int *fid, char *buffer, size_t *nbytes); +int grib_f_write_file__(int *fid, char *buffer, size_t *nbytes); +int grib_f_write_file(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_file_(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_file__(int *fid, char *buffer, size_t *nbytes); +int grib_f_read_file(int *fid, char *buffer, size_t *nbytes); int grib_f_open_file_(int *fid, char *name, char *op, int lname, int lop); int grib_f_open_file__(int *fid, char *name, char *op, int lname, int lop); int grib_f_open_file(int *fid, char *name, char *op, int lname, int lop); diff --git a/fortran/grib_types.f90 b/fortran/grib_types.f90 index d635c7011..fe9125d35 100644 --- a/fortran/grib_types.f90 +++ b/fortran/grib_types.f90 @@ -1,3 +1,11 @@ +! Copyright 2005-2012 ECMWF. +! +! This software is licensed under the terms of the Apache Licence Version 2.0 +! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +! +! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + integer function kind_of_size_t() integer(2), dimension(2) :: x2 = (/1, 2/) integer(4), dimension(2) :: x4 = (/1, 2/) diff --git a/fortran/same_int_long.f90 b/fortran/same_int_long.f90 index 57cb5e9c6..b83b82513 100644 --- a/fortran/same_int_long.f90 +++ b/fortran/same_int_long.f90 @@ -1,3 +1,11 @@ +! Copyright 2005-2012 ECMWF. +! +! This software is licensed under the terms of the Apache Licence Version 2.0 +! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +! +! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + integer function kind_of_size_t() integer(2), dimension(2) :: x2 = (/1, 2/) integer(4), dimension(2) :: x4 = (/1, 2/) diff --git a/grib_api_for_mars/definitions/grib1/local.98.35.def b/grib_api_for_mars/definitions/grib1/local.98.35.def new file mode 100644 index 000000000..5a7145f4e --- /dev/null +++ b/grib_api_for_mars/definitions/grib1/local.98.35.def @@ -0,0 +1,39 @@ +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# +constant GRIBEXSection1Problem = 120 - section1Length ; + +template mars_labeling "grib1/mars_labeling.def"; + +unsigned[1] yearOfReference = yearOfCentury : dump; +unsigned[1] monthOfReference = month : dump; +unsigned[1] dayOfReference = day : dump; +unsigned[1] hourOfReference = hour : dump; +unsigned[1] minuteOfReference = minute : dump; +unsigned[1] centuryOfReference = centuryOfReferenceTimeOfData : dump; +transient secondsOfReference = 0 ; + +unsigned[1] numberOfForcasts=0 : dump; +unsigned[1] numberOfAnalysis=1 : dump; + +if (numberOfForcasts) { + unsigned[3] forecastSteps[numberOfForcasts] : dump; +} +if (numberOfAnalysis) { + signed[3] analysisOffsets[numberOfAnalysis] : dump; +} + +padto padding_local_35(offsetSection1 + 120); + +meta dateOfReference g1date(centuryOfReference,yearOfReference,monthOfReference,dayOfReference) : dump; +meta timeOfReference time(hourOfReference,minuteOfReference,secondsOfReference) : dump; + +if (indicatorOfTypeOfLevel==160) { + alias mars.levelist = level; +} + diff --git a/grib_api_for_mars/definitions/grib1/section.4.def b/grib_api_for_mars/definitions/grib1/section.4.def new file mode 100644 index 000000000..f522e38cd --- /dev/null +++ b/grib_api_for_mars/definitions/grib1/section.4.def @@ -0,0 +1,160 @@ +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# +# START grib1::section +# SECTION 4, Binary data section +# Length of section +# (octets) +position offsetSection4; + +# Due to a trick done by GRIBEX to support large GRIBs, we need a special treatment +# of the message length and of the section4 lenth, so instead of +# length[3] section4Length ; +# we get: +g1_section4_length[3] section4Length(totalLength); + +meta section4Pointer section_pointer(offsetSection4,section4Length,4); + +g1_half_byte_codeflag halfByte; +flags[1] dataFlag "grib1/11.table" = 0 : read_only; +signed[2] binaryScaleFactor = 0 : read_only,dump; +ibmfloat referenceValue : read_only,dump; +unsigned[1] bitsPerValue : dump ; +alias numberOfBitsContainingEachPackedValue = bitsPerValue; + +meta referenceValueError reference_value_error(referenceValue,ibm); + +flagbit sphericalHarmonics(dataFlag,7) : dump; +flagbit complexPacking(dataFlag,6) : dump; +flagbit integerPointValues(dataFlag,5) : dump; +flagbit additionalFlagPresent(dataFlag,4) : edition_specific,dump; + +transient hideThis=0; + +concept packingType { +#set uses the last one +#get returns the first match + "grid_simple" = { sphericalHarmonics = 0; complexPacking = 0; additionalFlagPresent = 0;} + "grid_ieee" = { sphericalHarmonics = 0; complexPacking = 0; + integerPointValues=1; additionalFlagPresent=1;} + "spectral_complex" = { sphericalHarmonics = 1; complexPacking = 1; + additionalFlagPresent = 0; } + "spectral_simple" = { sphericalHarmonics = 1; complexPacking = 0; additionalFlagPresent = 0; + representationMode=1;} + "spectral_ieee" = { sphericalHarmonics = 1; complexPacking = 1; + additionalFlagPresent = 0; hideThis=1; } + "grid_simple_matrix" = { sphericalHarmonics = 0; complexPacking = 0; additionalFlagPresent = 1;} + "grid_second_order" = { sphericalHarmonics = 0; complexPacking = 1; } + "grid_complex" = { sphericalHarmonics = 0; complexPacking = 0; additionalFlagPresent = 0;} + "grid_complex_spatial_differencing" = { sphericalHarmonics = 0; complexPacking = 0; additionalFlagPresent = 0;} + "grid_jpeg" = { sphericalHarmonics = 0; complexPacking = 0; additionalFlagPresent = 0;} + "grid_png" = { sphericalHarmonics = 0; complexPacking = 0; additionalFlagPresent = 0;} + "grid_simple_log_preprocessing"= { sphericalHarmonics = 0; complexPacking = 0; additionalFlagPresent = 0;} +} : dump; + + +alias ls.packingType=packingType; +alias typeOfPacking=packingType; + +if( binaryScaleFactor == -32767) { + constant dataRepresentationTemplateNumber = 0; + constant bitMapIndicator = 0; + # For grib 1 -> 2 + position offsetBeforeData; + transient numberOfCodedValues=numberOfPoints; + meta values data_dummy_field( + section4Length, + offsetBeforeData, + offsetSection4, + unitsFactor, + unitsBias, + changingPrecision, + numberOfCodedValues, + bitsPerValue, + referenceValue, + binaryScaleFactor, + decimalScaleFactor, + halfByte, + packingType, + grid_ieee,precision, + missingValue, + numberOfPoints, + bitmap + ) : dump; +} else { + template dataValues "grib1/data.[packingType:s].def"; +} + +position offsetAfterData; + +transient dataLength=(offsetAfterData-offsetBeforeData)/8; + +if (bitmapPresent==1) { + alias numberOfEffectiveValues=numberOfDataPoints; +} else { + alias numberOfEffectiveValues=numberOfCodedValues; +} + +_if (sphericalHarmonics) { + alias numberOfEffectiveValues=numberOfValues; +} + +#meta setDecimalPrecision suppressed(decimalPrecision,changeDecimalPrecision); +meta changeDecimalPrecision decimal_precision(bitsPerValue,decimalScaleFactor,changingPrecision,values) : edition_specific; +meta decimalPrecision decimal_precision(bitsPerValue,decimalScaleFactor,changingPrecision) : edition_specific; +alias setDecimalPrecision=changeDecimalPrecision; + +meta bitsPerValueAndRepack bits_per_value(values,bitsPerValue) : edition_specific; +alias setBitsPerValue=bitsPerValueAndRepack; + +meta scaleValuesBy scale_values(values,missingValue) : edition_specific; +meta offsetValuesBy offset_values(values,missingValue) : edition_specific; + +concept gridType { +#set uses the last one +#get returns the first match + "regular_ll" = {dataRepresentationType = 0; sphericalHarmonics = 0; PLPresent=0;} + "reduced_ll" = {dataRepresentationType = 0; sphericalHarmonics = 0; PLPresent=1; Ni=missing(); } + "mercator" = {dataRepresentationType = 1; sphericalHarmonics = 0; PLPresent=0; } + "lambert" = {dataRepresentationType = 3; sphericalHarmonics = 0; PLPresent=0; } + "polar_stereographic" = {dataRepresentationType = 5; sphericalHarmonics = 0; PLPresent=0; } + "UTM" = {dataRepresentationType = 6; sphericalHarmonics = 0; PLPresent=0; } + "simple_polyconic" = {dataRepresentationType = 7; sphericalHarmonics = 0; PLPresent=0; } + "albers" = {dataRepresentationType = 8; sphericalHarmonics = 0; PLPresent=0; } + "miller" = {dataRepresentationType = 8; sphericalHarmonics = 0; PLPresent=0; } + "rotated_ll" = {dataRepresentationType = 10; sphericalHarmonics = 0; PLPresent=0; } + "stretched_ll" = {dataRepresentationType = 20; sphericalHarmonics = 0; PLPresent=0; } + "stretched_rotated_ll" = {dataRepresentationType = 30; sphericalHarmonics = 0; PLPresent=0; } + "regular_gg" = {dataRepresentationType = 4; sphericalHarmonics = 0; PLPresent=0; } + "rotated_gg" = {dataRepresentationType = 14; sphericalHarmonics = 0; PLPresent=0; } + "stretched_gg" = {dataRepresentationType = 24; sphericalHarmonics = 0; PLPresent=0; } + "stretched_rotated_gg" = {dataRepresentationType = 34; sphericalHarmonics = 0; PLPresent=0; } + "reduced_gg" = {dataRepresentationType = 4; sphericalHarmonics = 0; + PLPresent=1; numberOfPointsAlongAParallel = missing(); + iDirectionIncrement = missing(); ijDirectionIncrementGiven=0;} + "sh" = {dataRepresentationType = 50; sphericalHarmonics = 1; PLPresent=0; } + "rotated_sh" = {dataRepresentationType = 60; sphericalHarmonics = 1; PLPresent=0; } + "stretched_sh" = {dataRepresentationType = 70; sphericalHarmonics = 1; PLPresent=0; } + "stretched_rotated_sh" = {dataRepresentationType = 80; sphericalHarmonics = 1; PLPresent=0; } + "space_view" = {dataRepresentationType = 90; sphericalHarmonics = 0; PLPresent=0; } + "unknown" = {PLPresent=0;} + "unknown_PLPresent" = {PLPresent=1;} +} : dump; + +alias ls.gridType=gridType; +alias geography.gridType=gridType; +alias typeOfGrid=gridType; + +meta getNumberOfValues size(values) : edition_specific,dump ; + +padtoeven padding_sec4_1(offsetSection4,section4Length) ; + +meta md5Section4 md5(offsetSection4,section4Length); + + + diff --git a/license.pl b/license.pl index 73da27d9c..e6c207271 100755 --- a/license.pl +++ b/license.pl @@ -2,16 +2,13 @@ use strict; my $APACHE = <<"EOF"; -Copyright 2005-2007 ECMWF +Copyright 2005-2012 ECMWF. -Licensed under the Apache License, Version 2.0 (the "License"); you may -not use this file except in compliance with the License. You may obtain a -copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless -required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES -OR CONDITIONS OF ANY KIND, either express or implied. See the License -for the specific language governing permissions and limitations under -the License. +This software is licensed under the terms of the Apache Licence Version 2.0 +which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + +In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. EOF my $LGPL = <<"EOF"; @@ -31,7 +28,7 @@ See LICENSE for details. EOF -my $LICENSE = $LGPL; +my $LICENSE = $APACHE; my %COMMENTS = ( diff --git a/mars_tests/Makefile.am b/mars_tests/Makefile.am new file mode 100755 index 000000000..7a8deb091 --- /dev/null +++ b/mars_tests/Makefile.am @@ -0,0 +1,12 @@ +if WITH_MARS_TESTS + TESTS = ls.sh + + noinst_PROGRAMS = + + LDADD = $(top_builddir)/src/libgrib_api.a $(EMOS_LIB) + + INCLUDES = -I$(top_builddir)/src + + EXTRA_DIST = $(TESTS) + +endif diff --git a/mars_tests/include.sh b/mars_tests/include.sh new file mode 100644 index 000000000..a8d0b9940 --- /dev/null +++ b/mars_tests/include.sh @@ -0,0 +1,53 @@ +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + +set -ea + +echo +echo "TEST: $0" + +data_dir="" + +# save current working dir +save=`pwd` + +if [ -z "${data_dir}" ] +then + cd ../ + cpath=`pwd` + GRIB_DEFINITION_PATH=$cpath/definitions + export GRIB_DEFINITION_PATH + GRIB_SAMPLES_PATH=$cpath/samples + export GRIB_SAMPLES_PATH + tools_dir=$cpath/tools/ + tigge_dir=$cpath/tigge/ + data_dir=$cpath/data + test_dir=$cpath/tests + def_dir=$cpath/definitions +else + tools_dir="" + tigge_dir="" +fi + +if [ -z "${GRIB_API_INCLUDE}" ] +then + GRIB_API_INCLUDE=`pwd`/src +fi + +if [ -z "${GRIB_API_LIB}" ] +then + GRIB_API_LIB=`pwd`/src +fi + +#${tools_dir}grib_info + +# go back to current working dir +cd $save + +set -u + diff --git a/mars_tests/ls.sh b/mars_tests/ls.sh new file mode 100755 index 000000000..079ce317e --- /dev/null +++ b/mars_tests/ls.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + +. ./include.sh + +rm -f log | true +workdir=`pwd` + +cd ${data_dir} +infile=regular_gaussian_model_level.grib1 + +${tools_dir}grib_ls -P count $infile > log +${tools_dir}grib_ls -p count,step $infile >> log +${tools_dir}grib_ls $infile >> log +${tools_dir}grib_ls -l 0,0,1 $infile >> log +${tools_dir}grib_get -l 0,0,1 $infile >> log +${tools_dir}grib_get -p count,step $infile >> log +${tools_dir}grib_get -P count $infile >> log + +files=" reduced_gaussian_lsm.grib1 +reduced_gaussian_model_level.grib1 +reduced_gaussian_model_level.grib2 +reduced_gaussian_pressure_level.grib1 +reduced_gaussian_pressure_level.grib2 +reduced_gaussian_pressure_level_constant.grib1 +reduced_gaussian_pressure_level_constant.grib2 +reduced_gaussian_sub_area.grib1 +reduced_gaussian_sub_area.grib2 +reduced_gaussian_surface.grib1 +reduced_gaussian_surface.grib2 +reduced_latlon_surface.grib1 +reduced_latlon_surface.grib2 +regular_gaussian_model_level.grib1 +regular_gaussian_model_level.grib2 +regular_gaussian_pressure_level.grib1 +regular_gaussian_pressure_level.grib2 +regular_gaussian_pressure_level_constant.grib1 +regular_gaussian_pressure_level_constant.grib2 +regular_gaussian_surface.grib1 +regular_gaussian_surface.grib2 +regular_latlon_surface.grib1 +regular_latlon_surface.grib2 +" + +for file in $files +do + echo $file >> log + ${tools_dir}grib_ls -l 40,28 $file | grep index | awk '{print $4;}' >> log +done + +diff log ls.log +rm -f log + +cd $workdir diff --git a/perf/jmeter.awk b/perf/jmeter.awk index a8212472f..5c8374ef1 100644 --- a/perf/jmeter.awk +++ b/perf/jmeter.awk @@ -1,3 +1,11 @@ +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# BEGIN { OFMT = "%.4f" print "" @@ -39,12 +47,6 @@ END { } } - - - - - - function jmeter_sample(dir, test_name,test_type,time,timestamp,success) { print "" } @@ -59,7 +61,6 @@ function junit_sample(dir,test_name,time,success) { } } - function get_time_in_msecs(timestring) { if ( timestring ~ /s$/ ) { # It must be the 0m0.003s format @@ -83,3 +84,4 @@ function get_dir(dir) { len = split(dir,bits,"/") return bits[len] } + diff --git a/perf/time.sh b/perf/time.sh index 6baf3fde6..425b348b5 100755 --- a/perf/time.sh +++ b/perf/time.sh @@ -1,3 +1,12 @@ -#This script times stuff to get nice reports +# This script times stuff to get nice reports + +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + echo "DIRECTORY: " `pwd` time $@ diff --git a/perl/GRIB-API/lib/GRIB/API.pm b/perl/GRIB-API/lib/GRIB/API.pm index 981e85607..4c900869d 100644 --- a/perl/GRIB-API/lib/GRIB/API.pm +++ b/perl/GRIB-API/lib/GRIB/API.pm @@ -83,7 +83,7 @@ If you have a web site set up for your module, mention it here. =head1 AUTHOR -Baudouin Raoult, Emab@suse.deE +Baudouin Raoult =head1 COPYRIGHT AND LICENSE Copyright 2005-2012 ECMWF. diff --git a/python/Makefile.am b/python/Makefile.am index 282559050..3b0712a47 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -4,25 +4,25 @@ if CREATING_SHARED_LIBS ############################################################################### # Case when shared libraries are enabled ############################################################################### -pkgpyexec_LTLIBRARIES = _gribapi_swig.la +pkgpyexec_LTLIBRARIES = _eccode_swig.la -_gribapi_swig_la_SOURCES = gribapi_swig_wrap.c grib_interface.c grib_interface.h -_gribapi_swig_la_LIBADD = $(top_builddir)/src/libgrib_api.la $(PYTHON_LIBS) -_gribapi_swig_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) +_eccode_swig_la_SOURCES = eccode_swig_wrap.c grib_interface.c grib_interface.h +_eccode_swig_la_LIBADD = $(top_builddir)/src/libgrib_api.la $(PYTHON_LIBS) +_eccode_swig_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) INCLUDES = $(PYTHON_INCLUDES) -I$(NUMPY_INCLUDE) -gribapi_swig_wrap.c: swig_wrap_$(PYTHON_DATA_HANDLER).c - cp -f swig_wrap_$(PYTHON_DATA_HANDLER).c gribapi_swig_wrap.c +eccode_swig_wrap.c: swig_wrap_$(PYTHON_DATA_HANDLER).c + cp -f swig_wrap_$(PYTHON_DATA_HANDLER).c eccode_swig_wrap.c -gribapi_swig.py: swig_wrap_$(PYTHON_DATA_HANDLER).py - cp -f swig_wrap_$(PYTHON_DATA_HANDLER).py gribapi_swig.py +eccode_swig.py: swig_wrap_$(PYTHON_DATA_HANDLER).py + cp -f swig_wrap_$(PYTHON_DATA_HANDLER).py eccode_swig.py # Extra stuff to go into the distribution EXTRA_DIST = grib_interface.h \ grib_interface.c \ - gribapi_swig.i \ - gribapi.py \ + eccode_swig.i \ + eccode.py \ numpy.i \ grib_errors.h \ extrules.am \ @@ -34,13 +34,13 @@ EXTRA_DIST = grib_interface.h \ # What else I want installed pkgpyexec_DATA = \ - gribapi.py \ - gribapi_swig.py + eccode.py \ + eccode_swig.py CLEANFILES = \ - gribapi_swig_wrap.c \ - gribapi_swig.py \ - _gribapi_swig.la + eccode_swig_wrap.c \ + eccode_swig.py \ + _eccode_swig.la include $(DEVEL_RULES) @@ -52,16 +52,16 @@ else noinst_SCRIPTS = setup.py CLEANFILES = $(noinst_SCRIPTS) \ - gribapi_swig_wrap.c \ - gribapi_swig.py \ - _gribapi_swig.so + eccode_swig_wrap.c \ + eccode_swig.py \ + _eccode_swig.so # Extra stuff to go into the distribution EXTRA_DIST = setup.py.in \ grib_interface.h \ grib_interface.c \ - gribapi_swig.i \ - gribapi.py \ + eccode_swig.i \ + eccode.py \ numpy.i \ grib_errors.h \ extrules.am \ @@ -72,11 +72,11 @@ EXTRA_DIST = setup.py.in \ swig_wrap_numpy.py # What I want installed -pdir = $(libdir)/python$(PYTHON_VERSION)/site-packages/grib_api +pdir = $(libdir)/python$(PYTHON_VERSION)/site-packages/eccode p_DATA = \ - _gribapi_swig.so \ - gribapi.py \ - gribapi_swig.py + _eccode_swig.so \ + eccode.py \ + eccode_swig.py do_subst = sed -e 's,[@]LIB_JASPER[@],$(LIB_JASPER),g' \ -e 's,[@]JASPER_DIR[@],$(JASPER_DIR),g' \ @@ -92,13 +92,13 @@ clean-local: setup.py: setup.py.in $(do_subst) < setup.py.in > setup.py -gribapi_swig_wrap.c: swig_wrap_$(PYTHON_DATA_HANDLER).c - cp -f swig_wrap_$(PYTHON_DATA_HANDLER).c gribapi_swig_wrap.c +eccode_swig_wrap.c: swig_wrap_$(PYTHON_DATA_HANDLER).c + cp -f swig_wrap_$(PYTHON_DATA_HANDLER).c eccode_swig_wrap.c -gribapi_swig.py: swig_wrap_$(PYTHON_DATA_HANDLER).py - cp -f swig_wrap_$(PYTHON_DATA_HANDLER).py gribapi_swig.py +eccode_swig.py: swig_wrap_$(PYTHON_DATA_HANDLER).py + cp -f swig_wrap_$(PYTHON_DATA_HANDLER).py eccode_swig.py -_gribapi_swig.so: setup.py gribapi_swig_wrap.c gribapi_swig.py +_eccode_swig.so: setup.py eccode_swig_wrap.c eccode_swig.py $(PYTHON) setup.py build_ext --inplace include $(DEVEL_RULES) diff --git a/python/eccode.i b/python/eccode.i new file mode 100644 index 000000000..e625a1d02 --- /dev/null +++ b/python/eccode.i @@ -0,0 +1,8 @@ +%module grib + +%{ +#include "grib_api.h"; +%} + +%include typemaps.i +%include "grib_api_typemaps.h" diff --git a/python/eccode.py b/python/eccode.py new file mode 100644 index 000000000..22fb05161 --- /dev/null +++ b/python/eccode.py @@ -0,0 +1,1676 @@ +""" +@package eccode +@brief This package is a low level Python interface to GRIB API. It offers almost one to one bindings to the C API functions. + +The Python interface to GRIB API uses by default the NumPy package +as the container of choice for the possible arrays of values that can be encoded/decoded in and from a grib message. +Numpy is a package used for scientific computing in Python and an efficient container for generic data. + +Alternatively, the Python interface can be built without Numpy support, in which case, the data container used +will be Python's native 'array' object. + +The Python interface and its support for NumPy can be enabled/disabled from the configure by using the following configure flags:\n + +@code +--enable-python +--disable-numpy + +Ex. ./configure --enable-python --disable-numpy +@endcode + +When the '--enable-python' flag is used, then the system Python will be used to build the interface. + +NumPy support can be disabled by using the '--disable-numpy' flag. + +@em Requirements: + + - Python 2.5 or higher + - NumPy (optional) + +""" +import eccode_swig as _internal +import types +import sys +import os +from array import array +from functools import wraps +#import inspect + +KEYTYPES = { + 1:int, + 2:float, + 3:str, +} + +# GRIB-51 Skip function arguments type checking if the +# environment variable is defined +no_type_checks = os.environ.get('GRIB_API_PYTHON_NO_TYPE_CHECKS') is not None + +# function arguments type checking decorator +# got inspired from http://code.activestate.com/recipes/454322-type-checking-decorator/ +# modified to support multiple allowed types and all types in the same decorator call +def require(**_params_): + def check_types(_func_, _params_ = _params_): + if no_type_checks: + return _func_ + @wraps(_func_) + def modified(*args, **kw): + arg_names = _func_.func_code.co_varnames + #argnames, varargs, kwargs, defaults = inspect.getargspec(_func_) + kw.update(zip(arg_names, args)) + for name, allowed_types in _params_.iteritems(): + param = kw[name] + if type(allowed_types) == types.TypeType: + allowed_types = (allowed_types,) + assert type(param) in allowed_types, \ + "Parameter '%s' should be type %s" % (name, " or ".join([t.__name__ for t in allowed_types])) + return _func_(**kw) + return modified + return check_types + +class InternalError(Exception): + """ + @brief Wrap errors coming from the C API in a Python exception object. + """ + def __init__(self, value): + # Call the base class constructor with the parameters it needs + Exception.__init__(self, value) + if type(value) is int: + err,self.msg = _internal.grib_c_get_error_string(value,1024) + assert(err == 0) + else: + self.msg = value + def __str__(self): + return self.msg + +class Bunch(dict): + """ + The collector of a bunch of named stuff :). + """ + def __init__(self, **kw): + dict.__init__(self, kw) + self.__dict__.update(kw) + + def __setitem__(self,key,value): + dict.__setitem__(self,key,value) + self.__dict__[key] = value + + def __setattr__(self,key,value): + dict.__setitem__(self,key,value) + self.__dict__[key] = value + + def __delitem__(self,key): + dict.__delitem__(self,key) + del self.__dict__[key] + + def __delattr__(self,key): + dict.__delitem__(self,key) + del self.__dict__[key] + + def __str__(self): + state = ["%s=%r" % (attribute, value) + for (attribute, value) + in self.__dict__.items()] + return '\n'.join(state) + +def with_numpy(): + """ + @brief Is numpy enabled? + @return 0->disabled, 1->enabled + """ + numpy = 0 + try: + _internal.with_numpy() + numpy = 1 + except AttributeError: + pass + + return numpy + +@require(errid=int) +def CHECK(errid): + """ + Utility function checking the GRIB API error code and raising + an error if that was set. + + @param errid the C interface error id to check + @exception InternalError + """ + if errid: + raise InternalError(errid) + +@require(fileobj=file) +def gts_new_from_file(fileobj,headers_only = False): + """ + @brief Load in memory a GTS message from a file. + + The message can be accessed through its id and it will be available\n + until @ref release is called.\n + + The message can be loaded headers only by using the headers_only argument. + Default is to have the headers only option set to off (False). If set to on (True), + data values will be skipped. This will result in a significant performance gain + if one is only interested in browsing through messages to retrieve metadata. + Any attempt to retrieve data values keys when in the headers only mode will + result in a key not found error. + + \b Examples: \ref get.py "get.py" + + @param fileobj python file object + @param headers_only whether or not to load the message with the headers only + @return id of the GTS loaded in memory + @exception InternalError + """ + err,gribid = _internal.grib_c_new_gts_from_file(fileobj, headers_only, 0) + if err: + if err == _internal.GRIB_END_OF_FILE: + return None + else: + CHECK(err) + else: + return gribid + +@require(fileobj=file) +def bufr_new_from_file(fileobj,headers_only = False): + """ + @brief Load in memory a BUFR message from a file. + + The message can be accessed through its id and it will be available\n + until @ref release is called.\n + + The message can be loaded headers only by using the headers_only argument. + Default is to have the headers only option set to off (False). If set to on (True), + data values will be skipped. This will result in a significant performance gain + if one is only interested in browsing through messages to retrieve metadata. + Any attempt to retrieve data values keys when in the headers only mode will + result in a key not found error. + + \b Examples: \ref get.py "get.py" + + @param fileobj python file object + @param headers_only whether or not to load the message with the headers only + @return id of the BUFR loaded in memory + @exception InternalError + """ + err,gribid = _internal.grib_c_new_bufr_from_file(fileobj, headers_only, 0) + if err: + if err == _internal.GRIB_END_OF_FILE: + return None + else: + CHECK(err) + else: + return gribid + +@require(fileobj=file) +def grib_new_from_file(fileobj,headers_only = False): + """ + @brief Load in memory a grib message from a file. + + The message can be accessed through its gribid and it will be available\n + until @ref release is called.\n + + The message can be loaded headers only by using the headers_only argument. + Default is to have the headers only option set to off (False). If set to on (True), + data values will be skipped. This will result in a significant performance gain + if one is only interested in browsing through messages to retrieve metadata. + Any attempt to retrieve data values keys when in the headers only mode will + result in a key not found error. + + \b Examples: \ref get.py "get.py" + + @param fileobj python file object + @param headers_only whether or not to load the message with the headers only + @return id of the grib loaded in memory + @exception InternalError + """ + err, gribid = _internal.grib_c_new_from_file(fileobj, 0, headers_only) + if err: + if err == _internal.GRIB_END_OF_FILE: + return None + else: + CHECK(err) + else: + return gribid + +@require(fileobj=file) +def grib_count_in_file(fileobj): + """ + @brief Count the messages in a file. + + \b Examples: \ref count_messages.py "count_messages.py" + + @param fileobj python file object + @return number of messages in the file + @exception InternalError + """ + err, num = _internal.grib_c_count_in_file(fileobj) + CHECK(err) + return num + +def grib_multi_support_on(): + """ + @brief Turn on the support for multiple fields in a single message. + + @exception InternalError + """ + _internal.grib_c_multi_support_on() + +def grib_multi_support_off(): + """ + @brief Turn off the support for multiple fields in a single message. + + @exception InternalError + """ + _internal.grib_c_multi_support_off() + +@require(gribid=int) +def release(gribid): + """ + @brief Free the memory for the message referred as gribid. + + \b Examples: \ref get.py "get.py" + + @param gribid id of the grib loaded in memory + @exception InternalError + """ + CHECK(_internal.grib_c_release(gribid)) + +@require(gribid=int,key=str) +def get_string(gribid,key): + """ + @brief Get the string value of a key from a grib message. + + @param gribid id of the grib loaded in memory + @param key key name + @return string value of key + @exception InternalError + """ + length = get_string_length(gribid,key) + err,value = _internal.grib_c_get_string(gribid,key,length) + CHECK(err) + + stpos = value.find('\0') + if stpos != -1: + value = value[0:stpos] + + return value + + +@require(gribid=int,key=str,value=str) +def set_string(gribid,key,value): + """ + @brief Set the value for a string key in a grib message. + + @param gribid id of the grib loaded in memory + @param key key name + @param value string value + @exception InternalError + """ + CHECK(_internal.grib_c_set_string(gribid,key,value,len(value))) + +def grib_gribex_mode_on(): + """ + @brief Turn on the compatibility mode with gribex. + + @exception InternalError + """ + _internal.grib_c_gribex_mode_on() + +def grib_gribex_mode_off(): + """ + @brief Turn off the compatibility mode with gribex. + + @exception InternalError + """ + _internal.grib_c_gribex_mode_off() + +@require(gribid=int, fileobj=file) +def write(gribid, fileobj): + """ + @brief Write a message to a file. + + \b Examples: \ref set.py "set.py" + + @param gribid id of the grib loaded in memory + @param fileobj python file object + @exception InternalError + """ + CHECK(_internal.grib_c_write(gribid, fileobj)) + +@require(multigribid=int,fileobj=file) +def grib_multi_write(multigribid, fileobj): + """ + @brief Write a multi field message to a file. + + \b Examples: \ref multi_write.py "multi_write.py" + + @param multigribid id of the multi field grib loaded in memory + @param fileobj python file object + @exception InternalError + """ + CHECK(_internal.grib_c_multi_write(multigribid, fileobj)) + +@require(ingribid=int,startsection=int,multigribid=int) +def grib_multi_append(ingribid, startsection, multigribid): + """ + @brief Append a single field grib message to a multi field grib message. + + Only the sections with section number greather or equal "startsection" + are copied from the input single message to the multi field output grib. + + \b Examples: \ref multi_write.py "multi_write.py" + + @param ingribid id of the input single grib + @param startsection starting from startsection (included) all the sections are copied + from the input single grib to the output multi grib + @param multigribid id of the output multi filed grib + @exception InternalError + """ + CHECK(_internal.grib_c_multi_append(ingribid, startsection, multigribid)) + +@require(gribid=int,key=str) +def get_size(gribid,key): + """ + @brief Get the size of an array key. + + \b Examples: \ref get.py "get.py",\ref count_messages.py "count_messages.py" + + @param gribid id of the grib loaded in memory + @param key name of the key + @exception InternalError + """ + err,result = _internal.grib_c_get_size_long(gribid,key) + CHECK(err) + return result + +@require(gribid=int,key=str) +def get_string_length(gribid,key): + """ + @brief Get the length of the string version of a key. + + @param gribid id of the grib loaded in memory + @param key name of the key + @exception InternalError + """ + err,result = _internal.grib_c_get_string_length(gribid,key) + CHECK(err) + return result + +@require(iterid=int) +def grib_skip_computed(iterid): + """ + @brief Skip the computed keys in a keys iterator. + + The computed keys are not coded in the message, they are computed + from other keys. + + @see grib_keys_iterator_new,grib_keys_iterator_next,grib_keys_iterator_delete + + @param iterid keys iterator id + @exception InternalError + """ + CHECK(_internal.grib_c_skip_computed(iterid)) + +@require(iterid=int) +def grib_skip_coded(iterid): + """ + @brief Skip the coded keys in a keys iterator. + + The coded keys are actually coded in the message. + + @see keys_iterator_new,keys_iterator_next,keys_iterator_delete + + @param iterid keys iterator id + @exception InternalError + """ + CHECK(_internal.grib_c_skip_coded(iterid)) + +@require(iterid=int) +def grib_skip_edition_specific(iterid): + """ + @brief Skip the edition specific keys in a keys iterator. + + @see keys_iterator_new,keys_iterator_next,keys_iterator_delete + + @param iterid keys iterator id + @exception InternalError + """ + CHECK(_internal.grib_c_skip_edition_specific(iterid)) + +@require(iterid=int) +def grib_skip_duplicates(iterid): + """ + @brief Skip the duplicate keys in a keys iterator. + + @see keys_iterator_new,keys_iterator_next,keys_iterator_delete + + @param iterid keys iterator id + @exception InternalError + """ + CHECK(_internal.grib_c_skip_duplicates(iterid)) + +@require(iterid=int) +def grib_skip_read_only(iterid): + """ + @brief Skip the read_only keys in a keys iterator. + + Read only keys cannot be set. + + @see keys_iterator_new,keys_iterator_next,keys_iterator_delete + + @param iterid keys iterator id + @exception InternalError + """ + CHECK(_internal.grib_c_skip_read_only(iterid)) + +@require(iterid=int) +def grib_skip_function(iterid): + """ + @brief Skip the function keys in a keys iterator. + + @see grib_keys_iterator_new,keys_iterator_next,keys_iterator_delete + + @param iterid keys iterator id + @exception InternalError + """ + CHECK(_internal.grib_c_skip_function(iterid)) + +@require(gribid=int,mode=int) +def iterator_new(gribid,mode): + """ + @brief Create a new geoiterator for the given message, using its geometry and values. + + The geoiterator can be used to go through all the geopoints in a message and + retrieve the values corresponding to those geopoints. + + \b Examples: \ref iterator.py "iterator.py" + + @param gribid id of the grib loaded in memory + @param mode flags for future use + @return geoiterator id + """ + err, iterid = _internal.grib_c_iterator_new(gribid,mode) + CHECK(err) + return iterid + +@require(iterid=int) +def iterator_delete(iterid): + """ + @brief Delete a geoiterator and free memory. + + \b Examples: \ref iterator.py "iterator.py" + + @param iterid geoiterator id + @exception InternalError + """ + CHECK(_internal.grib_c_iterator_delete(iterid)) + +@require(iterid=int) +def iterator_next(iterid): + """ + @brief Retrieve the next value from a geoiterator. + + \b Examples: \ref iterator.py "iterator.py" + + @param iterid geoiterator id + @return tuple with the latitude, longitude and value + @exception InternalError + """ + err,lat,lon,value = _internal.grib_c_iterator_next(iterid) + if (err == 0): + return [] + elif (err < 0): + CHECK(err) + else: + return (lat,lon,value) + +@require(gribid=int) +def keys_iterator_new(gribid,namespace=None): + """ + @brief Create a new iterator on the keys. + + The keys iterator can be navigated to give all the key names which + can then be used to get or set the key values with \ref get or + \ref set. + The set of keys returned can be controlled with the input variable + namespace or using the functions + \ref grib_skip_read_only, \ref grib_skip_duplicates, + \ref grib_skip_coded,\ref grib_skip_computed. + If namespace is a non empty string only the keys belonging to + that namespace are returned. Available namespaces are "ls" (to get the same + default keys as the grib_ls and "mars" to get the keys used by mars. + + \b Examples: \ref iterator.py "iterator.py" + + @param gribid id of the grib loaded in memory + @param namespace the namespace of the keys to search for (all the keys if empty) + @return keys iterator id to be used in the keys iterator functions + @exception InternalError + """ + err, iterid = _internal.grib_c_keys_iterator_new(gribid,namespace) + CHECK(err) + return iterid + +@require(iterid=int) +def keys_iterator_next(iterid): + """ + @brief Advance to the next keys iterator value. + + \b Examples: \ref keys_iterator.py "keys_iterator.py" + + @param iterid keys iterator id created with @ref keys_iterator_new + @exception InternalError + """ + res = _internal.grib_c_keys_iterator_next(iterid) + if res < 0: + CHECK(res) + return res + +@require(iterid=int) +def keys_iterator_delete(iterid): + """ + @brief Delete a keys iterator and free memory. + + \b Examples: \ref keys_iterator.py "keys_iterator.py" + + @param iterid keys iterator id created with @ref keys_iterator_new + @exception InternalError + """ + CHECK(_internal.grib_c_keys_iterator_delete(iterid)) + +@require(iterid=int) +def keys_iterator_get_name(iterid): + """ + @brief Get the name of a key from a keys iterator. + + \b Examples: \ref keys_iterator.py "keys_iterator.py" + + @param iterid keys iterator id created with @ref keys_iterator_new + @return key name to be retrieved + @exception InternalError + """ + err, name = _internal.grib_c_keys_iterator_get_name(iterid,1024) + CHECK(err) + return name + +@require(iterid=int) +def keys_iterator_rewind(iterid): + """ + @brief Rewind a keys iterator. + + @param iterid keys iterator id created with @ref keys_iterator_new + @exception InternalError + """ + CHECK(_internal.grib_c_keys_iterator_rewind(iterid)) + +@require(gribid=int,key=str) +def get_long(gribid,key): + """ + @brief Get the value of a key in a grib message as an int. + + @param gribid id of the grib loaded in memory + @param key key name + @return value of key as int + @exception InternalError + """ + err, value = _internal.grib_c_get_long(gribid,key) + CHECK(err) + return value + +@require(gribid=int,key=str) +def get_double(gribid,key): + """ + @brief Get the value of a key in a grib message as a float. + + @param gribid id of the grib loaded in memory + @param key key name + @return value of key as float + @exception InternalError + """ + err, value = _internal.grib_c_get_double(gribid,key) + CHECK(err) + return value + +@require(gribid=int,key=str,value=(int,long,float,str)) +def set_long(gribid,key,value): + """ + @brief Set the integer value for a key in a grib message. + + A TypeError exception will be thrown if value cannot be represented + as an integer. + + @param gribid id of the grib loaded in memory + @param key key name + @param value value to set + @exception InternalError,TypeError + """ + try: + value = int(value) + except (ValueError,TypeError): + raise TypeError("Invalid type") + + if (value > sys.maxint): + raise TypeError("Invalid type") + + CHECK(_internal.grib_c_set_long(gribid,key,value)) + +@require(gribid=int,key=str,value=(int,long,float,str)) +def set_double(gribid,key,value): + """ + @brief Set the double value for a key in a grib message. + + A TypeError exception will be thrown if value cannot be represented + as a float. + + @param gribid id of the grib loaded in memory + @param key key name + @param value float value to set + @exception InternalError,TypeError + """ + try: + value = float(value) + except (ValueError,TypeError): + raise TypeError("Invalid type") + + CHECK(_internal.grib_c_set_double(gribid,key,value)) + +@require(samplename=str) +def grib_new_from_samples(samplename): + """ + @brief Create a new valid gribid from a sample. + + The available samples are picked up from the directory pointed to + by the environment variable GRIB_SAMPLES_PATH. + To know where the samples directory is run the grib_info tool.\n + + \b Examples: \ref samples.py "samples.py" + + @param samplename name of the sample to be used + @return id of the grib loaded in memory + @exception InternalError + """ + err,gribid = _internal.grib_c_new_from_samples(0,samplename) + CHECK(err) + return gribid + +@require(gribid_src=int) +def clone(gribid_src): + """ + @brief Create a copy of a message. + + Create a copy of a given message (\em gribid_src) resulting in a new + message in memory (\em gribid_dest) identical to the original one. + + \b Examples: \ref clone.py "clone.py" + + @param gribid_src id of grib to be cloned + @return id of clone + @exception InternalError + """ + err,newgribid_src = _internal.grib_c_clone(gribid_src,0) + CHECK(err) + return newgribid_src + +@require(gribid=int,key=str) +def set_double_array(gribid, key, inarray): + """ + @brief Set the value of the key to a double array. + + The input array can be a numpy.ndarray or a python sequence like tuple, list, array, ... + + If NumPy is enabled, the wrapper will internally try to convert the input to a NumPy array + before extracting its data and length. This is possible as NumPy + allows the construction of arrays from arbitrary python sequences. + + The elements of the input sequence need to be convertible to a double. + + @param gribid id of the grib loaded in memory + @param key key name + @param inarray tuple,list,array,numpy.ndarray + @exception InternalError + """ + if with_numpy(): + CHECK(_internal.grib_set_double_ndarray(gribid,key,inarray)) + else: + nval = len(inarray) + a = _internal.new_doubleArray(nval) + s = _internal.intp() + s.assign(nval) + + for i in range(nval): + _internal.doubleArray_setitem(a,i,inarray[i]) + + CHECK(_internal.grib_c_set_real8_array(gribid,key,a,s)) + + _internal.delete_doubleArray(a) + +@require(gribid=int,key=str) +def get_double_array(gribid,key): + """ + @brief Get the value of the key as a double array. + + If NumPy is enabled, the double array will be stored in a NumPy ndarray. + Otherwise, Python's native array type will be used. + + @param gribid id of the grib loaded in memory + @param key key name + @return numpy.ndarray or array + @exception InternalError + """ + if with_numpy(): + nval = get_size(gribid,key) + err,result = _internal.grib_get_double_ndarray(gribid,key,nval) + CHECK(err) + return result + else: + nval = get_size(gribid,key) + a = _internal.new_doubleArray(nval) + s = _internal.intp() + s.assign(nval) + + CHECK(_internal.grib_c_get_real8_array(gribid,key,a,s)) + + result = array("d") + for i in range(nval): + result.append(_internal.doubleArray_getitem(a,i)) + + _internal.delete_doubleArray(a) + + return result + +@require(gribid=int,key=str) +def set_long_array(gribid, key, inarray): + """ + @brief Set the value of the key to an integer array. + + If NumPy is enabled, the wrapper will internally try to convert the input to a NumPy array + before extracting its data and length. This is possible as NumPy + allows the construction of arrays from arbitrary python sequences. + + The elements of the input sequence need to be convertible to an int. + + @param gribid id of the grib loaded in memory + @param key key name + @param inarray tuple,list,python array,numpy array + @exception InternalError + """ + if with_numpy(): + CHECK(_internal.grib_set_long_ndarray(gribid, key, inarray)) + else: + nval = len(inarray) + a = _internal.new_longArray(nval) + s = _internal.intp() + s.assign(nval) + + for i in range(nval): + _internal.longArray_setitem(a,i,inarray[i]) + + CHECK(_internal.grib_c_set_long_array(gribid,key,a,s)) + + _internal.delete_longArray(a) + +@require(gribid=int,key=str) +def get_long_array(gribid,key): + """ + @brief Get the integer array of values for a key from a grib message. + + If NumPy is enabled, the integer array will be stored in a NumPy ndarray. + Otherwise, Python's native array type will be used. + + @param gribid id of the grib loaded in memory + @param key key name + @return numpy.ndarray or array + @exception InternalError + """ + if with_numpy(): + nval = get_size(gribid,key) + err,result = _internal.grib_get_long_ndarray(gribid,key,nval) + CHECK(err) + return result + else: + nval = get_size(gribid,key) + a = _internal.new_longArray(nval) + s = _internal.intp() + s.assign(nval) + + CHECK(_internal.grib_c_get_long_array(gribid,key,a,s)) + + result = array("l") + for i in range(nval): + result.append(_internal.longArray_getitem(a,i)) + + _internal.delete_longArray(a) + + return result + +def grib_multi_new(): + """ + @brief Create a new multi field and return its id. + + \b Examples: \ref multi_write.py "multi_write.py" + + @return id of the multi field + @exception InternalError + """ + err,mgid = _internal.grib_c_multi_new() + CHECK(err) + return mgid + +@require(gribid=int) +def grib_multi_release(gribid): + """ + @brief Release a multi field from memory. + + \b Examples: \ref multi_write.py "multi_write.py" + + @param gribid id of the multi field we want to release the memory for + @exception InternalError + """ + CHECK(_internal.grib_c_multi_release(gribid)) + +@require(gribid_src=int,namespace=str,gribid_dest=int) +def grib_copy_namespace(gribid_src,namespace,gribid_dest): + """ + @brief Copy the value of all the keys belonging to a namespace from the source message + to the destination message. + + @param gribid_src id of source message + @param gribid_dest id of destination message + @param namespace namespace to be copied + @exception InternalError + """ + CHECK(_internal.grib_c_copy_namespace(gribid_src, namespace, gribid_dest)) + +@require(filename=str,keys=(tuple,list)) +def index_new_from_file(filename, keys): + """ + @brief Create a new index from a file. + + \b Examples: \ref index.py "index.py" + + @param filename path of the file to index on + @param keys sequence of keys to index on + @return index id + @exception InternalError + """ + ckeys = ",".join(keys) + err,iid = _internal.grib_c_index_new_from_file(filename, ckeys) + CHECK(err) + return iid + +@require(gribid=int) +def set_key_vals(gribid, key_vals): + """ + Set the values for several keys at once in a grib message. + + @param gribid id of the grib loaded in memory + @param key_vals can be a string, list/tuple or dictionary. + If a string, format must be "key1=val1,key2=val2" + If a list, it must contain strings of the form "key1=val1" + @exception InternalError + """ + if (len(key_vals) == 0): + raise InternalError("Empty key/values argument") + key_vals_str = "" + if isinstance(key_vals, str): + # Plain string. We need to do a DEEP copy so as not to change the original + key_vals_str = ''.join(key_vals) + elif isinstance(key_vals, list) or isinstance(key_vals, tuple): + # A list of key=val strings + for kv in key_vals: + if not isinstance(kv, str): + raise TypeError("Invalid list/tuple element type '%s'"%kv) + if not '=' in str(kv): + raise InternalError("Invalid list/tuple element format '%s'"%kv) + if len(key_vals_str) > 0: + key_vals_str += ',' + key_vals_str += kv + elif isinstance(key_vals, dict): + # A dictionary mapping keys to values + for key in key_vals.iterkeys(): + if len(key_vals_str) > 0: + key_vals_str += ',' + key_vals_str += key+'='+str(key_vals[key]) + else: + raise TypeError("Invalid argument type") + + CHECK(_internal.grib_c_set_key_vals(gribid, key_vals_str)) + +@require(indexid=int, filename=str) +def index_add_file(indexid, filename): + """ + @brief Add a file to an index. + + \b Examples: \ref index.py "index.py" + + @param indexid id of the index to add the file to + @param filename path of the file to be added to index + @exception InternalError + """ + err = _internal.grib_c_index_add_file(indexid, filename) + CHECK(err) + +@require(indexid=int) +def index_release(indexid): + """ + @brief Delete an index. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. + @exception InternalError + """ + CHECK(_internal.grib_c_index_release(indexid)) + +@require(indexid=int,key=str) +def index_get_size(indexid,key): + """ + @brief Get the number of distinct values for the index key. The key must belong to the index. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created on the given key. + @param key key for which the number of values is computed + @return number of distinct values for key in index + @exception InternalError + """ + err,value = _internal.grib_c_index_get_size_long(indexid,key) + CHECK(err) + return value + +@require(indexid=int,key=str) +def index_get_long(indexid,key): + """ + @brief Get the distinct values of the key in argument contained in the index. The key must belong to the index. + + This function is used when the type of the key was explicitly defined as long or when the native type of the key is long. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created with the key in argument. + @param key key for wich the values are returned + @return tuple with values of key in index + @exception InternalError + """ + nval = index_get_size(indexid,key) + + a = _internal.new_longArray(nval) + s = _internal.intp() + s.assign(nval) + + CHECK(_internal.grib_c_index_get_long(indexid,key,a,s)) + + result = [] + for i in range(nval): + result.append(_internal.longArray_getitem(a,i)) + + _internal.delete_longArray(a) + + return tuple(result) + +def index_get_string(indexid,key): + """ + @brief Get the distinct values of the key in argument contained in the index. The key must belong to the index. + + This function is used when the type of the key was explicitly defined as string or when the native type of the key is string. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created with the key in argument. + @param key key for wich the values are returned + @param return tuple with values of key in index + @exception InternalError + """ + nval = index_get_size(indexid,key) + max_val_size = 1024 + + err,raw_result,outnval = _internal.grib_c_index_get_string(indexid,key,max_val_size,nval) + CHECK(err) + + assert nval == outnval + + result = [] + for i in range(nval): + low = i*max_val_size + high = (i+1)*max_val_size + value = raw_result[low:high].rstrip() + result.append(value) + + return tuple(result) + +@require(iid=int,key=str) +def index_get_double(iid,key): + """ + @brief Get the distinct values of the key in argument contained in the index. The key must belong to the index. + + This function is used when the type of the key was explicitly defined as double or when the native type of the key is double. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created with the key in argument. + @param key key for wich the values are returned + @return tuple with values of key in index + @exception InternalError + """ + nval = index_get_size(iid,key) + + a = _internal.new_doubleArray(nval) + s = _internal.intp() + s.assign(nval) + + CHECK(_internal.grib_c_index_get_real8(iid,key,a,s)) + + result = [] + for i in range(nval): + result.append(_internal.doubleArray_getitem(a,i)) + + _internal.delete_doubleArray(a) + + return tuple(result) + +@require(indexid=int,key=str,val=int) +def index_select_long(indexid,key,val): + """ + @brief Select the message subset with key==value. The value is an integer. + + The key must have been created with integer type or have integer as native type if the type was not explicitly defined in the index creation. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created with the key in argument. + @param key key to be selected + @param value value of the key to select + @exception InternalError + """ + CHECK(_internal.grib_c_index_select_long(indexid,key,val)) + +@require(iid=int,key=str,val=float) +def index_select_double(iid,key,val): + """ + @brief Select the message subset with key==value. The value is a double. + + The key must have been created with integer type or have integer as native type if the type was not explicitly defined in the index creation. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created with the key in argument. + @param key key to be selected + @param value value of the key to select + @exception InternalError + """ + CHECK(_internal.grib_c_index_select_real8(iid,key,val)) + +@require(indexid=int,key=str,val=str) +def index_select_string(indexid,key,val): + """ + @brief Select the message subset with key==value. The value is a integer. + + The key must have been created with string type or have string as native type if the type was not explicitly defined in the index creation. + + In case of error, if the status parameter (optional) is not given, the program will + exit with an error message.\n Otherwise the error message can be + gathered with @ref grib_get_error_string. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created with the key in argument. + @param key key to be selected + @param value value of the key to select + @exception InternalError + """ + CHECK(_internal.grib_c_index_select_string(indexid,key,val)) + +def new_from_index(indexid): + """ + @brief Create a new handle from an index after having selected the key values. + + All the keys belonging to the index must be selected before calling this function. + Successive calls to this function will return all the handles compatible with the constraints defined selecting the values of the index keys. + + The message can be accessed through its gribid and it will be available until @ref release is called. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. + @return id of the grib loaded in memory or None if end of index + @exception InternalError + """ + err,gribid = _internal.grib_c_new_from_index(indexid,0) + + if err: + if err == _internal.GRIB_END_OF_INDEX: + return None + else: + CHECK(err) + else: + return gribid + +@require(gribid=int) +def get_message_size(gribid): + """ + @brief Get the size of a coded message. + + @param gribid id of the grib loaded in memory + @return size in bytes of the message + @exception InternalError + """ + err,value = _internal.grib_c_get_message_size(gribid) + CHECK(err) + return value + +@require(gribid=int) +def get_message_offset(gribid): + """ + @brief Get the offset of a coded message. + + @param gribid id of the grib loaded in memory + @return offset in bytes of the message + @exception InternalError + """ + err,value = _internal.grib_c_get_message_offset(gribid) + CHECK(err) + return value + +@require(gribid=int,key=str,index=int) +def get_double_element(gribid,key,index): + """ + @brief Get as double the i-th element of the "key" array. + + @param gribid id of the grib loaded in memory + @param key the key to be searched + @param index zero based index of value to retrieve + @return value + @exception InternalError + + """ + err,value = _internal.grib_c_get_real8_element(gribid,key,index) + CHECK(err) + return value + +@require(gribid=int,key=str,indexes=(list,tuple)) +def get_double_elements(gribid,key,indexes): + """ + @brief Get as double array the elements of the "key" array whose indexes are listed in the input array. + + @param gribid id of the grib loaded in memory + @param key the key to be searched + @param indexes list or tuple of indexes + @return numpy.ndarray or array + @exception InternalError + + """ + if with_numpy(): + nidx = len(indexes) + err,result = _internal.grib_get_double_ndelements(gribid,key,indexes,nidx) + CHECK(err) + return result + else: + nidx = len(indexes) + + pidx = _internal.new_intArray(nidx) + pval = _internal.new_doubleArray(nidx) + psize = _internal.intp() + psize.assign(nidx) + + for i in range(len(indexes)): + _internal.intArray_setitem(pidx,i,indexes[i]) + + err = _internal.grib_c_get_real8_elements(gribid,key,pidx,pval,psize) + CHECK(err) + + result = array("d") + for i in range(psize.value()): + result.append(_internal.doubleArray_getitem(pval,i)) + + _internal.delete_intArray(pidx) + _internal.delete_doubleArray(pval) + + return result + +def get_elements(gribid,key,indexes): + """ + @brief Retrieve the elements of the key array for the indexes specified in the input. + + @param gribid id of the grib loaded in memory + @param key the key to be searched + @param indexes single index or a list of indexes + @return numpy.ndarray or array containing the values of key for the given indexes + @exception InternalError + """ + try: + iter(indexes) + except TypeError: + indexes = (indexes,) + + nidx = len(indexes) + err,result = _internal.grib_get_double_ndelements(gribid,key,indexes,nidx) + CHECK(err) + return result + +@require(gribid=int,key=str) +def set_missing(gribid,key): + """ + @brief Set as missing the value for a key in a grib message. + + It can be used to set a missing value in the grib header but not in + the data values. + + \b Examples: \ref set_missing.py "set_missing.py" + + @param gribid id of the grib loaded in memory + @param key key name + @exception InternalError + """ + CHECK(_internal.grib_c_set_missing(gribid,key)) + +@require(gribid=int,key=str) +def is_missing(gribid,key): + """ + @brief Check if the value of a key is MISSING. + + The value of a key is considered as MISSING when all the bits assigned to it + are set to 1. This is different from the actual key missing from the grib message. + The value of a key MISSING has a special significance and that can be read about + in the WMO documentation. + + @param gribid id of the grib loaded in memory + @param key key name + @return 0->not missing, 1->missing + @exception InternalError + """ + err,value = _internal.grib_c_is_missing(gribid,key) + CHECK(err) + return value + + +@require(gribid=int,key=str) +def is_defined(gribid,key): + """ + @brief Check if a key is defined (exists) + @param gribid id of the grib loaded in memory + @param key key name + @return 0->not defined, 1->defined + @exception InternalError + """ + err,value = _internal.grib_c_is_defined(gribid,key) + CHECK(err) + return value + + +@require(gribid=int,inlat=(int,float),inlon=(int,float)) +def grib_find_nearest(gribid,inlat,inlon,is_lsm = False,npoints = 1): + """ + @brief Find the nearest grid point or the nearest four grid points to a given latitude/longitude. + + The number of nearest points returned can be controled through the npoints function argument. + + \b Examples: \ref nearest.py "nearest.py" + + @param gribid id of the grib loaded in memory + @param inlat latitude of the point + @param inlon longitude of the point + @param is_lsm True if the nearest land point is required otherwise False. + @param npoints 1 or 4 nearest grid points + @return (npoints*(outlat,outlon,value,dist,index)) + @exception InternalError + """ + if npoints == 1: + err,outlat,outlon,value,dist,idx = _internal.grib_c_find_nearest_single(gribid,is_lsm,inlat,inlon) + CHECK(err) + return (Bunch(lat = outlat,lon = outlon,value = value,distance = dist,index = idx),) + elif npoints == 4: + poutlat = _internal.new_doubleArray(4) + poutlon = _internal.new_doubleArray(4) + pvalues = _internal.new_doubleArray(4) + pdist = _internal.new_doubleArray(4) + pidx = _internal.new_intArray(4) + + CHECK(_internal.grib_c_find_nearest_four_single(gribid,is_lsm,inlat,inlon,poutlat,poutlon,pvalues,pdist,pidx)) + + result = [] + for i in range(4): + result.append(Bunch( \ + lat = _internal.doubleArray_getitem(poutlat,i), \ + lon = _internal.doubleArray_getitem(poutlon,i), \ + value = _internal.doubleArray_getitem(pvalues,i), \ + distance = _internal.doubleArray_getitem(pdist,i), \ + index = _internal.intArray_getitem(pidx,i), \ + )) + + _internal.delete_doubleArray(poutlat) + _internal.delete_doubleArray(poutlon) + _internal.delete_doubleArray(pvalues) + _internal.delete_doubleArray(pdist) + _internal.delete_intArray(pidx) + + return tuple(result) + else: + raise ValueError("Invalid value for npoints. Expecting 1 or 4.") + +@require(gribid=int,key=str) +def get_native_type(gribid, key): + """ + @brief Retrieve the native type of a key. + + Possible values can be int, float or string. + + @param gribid id of the grib loaded in memory + @param key key we want to find out the type for + @return type of key given as input or None if not determined + @exception InternalError + """ + err,itype = _internal.grib_c_get_native_type(gribid,key) + CHECK(err) + if itype in KEYTYPES: + return KEYTYPES[itype] + else: + return None + +@require(gribid=int,key=str) +def get(gribid,key, ktype=None): + """ + @brief Get the value of a key in a grib message. + + The type of value returned depends on the native type of the requested key. + The type of value returned can be forced by using the type argument of the + function. The type argument can be int, float or str. + + The \em gribid references a grib message loaded in memory. + + \b Examples: \ref get.py "get.py", \ref print_data.py "print_data.py" + + @see grib_new_from_file, release, set + + @param gribid id of the grib loaded in memory + @param key key name + @param ktype the type we want the output in (int, float or str), native type if not specified + @return scalar value of key as int, float or str + @exception InternalError + """ + if ktype is None: + ktype = get_native_type(gribid, key) + + result = None + if ktype is int: + result = get_long(gribid, key) + elif ktype is float: + result = get_double(gribid, key) + elif ktype is str: + result = get_string(gribid, key) + + return result + +@require(gribid=int,key=str) +def grib_get_array(gribid,key, ktype=None): + """ + @brief Get the contents of an array key. + + The output array will be stored in a NumPy ndarray or array. + The type of the array returned depends on the native type of the requested key. + The type of value returned can be forced by using the type argument of the function. + The type argument can be int or float. + + @param gribid id of the grib loaded in memory + @param key the key to get the value for + @param ktype the type we want the output in (can be int or float), native type if not specified + @return numpy.ndarray or array + @exception InternalError + """ + if ktype is None: + ktype = get_native_type(gribid,key) + + result = None + if ktype is int: + result = get_long_array(gribid, key) + elif ktype is float: + result = get_double_array(gribid, key) + + return result + +@require(gribid=int) +def get_values(gribid): + """ + @brief Retrieve the contents of the 'values' key. + + A NumPy ndarray or Python array containing the values in the message is returned. + + \b Examples: \ref print_data.py "print_data.py", \ref samples.py "samples.py" + + @param gribid id of the grib loaded in memory + @return numpy.ndarray or array + @exception InternalError + """ + return get_double_array(gribid,"values") + +@require(gribid=int) +def set_values(gribid,values): + """ + @brief Set the contents of the 'values' key. + + The input array can be a numpy.ndarray or a python sequence like tuple, list, array, ... + + If NumPy is enabled, the wrapper will internally try to convert the input to a NumPy array + before extracting its data and length. This is possible as NumPy + allows the construction of arrays from arbitrary python sequences. + + The elements of the input sequence need to be convertible to a double. + + \b Examples: \ref clone.py "clone.py", \ref samples.py "samples.py" + + @param gribid id of the grib loaded in memory + @param values array of values to set as tuple, list, array or numpy.ndarray + """ + set_double_array(gribid,"values",values) + +@require(gribid=int,key=str) +def set(gribid,key,value): + """ + @brief Set the value for a scalar key in a grib message. + + The input value can be a python int, float or str. + + \b Examples: \ref set.py "set.py" + + @see grib_new_from_file, release, get + + @param gribid id of the grib loaded in memory + @param key key name + @param value scalar value to set for key + @exception InternalError + """ + if isinstance(value,int): + set_long(gribid,key,value) + elif isinstance(value,float): + set_double(gribid,key,value) + elif isinstance(value,str): + set_string(gribid,key,value) + else: + raise InternalError("Invalid type of value when setting key '%s'." % key) + +@require(gribid=int,key=str) +def set_array(gribid,key,value): + """ + @brief Set the value for an array key in a grib message. + + Some array keys can be "values","pl", "pv" respectively the data values, + the list of number of points for each latitude in a reduced grid and the list of + vertical levels. + + The input array can be a numpy.ndarray or a python sequence like tuple, list, array, ... + + If NumPy is enabled, the wrapper will internally try to convert the input to a NumPy array + before extracting its data and length. This is possible as NumPy + allows the construction of arrays from arbitrary python sequences. + + @param gribid id of the grib loaded in memory + @param key key name + @param value array value to set for key + @exception InternalError + + """ + val0 = None + try: + val0 = value[0] + except TypeError: + pass + + if isinstance(val0, int): + set_long_array(gribid, key, value) + elif isinstance(val0, float): + set_double_array(gribid, key, value) + else: + raise InternalError("Invalid type of value when setting key '%s'." % key) + +@require(indexid=int,key=str) +def index_get(indexid,key, ktype=str): + """ + @brief Get the distinct values of an index key. The key must belong to the index. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created on the given key. + @param key key for which the values are returned + @return array of values + @exception InternalError + """ + # Cannot get the native type of a key from an index + # so right now the default is str. The user can overwrite + # the type but there is no way right now to do it automatically. + + #if ktype is None: + # ktype = get_native_type(indexid,key) + + result = None + if ktype is int: + result = index_get_long(indexid,key) + elif ktype is float: + result = index_get_double(indexid,key) + elif ktype is str: + result = index_get_string(indexid,key) + + return result + +@require(indexid=int,key=str) +def index_select(indexid,key,value): + """ + @brief Select the message subset with key==value. + + \b Examples: \ref index.py "index.py" + + @param indexid id of an index created from a file. The index must have been created with the key in argument. + @param key key to be selected + @param value value of the key to select + @exception InternalError + """ + if isinstance(value,int): + index_select_long(indexid,key,value) + elif isinstance(value,float): + index_select_double(indexid,key,value) + elif isinstance(value,str): + index_select_string(indexid,key,value) + else: + raise InternalError("Invalid type of value when setting key '%s'." % key) + +@require(indexid=int, filename=str) +def index_write(indexid, filename): + """ + @brief Write an index to a file for later reuse. + + An index can be loaded back from an index file with \ref index_read. + + \b Examples: \ref index.py "index.py" + + @param indexid id of the index + @param filename file to save the index to + @exception InternalError + """ + CHECK(_internal.grib_c_index_write(indexid, filename)) + +@require(filename=str) +def index_read(filename): + """ + @brief Loads an index previously saved with \ref index_write to a file. + + \b Examples: \ref index.py "index.py" + + @param filename file to load the index from + @return id of the loaded index + @exception InternalError + """ + err, indexid = _internal.grib_c_index_read(filename) + CHECK(err) + return indexid + +@require(flag=bool) +def no_fail_on_wrong_length(flag): + """ + @brief Do not fail if the message has the wrong length. + + @param flag True/False + """ + if flag: + _internal.no_fail_on_wrong_length(1) + else: + _internal.no_fail_on_wrong_length(0) + +@require(flag=bool) +def gts_header(flag): + """ + @brief Set the GTS header on/off. + + @param flag True/False + """ + if flag: + _internal.grib_c_gts_header_on() + else: + _internal.grib_c_gts_header_off() + +def get_api_version(): + """ + @brief Get the api version. + + Returns the version of the api as a string in the format "major.minor.revision". + """ + div = lambda v,d: (v/d,v%d) + v = _internal.grib_c_get_api_version() + v,revision = div(v,100) + v,minor = div(v,100) + major = v + + return "%d.%d.%d" % (major,minor,revision) + +__version__ = get_api_version() + +@require(gribid=int) +def get_message(gribid): + """ + @brief Get the binary message. + + Returns the binary string message associated with the grib identified by gribid. + + @see new_from_message + + @param gribid id of the grib loaded in memory + @return binary string message associated with gribid + @exception InternalError + """ + error,message = _internal.grib_c_get_message(gribid) + CHECK(error) + return message + +@require(message=str) +def new_from_message(message): + """ + @brief Create a grib handle from a message in memory. + + Create a new grib message from the input binary string and return its grib id. + + @see get_message + + @param message binary string message + @return gribid of the newly created grib message + @exception InternalError + """ + error,gribid = _internal.grib_c_new_from_message(0,message,len(message)) + CHECK(error) + return gribid diff --git a/python/eccode_swig.i b/python/eccode_swig.i new file mode 100644 index 000000000..1b546ca4f --- /dev/null +++ b/python/eccode_swig.i @@ -0,0 +1,209 @@ +%module eccode_swig + +%include "cpointer.i" +%include "cstring.i" +%include "typemaps.i" +%include "cdata.i" +%include "carrays.i" +%include "grib_errors.h" + +%{ +#define SWIG_FILE_WITH_INIT +#include "grib_interface.h" +%} + +#if defined(NUMPY) + +%include "numpy.i" +%init %{ +import_array(); +%} + +#endif + +/* Converts a PyFile instance to a stdio FILE* */ +%typemap(in) FILE* { + if ( PyFile_Check($input) ){ + $1 = PyFile_AsFile($input); + } else { + PyErr_SetString(PyExc_TypeError, "$1_name must be a file type."); + return NULL; + } +} + +%pointer_class(int, intp); +%pointer_class(long, longp); +%pointer_class(double, doublep); +%array_functions(double, doubleArray); +%array_functions(long, longArray); +%array_functions(int, intArray); + +// creation +int grib_c_new_from_file(FILE* f, int* INOUT, int headers_only); +int grib_c_new_bufr_from_file(FILE* f, int headers_only, int* INOUT); +int grib_c_new_gts_from_file(FILE* f, int headers_only, int* INOUT); +int grib_c_iterator_new(int* INPUT, int* OUTPUT, int* INPUT); +int grib_c_keys_iterator_new(int* INPUT, int* OUTPUT, char* name_space); +int grib_c_new_from_samples(int* INOUT, char* name); +int grib_c_index_new_from_file(char* file, char* keys, int* OUTPUT); +int grib_c_index_add_file(int* INPUT, char* file); +int grib_c_new_from_index(int *INPUT, int *INOUT); +int grib_c_index_write(int* INPUT, char* file); +int grib_c_index_read(char* file, int* OUTPUT); +int grib_c_new_from_message(int *INOUT, char *binmsg, size_t *INPUT); +// --- + +%apply int* INPUT { int* fid }; +%apply int* INPUT { int* gid }; +%apply int* INPUT { int* iterid }; +%apply int* INPUT { int* iid }; + +// file operations +int grib_c_count_in_file(FILE* f,int* OUTPUT); +// --- + +// grib handle operations +int grib_c_release(int* gid); +int grib_c_write(int* gid, FILE* f); +int grib_c_get_size_long(int* gid, char* key, long* OUTPUT); +int grib_c_get_string_length(int* gid, char* key, size_t* OUTPUT); +int grib_c_clone(int* gid,int* INOUT); +int grib_c_copy_namespace(int* gid, char* name, int* INPUT); +int grib_c_get_message_size(int* gid, size_t* OUTPUT); +int grib_c_get_message_offset(int* gid, size_t* OUTPUT); +int grib_c_get_native_type(int* gid, char* key, int* OUTPUT); +// --- + +// multi support +int grib_c_multi_new(int* OUTPUT); +int grib_c_multi_support_on(void); +int grib_c_multi_write(int* gid, FILE* f); +int grib_c_multi_support_off(void); +int grib_c_multi_release(int* gid); +int grib_c_multi_append(int* INPUT, int* INPUT,int* INPUT); +// --- + +// gribex support +int grib_c_gribex_mode_on(void); +int grib_c_gribex_mode_off(void); +// --- + +// keys iterator +int grib_c_keys_iterator_next(int* iterid); +int grib_c_keys_iterator_delete(int* iterid); +int grib_c_skip_computed(int* iterid); +int grib_c_skip_coded(int* iterid); +int grib_c_skip_edition_specific(int* iterid); +int grib_c_skip_duplicates(int* iterid); +int grib_c_skip_read_only(int* iterid); +int grib_c_skip_function(int* iterid); +int grib_c_keys_iterator_rewind(int* iterid); + +%cstring_bounded_output(char* name, 1024); +int grib_c_keys_iterator_get_name(int* iterid, char* name, int len); +// --- + +// indexing routines +int grib_c_index_get_size_long(int* iid, char* key, long* OUTPUT); +int grib_c_index_get_long(int* iid, char* key, long* val, int* size); +int grib_c_index_get_real8(int* iid, char* key, double* val, int* size); +%cstring_bounded_output(char* index_string_output, 1024*1024); +int grib_c_index_get_string(int* iid, char* key, char* index_string_output, int* INPUT, int* INOUT); +int grib_c_index_select_long(int *iid, char *key, long *INPUT); +int grib_c_index_select_real8(int *iid, char *key, double *INPUT); +int grib_c_index_select_string(int *iid, char *key, char *val); +int grib_c_index_release(int* iid); +// --- + +// values iterator +int grib_c_iterator_delete(int* iterid); +int grib_c_iterator_next(int* iterid, double* OUTPUT, double* OUTPUT, double* OUTPUT); +// --- + +// getting/setting key values +%cstring_output_withsize(char* string_val, size_t* string_size) +int grib_c_get_string(int* gid, char* key, char* string_val, size_t* string_size); +int grib_c_set_string(int* gid, char* key, char* sval, int len2); +int grib_c_get_long(int* gid, char* key, long* OUTPUT); +int grib_c_set_long(int* gid, char* key, long* INPUT); +int grib_c_get_double(int* gid, char* key, double* OUTPUT); +int grib_c_set_double(int* gid, char* key, double* INPUT); +int grib_c_set_real8_array(int* gid, char* key, double* val, int* size); +int grib_c_get_real8_array(int* gid, char* key, double* val, int* size); +int grib_c_get_long_array(int* gid, char* key, long* val, int* size); +int grib_c_set_long_array(int* gid, char* key, long* val, int* size); +int grib_c_get_real8_element(int* gid, char* key, int* INPUT, double* OUTPUT); +int grib_c_get_real8_elements(int* gid, char* key, int* index, double* val, int* size); +int grib_c_set_missing(int* gid, char* key); +int grib_c_set_key_vals(int* gid, char* keyvals); +int grib_c_is_missing(int* gid, char* key, int* OUTPUT); +int grib_c_is_defined(int* gid, char* key, int* OUTPUT); + +#if defined(NUMPY) + +%apply (double* IN_ARRAY1, int DIM1) {(double* dpin_val, int dpin_val_dim1)}; +%apply (long* IN_ARRAY1, int DIM1) {(long* lpin_val, int lpin_val_dim1)}; +%apply (int* IN_ARRAY1, int DIM1) {(int* ipin_index, int ipin_index_dim1)}; +%apply (double* ARGOUT_ARRAY1, int DIM1) {(double* dpout_val, int dpout_val_dim1)}; +%apply (long* ARGOUT_ARRAY1, int DIM1) {(long* lpout_val, int lpout_val_dim1)}; + +%inline %{ +void with_numpy() { + return; +} +int grib_set_double_ndarray(int* gid, char* key, double* dpin_val, int dpin_val_dim1) { + return grib_c_set_real8_array(gid,key,dpin_val,&dpin_val_dim1); +} +int grib_set_long_ndarray(int* gid, char* key, long* lpin_val, int lpin_val_dim1) { + return grib_c_set_long_array(gid,key,lpin_val,&lpin_val_dim1); +} +int grib_get_double_ndarray(int* gid, char* key, double* dpout_val, int dpout_val_dim1) { + return grib_c_get_real8_array(gid,key,dpout_val,&dpout_val_dim1); +} +int grib_get_long_ndarray(int* gid, char* key, long* lpout_val, int lpout_val_dim1) { + return grib_c_get_long_array(gid,key,lpout_val,&lpout_val_dim1); +} +int grib_get_double_ndelements(int* gid, char* key, int* ipin_index, int ipin_index_dim1, double* dpout_val, int dpout_val_dim1) { + return grib_c_get_real8_elements(gid,key,ipin_index,dpout_val,&dpout_val_dim1); +} +%} +%clear double* dpin_val, int dpin_val_dim1; +%clear long* lpin_val, int lpin_val_dim1; +%clear int* ipout_val, int ipout_val_dim1; +%clear double* dpout_val, int dpout_val_dim1; +%clear long* lpout_val, int lpout_val_dim1; + +#endif +// --- + +// nearest +int grib_c_find_nearest_single(int* gid, int* INPUT, double* INPUT, double* INPUT, double* OUTPUT, double* OUTPUT, double* OUTPUT, double* OUTPUT, int* OUTPUT); +int grib_c_find_nearest_four_single(int* gid, int* INPUT, double* INPUT, double* INPUT, double* outlats, double* outlons, double* values, double* distances, int* indexes); +// --- + +/* +* Get the binary string message for a grib. +* +* Set the 3rd argument to nothing in 'cstring_output_allocate_size'. +* This is kind of difficult to explain, but, *msg will point directly to +* the binary message data of the current grib (which is stored in +* handle->buffer->data if I remember correctly) so freeing it will cause +* the binary message data in the grib_handle structure to be freed. This +* is a problem as grib_api does not know that, so it tries to free it +* itself (grib_release does that) resulting in a 'Segmentation fault'. +*/ +%cstring_output_allocate_size(const void **binmsg, size_t *binmsglen,); +int grib_c_get_message(int *gid, const void **binmsg, size_t *binmsglen); +%clear const void **binmsg, size_t *binmsglen; + +%clear int* fid; +%clear int* gid; +%clear int* iterid; + +%cstring_bounded_output(char* error_message, 1024); +int grib_c_get_error_string(int* INPUT, char* error_message, int len); + +void no_fail_on_wrong_length(int flag); +long grib_c_get_api_version(); +void grib_c_gts_header_on(); +void grib_c_gts_header_off(); diff --git a/python/extrules.am b/python/extrules.am index 0b81577b9..3279fc586 100644 --- a/python/extrules.am +++ b/python/extrules.am @@ -1,8 +1,8 @@ -swig : gribapi_swig.i +swig : eccode_swig.i p4 edit swig_wrap_numpy.c swig_wrap_numpy.py swig_wrap_array.c swig_wrap_array.py - swig -python -module gribapi_swig -DNUMPY -o swig_wrap_numpy.c gribapi_swig.i - cp gribapi_swig.py swig_wrap_numpy.py + swig -python -module eccode_swig -DNUMPY -o swig_wrap_numpy.c eccode_swig.i + cp eccode_swig.py swig_wrap_numpy.py - swig -python -module gribapi_swig -o swig_wrap_array.c gribapi_swig.i - cp gribapi_swig.py swig_wrap_array.py + swig -python -module eccode_swig -o swig_wrap_array.c eccode_swig.i + cp eccode_swig.py swig_wrap_array.py diff --git a/python/grib_interface.c b/python/grib_interface.c index fd2807cd5..acdc299ef 100644 --- a/python/grib_interface.c +++ b/python/grib_interface.c @@ -992,12 +992,12 @@ int grib_c_count_in_file(FILE* f,int* n) { return err; } -int grib_c_new_gts_from_file(FILE* f, int* gid){ +int grib_c_new_gts_from_file(FILE* f,int headers_only, int* gid){ grib_handle *h = NULL; int err = 0; if(f){ - h = grib_gts_handle_new_from_file(0,f,&err); + h = eccode_gts_new_from_file(0,f,headers_only,&err); if(h){ push_handle(h,gid); @@ -1012,12 +1012,12 @@ int grib_c_new_gts_from_file(FILE* f, int* gid){ return GRIB_INVALID_FILE; } -int grib_c_new_bufr_from_file(FILE* f, int* gid){ +int grib_c_new_bufr_from_file(FILE* f,int headers_only,int* gid){ grib_handle *h = NULL; int err = 0; if(f){ - h = grib_bufr_handle_new_from_file(0,f,&err); + h = eccode_bufr_new_from_file(0,f,headers_only,&err); if(h){ push_handle(h,gid); @@ -1037,9 +1037,7 @@ int grib_c_new_from_file(FILE* f, int* gid, int headers_only){ int err = 0; if(f){ - h = headers_only ? - grib_handle_headers_only_new_from_file(0,f,&err) : - grib_handle_new_from_file(0,f,&err); + h=eccode_grib_new_from_file(0,f,headers_only,&err); if(h){ push_handle(h,gid); @@ -1169,6 +1167,29 @@ int grib_c_get_size_int(int* gid, char* key, int* val){ } } +int grib_c_get_message_offset(int* gid, size_t* offset){ + int err = GRIB_SUCCESS; + off_t myoffset; + grib_handle *h = get_handle(*gid); + + if(!h) + return GRIB_INVALID_GRIB; + else { + err=grib_get_message_offset(h, &myoffset); + *offset=myoffset; + return err; + } +} + +int grib_c_get_message_size(int* gid, size_t* size){ + grib_handle *h = get_handle(*gid); + + if(!h) + return GRIB_INVALID_GRIB; + else + return grib_get_message_size(h, size); +} + int grib_c_get_string_length(int* gid, char* key, size_t* val){ grib_handle *h = get_handle(*gid); @@ -1459,7 +1480,7 @@ int grib_c_set_key_vals(int* gid, char* keyvals) } int grib_c_is_missing(int* gid, char* key,int* isMissing){ - int err=0; + int err=0; grib_handle *h = get_handle(*gid); if(!h) return GRIB_INVALID_GRIB; @@ -1818,14 +1839,6 @@ int grib_c_get_data_real8(int* gid,double* lats, double* lons,double* values,siz } -int grib_c_get_message_size(int* gid, size_t *len){ - grib_handle *h = get_handle(*gid); - if(!h) return GRIB_INVALID_GRIB; - - *len = h->buffer->ulength; - return GRIB_SUCCESS; - -} int grib_c_copy_message(int* gid, void* mess,size_t* len){ grib_handle *h = get_handle(*gid); diff --git a/python/grib_interface.h b/python/grib_interface.h index e19db589e..ac0d51289 100644 --- a/python/grib_interface.h +++ b/python/grib_interface.h @@ -32,8 +32,8 @@ int grib_c_clone(int *gidsrc, int *giddest); int grib_c_copy_namespace(int *gidsrc, char *name, int *giddest); int grib_c_count_in_file(FILE *f, int *n); int grib_c_new_from_file(FILE *f, int *gid, int headers_only); -int grib_c_new_bufr_from_file(FILE *f, int *gid); -int grib_c_new_gts_from_file(FILE *f, int *gid); +int grib_c_new_bufr_from_file(FILE *f, int headers_only,int *gid); +int grib_c_new_gts_from_file(FILE *f,int headers_only, int *gid); int grib_c_new_from_index(int *iid, int *gid); int grib_c_index_new_from_file(char *file, char *keys, int *gid); int grib_c_index_add_file(int* iid, char* file); @@ -88,6 +88,7 @@ int grib_c_set_string(int *gid, char *key, char *val, int len2); int grib_c_get_data_real4(int *gid, float *lats, float *lons, float *values, size_t *size); int grib_c_get_data_real8(int *gid, double *lats, double *lons, double *values, size_t *size); int grib_c_get_message_size(int *gid, size_t *len); +int grib_c_get_message_offset(int *gid, off_t *len); int grib_c_copy_message(int *gid, void *mess, size_t *len); void grib_c_check(int *err, char *call, char *str); int grib_c_write(int *gid, FILE *f); diff --git a/python/gribapi.c b/python/gribapi.c index 3f06b2930..6fcb0b8f7 100644 --- a/python/gribapi.c +++ b/python/gribapi.c @@ -1,10 +1,18 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "Python.h" #include "grib_api.h" - static PyObject* Error; - PyDoc_STRVAR(gribapi__doc__, "gribapi point evalutation kernel"); @@ -185,3 +193,4 @@ initgribapi(void) Py_INCREF(Error); PyModule_AddObject(m, "error", Error); } + diff --git a/python/gribapi_swig.i b/python/gribapi_swig.i index efc23d4fb..307f2ca82 100644 --- a/python/gribapi_swig.i +++ b/python/gribapi_swig.i @@ -40,8 +40,8 @@ import_array(); // creation int grib_c_new_from_file(FILE* f, int* INOUT, int headers_only); -int grib_c_new_bufr_from_file(FILE* f, int* INOUT); -int grib_c_new_gts_from_file(FILE* f, int* INOUT); +int grib_c_new_bufr_from_file(FILE* f, int headers_only, int* INOUT); +int grib_c_new_gts_from_file(FILE* f, int headers_only, int* INOUT); int grib_c_iterator_new(int* INPUT, int* OUTPUT, int* INPUT); int grib_c_keys_iterator_new(int* INPUT, int* OUTPUT, char* name_space); int grib_c_new_from_samples(int* INOUT, char* name); @@ -134,7 +134,6 @@ int grib_c_set_long_array(int* gid, char* key, long* val, int* size); int grib_c_get_real8_element(int* gid, char* key, int* INPUT, double* OUTPUT); int grib_c_get_real8_elements(int* gid, char* key, int* index, double* val, int* size); int grib_c_set_missing(int* gid, char* key); -int grib_c_set_key_vals(int* gid, char* keyvals); int grib_c_is_missing(int* gid, char* key, int* OUTPUT); int grib_c_is_defined(int* gid, char* key, int* OUTPUT); diff --git a/python/setup.py.in b/python/setup.py.in index c121621a1..e703e137e 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -4,7 +4,7 @@ from distutils.core import setup, Extension import os,sys attdict = dict( - sources = ['gribapi_swig_wrap.c','grib_interface.c'], + sources = ['eccode_swig_wrap.c','grib_interface.c'], swig_opts = [], include_dirs = ['.'], library_dirs = ["%s/lib" % sys.prefix], @@ -57,12 +57,12 @@ if data_handler == "numpy": include_dirs = numpy_include, ) -gribapi_module = Extension('_gribapi_swig',**attdict) +eccode_module = Extension('_eccode_swig',**attdict) -setup (name = 'gribapi', +setup (name = 'eccode', version = '0.1', author = 'ECMWF', description = """Grib API SWIG module""", - ext_modules = [gribapi_module], - py_modules = ['gribapi_swig','gribapi'], + ext_modules = [eccode_module], + py_modules = ['eccode_swig','eccode'], ) diff --git a/python/swig_wrap_array.c b/python/swig_wrap_array.c index 68358ac36..4b9caaa19 100644 --- a/python/swig_wrap_array.c +++ b/python/swig_wrap_array.c @@ -2682,16 +2682,16 @@ static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0}; #endif /*----------------------------------------------- - @(target):= _gribapi_swig.so + @(target):= _eccode_swig.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__gribapi_swig +# define SWIG_init PyInit__eccode_swig #else -# define SWIG_init init_gribapi_swig +# define SWIG_init init_eccode_swig #endif -#define SWIG_name "_gribapi_swig" +#define SWIG_name "_eccode_swig" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION @@ -4065,14 +4065,18 @@ fail: SWIGINTERN PyObject *_wrap_grib_c_new_bufr_from_file(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; FILE *arg1 = (FILE *) 0 ; - int *arg2 = (int *) 0 ; - int temp2 ; - int res2 = 0 ; + int arg2 ; + int *arg3 = (int *) 0 ; + int val2 ; + int ecode2 = 0 ; + int temp3 ; + int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"OO:grib_c_new_bufr_from_file",&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOO:grib_c_new_bufr_from_file",&obj0,&obj1,&obj2)) SWIG_fail; { if ( PyFile_Check(obj0) ){ arg1 = PyFile_AsFile(obj0); @@ -4081,23 +4085,28 @@ SWIGINTERN PyObject *_wrap_grib_c_new_bufr_from_file(PyObject *SWIGUNUSEDPARM(se return NULL; } } - if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) { + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "grib_c_new_bufr_from_file" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) { int val; - int ecode = SWIG_AsVal_int(obj1, &val); + int ecode = SWIG_AsVal_int(obj2, &val); if (!SWIG_IsOK(ecode)) { - SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_bufr_from_file" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_bufr_from_file" "', argument " "3"" of type '" "int""'"); } - temp2 = (int)(val); - arg2 = &temp2; - res2 = SWIG_AddTmpMask(ecode); + temp3 = (int)(val); + arg3 = &temp3; + res3 = SWIG_AddTmpMask(ecode); } - result = (int)grib_c_new_bufr_from_file(arg1,arg2); + result = (int)grib_c_new_bufr_from_file(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); - if (SWIG_IsTmpObj(res2)) { - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); + if (SWIG_IsTmpObj(res3)) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { - int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); + int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: @@ -4108,14 +4117,18 @@ fail: SWIGINTERN PyObject *_wrap_grib_c_new_gts_from_file(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; FILE *arg1 = (FILE *) 0 ; - int *arg2 = (int *) 0 ; - int temp2 ; - int res2 = 0 ; + int arg2 ; + int *arg3 = (int *) 0 ; + int val2 ; + int ecode2 = 0 ; + int temp3 ; + int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"OO:grib_c_new_gts_from_file",&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOO:grib_c_new_gts_from_file",&obj0,&obj1,&obj2)) SWIG_fail; { if ( PyFile_Check(obj0) ){ arg1 = PyFile_AsFile(obj0); @@ -4124,23 +4137,28 @@ SWIGINTERN PyObject *_wrap_grib_c_new_gts_from_file(PyObject *SWIGUNUSEDPARM(sel return NULL; } } - if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) { + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "grib_c_new_gts_from_file" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) { int val; - int ecode = SWIG_AsVal_int(obj1, &val); + int ecode = SWIG_AsVal_int(obj2, &val); if (!SWIG_IsOK(ecode)) { - SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_gts_from_file" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_gts_from_file" "', argument " "3"" of type '" "int""'"); } - temp2 = (int)(val); - arg2 = &temp2; - res2 = SWIG_AddTmpMask(ecode); + temp3 = (int)(val); + arg3 = &temp3; + res3 = SWIG_AddTmpMask(ecode); } - result = (int)grib_c_new_gts_from_file(arg1,arg2); + result = (int)grib_c_new_gts_from_file(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); - if (SWIG_IsTmpObj(res2)) { - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); + if (SWIG_IsTmpObj(res3)) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { - int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); + int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: @@ -4921,6 +4939,45 @@ fail: } +SWIGINTERN PyObject *_wrap_grib_c_get_message_offset(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int *arg1 = (int *) 0 ; + size_t *arg2 = (size_t *) 0 ; + int temp1 ; + int res1 = 0 ; + size_t temp2 ; + int res2 = SWIG_TMPOBJ ; + PyObject * obj0 = 0 ; + int result; + + arg2 = &temp2; + if (!PyArg_ParseTuple(args,(char *)"O:grib_c_get_message_offset",&obj0)) SWIG_fail; + if (!(SWIG_IsOK((res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1),SWIGTYPE_p_int,0))))) { + int val; + int ecode = SWIG_AsVal_int(obj0, &val); + if (!SWIG_IsOK(ecode)) { + SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_get_message_offset" "', argument " "1"" of type '" "int""'"); + } + temp1 = (int)(val); + arg1 = &temp1; + res1 = SWIG_AddTmpMask(ecode); + } + result = (int)grib_c_get_message_offset(arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + if (SWIG_IsTmpObj(res2)) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_size_t((*arg2))); + } else { + int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_size_t, new_flags)); + } + if (SWIG_IsNewObj(res1)) free((char*)arg1); + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) free((char*)arg1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_grib_c_get_native_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int *arg1 = (int *) 0 ; @@ -7352,6 +7409,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"grib_c_clone", _wrap_grib_c_clone, METH_VARARGS, NULL}, { (char *)"grib_c_copy_namespace", _wrap_grib_c_copy_namespace, METH_VARARGS, NULL}, { (char *)"grib_c_get_message_size", _wrap_grib_c_get_message_size, METH_VARARGS, NULL}, + { (char *)"grib_c_get_message_offset", _wrap_grib_c_get_message_offset, METH_VARARGS, NULL}, { (char *)"grib_c_get_native_type", _wrap_grib_c_get_native_type, METH_VARARGS, NULL}, { (char *)"grib_c_multi_new", _wrap_grib_c_multi_new, METH_VARARGS, NULL}, { (char *)"grib_c_multi_support_on", _wrap_grib_c_multi_support_on, METH_VARARGS, NULL}, diff --git a/python/swig_wrap_array.py b/python/swig_wrap_array.py index 5a69c570f..e3ffc8f60 100644 --- a/python/swig_wrap_array.py +++ b/python/swig_wrap_array.py @@ -12,20 +12,20 @@ if version_info >= (2,6,0): import imp fp = None try: - fp, pathname, description = imp.find_module('_gribapi_swig', [dirname(__file__)]) + fp, pathname, description = imp.find_module('_eccode_swig', [dirname(__file__)]) except ImportError: - import _gribapi_swig - return _gribapi_swig + import _eccode_swig + return _eccode_swig if fp is not None: try: - _mod = imp.load_module('_gribapi_swig', fp, pathname, description) + _mod = imp.load_module('_eccode_swig', fp, pathname, description) finally: fp.close() return _mod - _gribapi_swig = swig_import_helper() + _eccode_swig = swig_import_helper() del swig_import_helper else: - import _gribapi_swig + import _eccode_swig del version_info try: _swig_property = property @@ -68,68 +68,68 @@ except AttributeError: def cdata(*args): - return _gribapi_swig.cdata(*args) -cdata = _gribapi_swig.cdata + return _eccode_swig.cdata(*args) +cdata = _eccode_swig.cdata def memmove(*args): - return _gribapi_swig.memmove(*args) -memmove = _gribapi_swig.memmove -GRIB_SUCCESS = _gribapi_swig.GRIB_SUCCESS -GRIB_END_OF_FILE = _gribapi_swig.GRIB_END_OF_FILE -GRIB_INTERNAL_ERROR = _gribapi_swig.GRIB_INTERNAL_ERROR -GRIB_BUFFER_TOO_SMALL = _gribapi_swig.GRIB_BUFFER_TOO_SMALL -GRIB_NOT_IMPLEMENTED = _gribapi_swig.GRIB_NOT_IMPLEMENTED -GRIB_7777_NOT_FOUND = _gribapi_swig.GRIB_7777_NOT_FOUND -GRIB_ARRAY_TOO_SMALL = _gribapi_swig.GRIB_ARRAY_TOO_SMALL -GRIB_FILE_NOT_FOUND = _gribapi_swig.GRIB_FILE_NOT_FOUND -GRIB_CODE_NOT_FOUND_IN_TABLE = _gribapi_swig.GRIB_CODE_NOT_FOUND_IN_TABLE -GRIB_WRONG_ARRAY_SIZE = _gribapi_swig.GRIB_WRONG_ARRAY_SIZE -GRIB_NOT_FOUND = _gribapi_swig.GRIB_NOT_FOUND -GRIB_IO_PROBLEM = _gribapi_swig.GRIB_IO_PROBLEM -GRIB_INVALID_MESSAGE = _gribapi_swig.GRIB_INVALID_MESSAGE -GRIB_DECODING_ERROR = _gribapi_swig.GRIB_DECODING_ERROR -GRIB_ENCODING_ERROR = _gribapi_swig.GRIB_ENCODING_ERROR -GRIB_NO_MORE_IN_SET = _gribapi_swig.GRIB_NO_MORE_IN_SET -GRIB_GEOCALCULUS_PROBLEM = _gribapi_swig.GRIB_GEOCALCULUS_PROBLEM -GRIB_OUT_OF_MEMORY = _gribapi_swig.GRIB_OUT_OF_MEMORY -GRIB_READ_ONLY = _gribapi_swig.GRIB_READ_ONLY -GRIB_INVALID_ARGUMENT = _gribapi_swig.GRIB_INVALID_ARGUMENT -GRIB_NULL_HANDLE = _gribapi_swig.GRIB_NULL_HANDLE -GRIB_INVALID_SECTION_NUMBER = _gribapi_swig.GRIB_INVALID_SECTION_NUMBER -GRIB_VALUE_CANNOT_BE_MISSING = _gribapi_swig.GRIB_VALUE_CANNOT_BE_MISSING -GRIB_WRONG_LENGTH = _gribapi_swig.GRIB_WRONG_LENGTH -GRIB_INVALID_TYPE = _gribapi_swig.GRIB_INVALID_TYPE -GRIB_WRONG_STEP = _gribapi_swig.GRIB_WRONG_STEP -GRIB_WRONG_STEP_UNIT = _gribapi_swig.GRIB_WRONG_STEP_UNIT -GRIB_INVALID_FILE = _gribapi_swig.GRIB_INVALID_FILE -GRIB_INVALID_GRIB = _gribapi_swig.GRIB_INVALID_GRIB -GRIB_INVALID_INDEX = _gribapi_swig.GRIB_INVALID_INDEX -GRIB_INVALID_ITERATOR = _gribapi_swig.GRIB_INVALID_ITERATOR -GRIB_INVALID_KEYS_ITERATOR = _gribapi_swig.GRIB_INVALID_KEYS_ITERATOR -GRIB_INVALID_NEAREST = _gribapi_swig.GRIB_INVALID_NEAREST -GRIB_INVALID_ORDERBY = _gribapi_swig.GRIB_INVALID_ORDERBY -GRIB_MISSING_KEY = _gribapi_swig.GRIB_MISSING_KEY -GRIB_OUT_OF_AREA = _gribapi_swig.GRIB_OUT_OF_AREA -GRIB_CONCEPT_NO_MATCH = _gribapi_swig.GRIB_CONCEPT_NO_MATCH -GRIB_NO_DEFINITIONS = _gribapi_swig.GRIB_NO_DEFINITIONS -GRIB_WRONG_TYPE = _gribapi_swig.GRIB_WRONG_TYPE -GRIB_END = _gribapi_swig.GRIB_END -GRIB_NO_VALUES = _gribapi_swig.GRIB_NO_VALUES -GRIB_WRONG_GRID = _gribapi_swig.GRIB_WRONG_GRID -GRIB_END_OF_INDEX = _gribapi_swig.GRIB_END_OF_INDEX -GRIB_NULL_INDEX = _gribapi_swig.GRIB_NULL_INDEX -GRIB_PREMATURE_END_OF_FILE = _gribapi_swig.GRIB_PREMATURE_END_OF_FILE -GRIB_INTERNAL_ARRAY_TOO_SMALL = _gribapi_swig.GRIB_INTERNAL_ARRAY_TOO_SMALL -GRIB_MESSAGE_TOO_LARGE = _gribapi_swig.GRIB_MESSAGE_TOO_LARGE -GRIB_CONSTANT_FIELD = _gribapi_swig.GRIB_CONSTANT_FIELD -GRIB_SWITCH_NO_MATCH = _gribapi_swig.GRIB_SWITCH_NO_MATCH -GRIB_UNDERFLOW = _gribapi_swig.GRIB_UNDERFLOW -GRIB_MESSAGE_MALFORMED = _gribapi_swig.GRIB_MESSAGE_MALFORMED -GRIB_CORRUPTED_INDEX = _gribapi_swig.GRIB_CORRUPTED_INDEX -GRIB_INVALID_BPV = _gribapi_swig.GRIB_INVALID_BPV -GRIB_DIFFERENT_EDITION = _gribapi_swig.GRIB_DIFFERENT_EDITION -GRIB_VALUE_DIFFERENT = _gribapi_swig.GRIB_VALUE_DIFFERENT -GRIB_INVALID_KEY_VALUE = _gribapi_swig.GRIB_INVALID_KEY_VALUE + return _eccode_swig.memmove(*args) +memmove = _eccode_swig.memmove +GRIB_SUCCESS = _eccode_swig.GRIB_SUCCESS +GRIB_END_OF_FILE = _eccode_swig.GRIB_END_OF_FILE +GRIB_INTERNAL_ERROR = _eccode_swig.GRIB_INTERNAL_ERROR +GRIB_BUFFER_TOO_SMALL = _eccode_swig.GRIB_BUFFER_TOO_SMALL +GRIB_NOT_IMPLEMENTED = _eccode_swig.GRIB_NOT_IMPLEMENTED +GRIB_7777_NOT_FOUND = _eccode_swig.GRIB_7777_NOT_FOUND +GRIB_ARRAY_TOO_SMALL = _eccode_swig.GRIB_ARRAY_TOO_SMALL +GRIB_FILE_NOT_FOUND = _eccode_swig.GRIB_FILE_NOT_FOUND +GRIB_CODE_NOT_FOUND_IN_TABLE = _eccode_swig.GRIB_CODE_NOT_FOUND_IN_TABLE +GRIB_WRONG_ARRAY_SIZE = _eccode_swig.GRIB_WRONG_ARRAY_SIZE +GRIB_NOT_FOUND = _eccode_swig.GRIB_NOT_FOUND +GRIB_IO_PROBLEM = _eccode_swig.GRIB_IO_PROBLEM +GRIB_INVALID_MESSAGE = _eccode_swig.GRIB_INVALID_MESSAGE +GRIB_DECODING_ERROR = _eccode_swig.GRIB_DECODING_ERROR +GRIB_ENCODING_ERROR = _eccode_swig.GRIB_ENCODING_ERROR +GRIB_NO_MORE_IN_SET = _eccode_swig.GRIB_NO_MORE_IN_SET +GRIB_GEOCALCULUS_PROBLEM = _eccode_swig.GRIB_GEOCALCULUS_PROBLEM +GRIB_OUT_OF_MEMORY = _eccode_swig.GRIB_OUT_OF_MEMORY +GRIB_READ_ONLY = _eccode_swig.GRIB_READ_ONLY +GRIB_INVALID_ARGUMENT = _eccode_swig.GRIB_INVALID_ARGUMENT +GRIB_NULL_HANDLE = _eccode_swig.GRIB_NULL_HANDLE +GRIB_INVALID_SECTION_NUMBER = _eccode_swig.GRIB_INVALID_SECTION_NUMBER +GRIB_VALUE_CANNOT_BE_MISSING = _eccode_swig.GRIB_VALUE_CANNOT_BE_MISSING +GRIB_WRONG_LENGTH = _eccode_swig.GRIB_WRONG_LENGTH +GRIB_INVALID_TYPE = _eccode_swig.GRIB_INVALID_TYPE +GRIB_WRONG_STEP = _eccode_swig.GRIB_WRONG_STEP +GRIB_WRONG_STEP_UNIT = _eccode_swig.GRIB_WRONG_STEP_UNIT +GRIB_INVALID_FILE = _eccode_swig.GRIB_INVALID_FILE +GRIB_INVALID_GRIB = _eccode_swig.GRIB_INVALID_GRIB +GRIB_INVALID_INDEX = _eccode_swig.GRIB_INVALID_INDEX +GRIB_INVALID_ITERATOR = _eccode_swig.GRIB_INVALID_ITERATOR +GRIB_INVALID_KEYS_ITERATOR = _eccode_swig.GRIB_INVALID_KEYS_ITERATOR +GRIB_INVALID_NEAREST = _eccode_swig.GRIB_INVALID_NEAREST +GRIB_INVALID_ORDERBY = _eccode_swig.GRIB_INVALID_ORDERBY +GRIB_MISSING_KEY = _eccode_swig.GRIB_MISSING_KEY +GRIB_OUT_OF_AREA = _eccode_swig.GRIB_OUT_OF_AREA +GRIB_CONCEPT_NO_MATCH = _eccode_swig.GRIB_CONCEPT_NO_MATCH +GRIB_NO_DEFINITIONS = _eccode_swig.GRIB_NO_DEFINITIONS +GRIB_WRONG_TYPE = _eccode_swig.GRIB_WRONG_TYPE +GRIB_END = _eccode_swig.GRIB_END +GRIB_NO_VALUES = _eccode_swig.GRIB_NO_VALUES +GRIB_WRONG_GRID = _eccode_swig.GRIB_WRONG_GRID +GRIB_END_OF_INDEX = _eccode_swig.GRIB_END_OF_INDEX +GRIB_NULL_INDEX = _eccode_swig.GRIB_NULL_INDEX +GRIB_PREMATURE_END_OF_FILE = _eccode_swig.GRIB_PREMATURE_END_OF_FILE +GRIB_INTERNAL_ARRAY_TOO_SMALL = _eccode_swig.GRIB_INTERNAL_ARRAY_TOO_SMALL +GRIB_MESSAGE_TOO_LARGE = _eccode_swig.GRIB_MESSAGE_TOO_LARGE +GRIB_CONSTANT_FIELD = _eccode_swig.GRIB_CONSTANT_FIELD +GRIB_SWITCH_NO_MATCH = _eccode_swig.GRIB_SWITCH_NO_MATCH +GRIB_UNDERFLOW = _eccode_swig.GRIB_UNDERFLOW +GRIB_MESSAGE_MALFORMED = _eccode_swig.GRIB_MESSAGE_MALFORMED +GRIB_CORRUPTED_INDEX = _eccode_swig.GRIB_CORRUPTED_INDEX +GRIB_INVALID_BPV = _eccode_swig.GRIB_INVALID_BPV +GRIB_DIFFERENT_EDITION = _eccode_swig.GRIB_DIFFERENT_EDITION +GRIB_VALUE_DIFFERENT = _eccode_swig.GRIB_VALUE_DIFFERENT +GRIB_INVALID_KEY_VALUE = _eccode_swig.GRIB_INVALID_KEY_VALUE class intp(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, intp, name, value) @@ -137,22 +137,22 @@ class intp(_object): __getattr__ = lambda self, name: _swig_getattr(self, intp, name) __repr__ = _swig_repr def __init__(self): - this = _gribapi_swig.new_intp() + this = _eccode_swig.new_intp() try: self.this.append(this) except: self.this = this - __swig_destroy__ = _gribapi_swig.delete_intp + __swig_destroy__ = _eccode_swig.delete_intp __del__ = lambda self : None; - def assign(self, *args): return _gribapi_swig.intp_assign(self, *args) - def value(self): return _gribapi_swig.intp_value(self) - def cast(self): return _gribapi_swig.intp_cast(self) - __swig_getmethods__["frompointer"] = lambda x: _gribapi_swig.intp_frompointer - if _newclass:frompointer = staticmethod(_gribapi_swig.intp_frompointer) -intp_swigregister = _gribapi_swig.intp_swigregister + def assign(self, *args): return _eccode_swig.intp_assign(self, *args) + def value(self): return _eccode_swig.intp_value(self) + def cast(self): return _eccode_swig.intp_cast(self) + __swig_getmethods__["frompointer"] = lambda x: _eccode_swig.intp_frompointer + if _newclass:frompointer = staticmethod(_eccode_swig.intp_frompointer) +intp_swigregister = _eccode_swig.intp_swigregister intp_swigregister(intp) def intp_frompointer(*args): - return _gribapi_swig.intp_frompointer(*args) -intp_frompointer = _gribapi_swig.intp_frompointer + return _eccode_swig.intp_frompointer(*args) +intp_frompointer = _eccode_swig.intp_frompointer class longp(_object): __swig_setmethods__ = {} @@ -161,22 +161,22 @@ class longp(_object): __getattr__ = lambda self, name: _swig_getattr(self, longp, name) __repr__ = _swig_repr def __init__(self): - this = _gribapi_swig.new_longp() + this = _eccode_swig.new_longp() try: self.this.append(this) except: self.this = this - __swig_destroy__ = _gribapi_swig.delete_longp + __swig_destroy__ = _eccode_swig.delete_longp __del__ = lambda self : None; - def assign(self, *args): return _gribapi_swig.longp_assign(self, *args) - def value(self): return _gribapi_swig.longp_value(self) - def cast(self): return _gribapi_swig.longp_cast(self) - __swig_getmethods__["frompointer"] = lambda x: _gribapi_swig.longp_frompointer - if _newclass:frompointer = staticmethod(_gribapi_swig.longp_frompointer) -longp_swigregister = _gribapi_swig.longp_swigregister + def assign(self, *args): return _eccode_swig.longp_assign(self, *args) + def value(self): return _eccode_swig.longp_value(self) + def cast(self): return _eccode_swig.longp_cast(self) + __swig_getmethods__["frompointer"] = lambda x: _eccode_swig.longp_frompointer + if _newclass:frompointer = staticmethod(_eccode_swig.longp_frompointer) +longp_swigregister = _eccode_swig.longp_swigregister longp_swigregister(longp) def longp_frompointer(*args): - return _gribapi_swig.longp_frompointer(*args) -longp_frompointer = _gribapi_swig.longp_frompointer + return _eccode_swig.longp_frompointer(*args) +longp_frompointer = _eccode_swig.longp_frompointer class doublep(_object): __swig_setmethods__ = {} @@ -185,362 +185,366 @@ class doublep(_object): __getattr__ = lambda self, name: _swig_getattr(self, doublep, name) __repr__ = _swig_repr def __init__(self): - this = _gribapi_swig.new_doublep() + this = _eccode_swig.new_doublep() try: self.this.append(this) except: self.this = this - __swig_destroy__ = _gribapi_swig.delete_doublep + __swig_destroy__ = _eccode_swig.delete_doublep __del__ = lambda self : None; - def assign(self, *args): return _gribapi_swig.doublep_assign(self, *args) - def value(self): return _gribapi_swig.doublep_value(self) - def cast(self): return _gribapi_swig.doublep_cast(self) - __swig_getmethods__["frompointer"] = lambda x: _gribapi_swig.doublep_frompointer - if _newclass:frompointer = staticmethod(_gribapi_swig.doublep_frompointer) -doublep_swigregister = _gribapi_swig.doublep_swigregister + def assign(self, *args): return _eccode_swig.doublep_assign(self, *args) + def value(self): return _eccode_swig.doublep_value(self) + def cast(self): return _eccode_swig.doublep_cast(self) + __swig_getmethods__["frompointer"] = lambda x: _eccode_swig.doublep_frompointer + if _newclass:frompointer = staticmethod(_eccode_swig.doublep_frompointer) +doublep_swigregister = _eccode_swig.doublep_swigregister doublep_swigregister(doublep) def doublep_frompointer(*args): - return _gribapi_swig.doublep_frompointer(*args) -doublep_frompointer = _gribapi_swig.doublep_frompointer + return _eccode_swig.doublep_frompointer(*args) +doublep_frompointer = _eccode_swig.doublep_frompointer def new_doubleArray(*args): - return _gribapi_swig.new_doubleArray(*args) -new_doubleArray = _gribapi_swig.new_doubleArray + return _eccode_swig.new_doubleArray(*args) +new_doubleArray = _eccode_swig.new_doubleArray def delete_doubleArray(*args): - return _gribapi_swig.delete_doubleArray(*args) -delete_doubleArray = _gribapi_swig.delete_doubleArray + return _eccode_swig.delete_doubleArray(*args) +delete_doubleArray = _eccode_swig.delete_doubleArray def doubleArray_getitem(*args): - return _gribapi_swig.doubleArray_getitem(*args) -doubleArray_getitem = _gribapi_swig.doubleArray_getitem + return _eccode_swig.doubleArray_getitem(*args) +doubleArray_getitem = _eccode_swig.doubleArray_getitem def doubleArray_setitem(*args): - return _gribapi_swig.doubleArray_setitem(*args) -doubleArray_setitem = _gribapi_swig.doubleArray_setitem + return _eccode_swig.doubleArray_setitem(*args) +doubleArray_setitem = _eccode_swig.doubleArray_setitem def new_longArray(*args): - return _gribapi_swig.new_longArray(*args) -new_longArray = _gribapi_swig.new_longArray + return _eccode_swig.new_longArray(*args) +new_longArray = _eccode_swig.new_longArray def delete_longArray(*args): - return _gribapi_swig.delete_longArray(*args) -delete_longArray = _gribapi_swig.delete_longArray + return _eccode_swig.delete_longArray(*args) +delete_longArray = _eccode_swig.delete_longArray def longArray_getitem(*args): - return _gribapi_swig.longArray_getitem(*args) -longArray_getitem = _gribapi_swig.longArray_getitem + return _eccode_swig.longArray_getitem(*args) +longArray_getitem = _eccode_swig.longArray_getitem def longArray_setitem(*args): - return _gribapi_swig.longArray_setitem(*args) -longArray_setitem = _gribapi_swig.longArray_setitem + return _eccode_swig.longArray_setitem(*args) +longArray_setitem = _eccode_swig.longArray_setitem def new_intArray(*args): - return _gribapi_swig.new_intArray(*args) -new_intArray = _gribapi_swig.new_intArray + return _eccode_swig.new_intArray(*args) +new_intArray = _eccode_swig.new_intArray def delete_intArray(*args): - return _gribapi_swig.delete_intArray(*args) -delete_intArray = _gribapi_swig.delete_intArray + return _eccode_swig.delete_intArray(*args) +delete_intArray = _eccode_swig.delete_intArray def intArray_getitem(*args): - return _gribapi_swig.intArray_getitem(*args) -intArray_getitem = _gribapi_swig.intArray_getitem + return _eccode_swig.intArray_getitem(*args) +intArray_getitem = _eccode_swig.intArray_getitem def intArray_setitem(*args): - return _gribapi_swig.intArray_setitem(*args) -intArray_setitem = _gribapi_swig.intArray_setitem + return _eccode_swig.intArray_setitem(*args) +intArray_setitem = _eccode_swig.intArray_setitem def grib_c_new_from_file(*args): - return _gribapi_swig.grib_c_new_from_file(*args) -grib_c_new_from_file = _gribapi_swig.grib_c_new_from_file + return _eccode_swig.grib_c_new_from_file(*args) +grib_c_new_from_file = _eccode_swig.grib_c_new_from_file def grib_c_new_bufr_from_file(*args): - return _gribapi_swig.grib_c_new_bufr_from_file(*args) -grib_c_new_bufr_from_file = _gribapi_swig.grib_c_new_bufr_from_file + return _eccode_swig.grib_c_new_bufr_from_file(*args) +grib_c_new_bufr_from_file = _eccode_swig.grib_c_new_bufr_from_file def grib_c_new_gts_from_file(*args): - return _gribapi_swig.grib_c_new_gts_from_file(*args) -grib_c_new_gts_from_file = _gribapi_swig.grib_c_new_gts_from_file + return _eccode_swig.grib_c_new_gts_from_file(*args) +grib_c_new_gts_from_file = _eccode_swig.grib_c_new_gts_from_file def grib_c_iterator_new(*args): - return _gribapi_swig.grib_c_iterator_new(*args) -grib_c_iterator_new = _gribapi_swig.grib_c_iterator_new + return _eccode_swig.grib_c_iterator_new(*args) +grib_c_iterator_new = _eccode_swig.grib_c_iterator_new def grib_c_keys_iterator_new(*args): - return _gribapi_swig.grib_c_keys_iterator_new(*args) -grib_c_keys_iterator_new = _gribapi_swig.grib_c_keys_iterator_new + return _eccode_swig.grib_c_keys_iterator_new(*args) +grib_c_keys_iterator_new = _eccode_swig.grib_c_keys_iterator_new def grib_c_new_from_samples(*args): - return _gribapi_swig.grib_c_new_from_samples(*args) -grib_c_new_from_samples = _gribapi_swig.grib_c_new_from_samples + return _eccode_swig.grib_c_new_from_samples(*args) +grib_c_new_from_samples = _eccode_swig.grib_c_new_from_samples def grib_c_index_new_from_file(*args): - return _gribapi_swig.grib_c_index_new_from_file(*args) -grib_c_index_new_from_file = _gribapi_swig.grib_c_index_new_from_file + return _eccode_swig.grib_c_index_new_from_file(*args) +grib_c_index_new_from_file = _eccode_swig.grib_c_index_new_from_file def grib_c_index_add_file(*args): - return _gribapi_swig.grib_c_index_add_file(*args) -grib_c_index_add_file = _gribapi_swig.grib_c_index_add_file + return _eccode_swig.grib_c_index_add_file(*args) +grib_c_index_add_file = _eccode_swig.grib_c_index_add_file def grib_c_new_from_index(*args): - return _gribapi_swig.grib_c_new_from_index(*args) -grib_c_new_from_index = _gribapi_swig.grib_c_new_from_index + return _eccode_swig.grib_c_new_from_index(*args) +grib_c_new_from_index = _eccode_swig.grib_c_new_from_index def grib_c_index_write(*args): - return _gribapi_swig.grib_c_index_write(*args) -grib_c_index_write = _gribapi_swig.grib_c_index_write + return _eccode_swig.grib_c_index_write(*args) +grib_c_index_write = _eccode_swig.grib_c_index_write def grib_c_index_read(*args): - return _gribapi_swig.grib_c_index_read(*args) -grib_c_index_read = _gribapi_swig.grib_c_index_read + return _eccode_swig.grib_c_index_read(*args) +grib_c_index_read = _eccode_swig.grib_c_index_read def grib_c_new_from_message(*args): - return _gribapi_swig.grib_c_new_from_message(*args) -grib_c_new_from_message = _gribapi_swig.grib_c_new_from_message + return _eccode_swig.grib_c_new_from_message(*args) +grib_c_new_from_message = _eccode_swig.grib_c_new_from_message def grib_c_count_in_file(*args): - return _gribapi_swig.grib_c_count_in_file(*args) -grib_c_count_in_file = _gribapi_swig.grib_c_count_in_file + return _eccode_swig.grib_c_count_in_file(*args) +grib_c_count_in_file = _eccode_swig.grib_c_count_in_file def grib_c_release(*args): - return _gribapi_swig.grib_c_release(*args) -grib_c_release = _gribapi_swig.grib_c_release + return _eccode_swig.grib_c_release(*args) +grib_c_release = _eccode_swig.grib_c_release def grib_c_write(*args): - return _gribapi_swig.grib_c_write(*args) -grib_c_write = _gribapi_swig.grib_c_write + return _eccode_swig.grib_c_write(*args) +grib_c_write = _eccode_swig.grib_c_write def grib_c_get_size_long(*args): - return _gribapi_swig.grib_c_get_size_long(*args) -grib_c_get_size_long = _gribapi_swig.grib_c_get_size_long + return _eccode_swig.grib_c_get_size_long(*args) +grib_c_get_size_long = _eccode_swig.grib_c_get_size_long def grib_c_get_string_length(*args): - return _gribapi_swig.grib_c_get_string_length(*args) -grib_c_get_string_length = _gribapi_swig.grib_c_get_string_length + return _eccode_swig.grib_c_get_string_length(*args) +grib_c_get_string_length = _eccode_swig.grib_c_get_string_length def grib_c_clone(*args): - return _gribapi_swig.grib_c_clone(*args) -grib_c_clone = _gribapi_swig.grib_c_clone + return _eccode_swig.grib_c_clone(*args) +grib_c_clone = _eccode_swig.grib_c_clone def grib_c_copy_namespace(*args): - return _gribapi_swig.grib_c_copy_namespace(*args) -grib_c_copy_namespace = _gribapi_swig.grib_c_copy_namespace + return _eccode_swig.grib_c_copy_namespace(*args) +grib_c_copy_namespace = _eccode_swig.grib_c_copy_namespace def grib_c_get_message_size(*args): - return _gribapi_swig.grib_c_get_message_size(*args) -grib_c_get_message_size = _gribapi_swig.grib_c_get_message_size + return _eccode_swig.grib_c_get_message_size(*args) +grib_c_get_message_size = _eccode_swig.grib_c_get_message_size + +def grib_c_get_message_offset(*args): + return _eccode_swig.grib_c_get_message_offset(*args) +grib_c_get_message_offset = _eccode_swig.grib_c_get_message_offset def grib_c_get_native_type(*args): - return _gribapi_swig.grib_c_get_native_type(*args) -grib_c_get_native_type = _gribapi_swig.grib_c_get_native_type + return _eccode_swig.grib_c_get_native_type(*args) +grib_c_get_native_type = _eccode_swig.grib_c_get_native_type def grib_c_multi_new(): - return _gribapi_swig.grib_c_multi_new() -grib_c_multi_new = _gribapi_swig.grib_c_multi_new + return _eccode_swig.grib_c_multi_new() +grib_c_multi_new = _eccode_swig.grib_c_multi_new def grib_c_multi_support_on(): - return _gribapi_swig.grib_c_multi_support_on() -grib_c_multi_support_on = _gribapi_swig.grib_c_multi_support_on + return _eccode_swig.grib_c_multi_support_on() +grib_c_multi_support_on = _eccode_swig.grib_c_multi_support_on def grib_c_multi_write(*args): - return _gribapi_swig.grib_c_multi_write(*args) -grib_c_multi_write = _gribapi_swig.grib_c_multi_write + return _eccode_swig.grib_c_multi_write(*args) +grib_c_multi_write = _eccode_swig.grib_c_multi_write def grib_c_multi_support_off(): - return _gribapi_swig.grib_c_multi_support_off() -grib_c_multi_support_off = _gribapi_swig.grib_c_multi_support_off + return _eccode_swig.grib_c_multi_support_off() +grib_c_multi_support_off = _eccode_swig.grib_c_multi_support_off def grib_c_multi_release(*args): - return _gribapi_swig.grib_c_multi_release(*args) -grib_c_multi_release = _gribapi_swig.grib_c_multi_release + return _eccode_swig.grib_c_multi_release(*args) +grib_c_multi_release = _eccode_swig.grib_c_multi_release def grib_c_multi_append(*args): - return _gribapi_swig.grib_c_multi_append(*args) -grib_c_multi_append = _gribapi_swig.grib_c_multi_append + return _eccode_swig.grib_c_multi_append(*args) +grib_c_multi_append = _eccode_swig.grib_c_multi_append def grib_c_gribex_mode_on(): - return _gribapi_swig.grib_c_gribex_mode_on() -grib_c_gribex_mode_on = _gribapi_swig.grib_c_gribex_mode_on + return _eccode_swig.grib_c_gribex_mode_on() +grib_c_gribex_mode_on = _eccode_swig.grib_c_gribex_mode_on def grib_c_gribex_mode_off(): - return _gribapi_swig.grib_c_gribex_mode_off() -grib_c_gribex_mode_off = _gribapi_swig.grib_c_gribex_mode_off + return _eccode_swig.grib_c_gribex_mode_off() +grib_c_gribex_mode_off = _eccode_swig.grib_c_gribex_mode_off def grib_c_keys_iterator_next(*args): - return _gribapi_swig.grib_c_keys_iterator_next(*args) -grib_c_keys_iterator_next = _gribapi_swig.grib_c_keys_iterator_next + return _eccode_swig.grib_c_keys_iterator_next(*args) +grib_c_keys_iterator_next = _eccode_swig.grib_c_keys_iterator_next def grib_c_keys_iterator_delete(*args): - return _gribapi_swig.grib_c_keys_iterator_delete(*args) -grib_c_keys_iterator_delete = _gribapi_swig.grib_c_keys_iterator_delete + return _eccode_swig.grib_c_keys_iterator_delete(*args) +grib_c_keys_iterator_delete = _eccode_swig.grib_c_keys_iterator_delete def grib_c_skip_computed(*args): - return _gribapi_swig.grib_c_skip_computed(*args) -grib_c_skip_computed = _gribapi_swig.grib_c_skip_computed + return _eccode_swig.grib_c_skip_computed(*args) +grib_c_skip_computed = _eccode_swig.grib_c_skip_computed def grib_c_skip_coded(*args): - return _gribapi_swig.grib_c_skip_coded(*args) -grib_c_skip_coded = _gribapi_swig.grib_c_skip_coded + return _eccode_swig.grib_c_skip_coded(*args) +grib_c_skip_coded = _eccode_swig.grib_c_skip_coded def grib_c_skip_edition_specific(*args): - return _gribapi_swig.grib_c_skip_edition_specific(*args) -grib_c_skip_edition_specific = _gribapi_swig.grib_c_skip_edition_specific + return _eccode_swig.grib_c_skip_edition_specific(*args) +grib_c_skip_edition_specific = _eccode_swig.grib_c_skip_edition_specific def grib_c_skip_duplicates(*args): - return _gribapi_swig.grib_c_skip_duplicates(*args) -grib_c_skip_duplicates = _gribapi_swig.grib_c_skip_duplicates + return _eccode_swig.grib_c_skip_duplicates(*args) +grib_c_skip_duplicates = _eccode_swig.grib_c_skip_duplicates def grib_c_skip_read_only(*args): - return _gribapi_swig.grib_c_skip_read_only(*args) -grib_c_skip_read_only = _gribapi_swig.grib_c_skip_read_only + return _eccode_swig.grib_c_skip_read_only(*args) +grib_c_skip_read_only = _eccode_swig.grib_c_skip_read_only def grib_c_skip_function(*args): - return _gribapi_swig.grib_c_skip_function(*args) -grib_c_skip_function = _gribapi_swig.grib_c_skip_function + return _eccode_swig.grib_c_skip_function(*args) +grib_c_skip_function = _eccode_swig.grib_c_skip_function def grib_c_keys_iterator_rewind(*args): - return _gribapi_swig.grib_c_keys_iterator_rewind(*args) -grib_c_keys_iterator_rewind = _gribapi_swig.grib_c_keys_iterator_rewind + return _eccode_swig.grib_c_keys_iterator_rewind(*args) +grib_c_keys_iterator_rewind = _eccode_swig.grib_c_keys_iterator_rewind def grib_c_keys_iterator_get_name(*args): - return _gribapi_swig.grib_c_keys_iterator_get_name(*args) -grib_c_keys_iterator_get_name = _gribapi_swig.grib_c_keys_iterator_get_name + return _eccode_swig.grib_c_keys_iterator_get_name(*args) +grib_c_keys_iterator_get_name = _eccode_swig.grib_c_keys_iterator_get_name def grib_c_index_get_size_long(*args): - return _gribapi_swig.grib_c_index_get_size_long(*args) -grib_c_index_get_size_long = _gribapi_swig.grib_c_index_get_size_long + return _eccode_swig.grib_c_index_get_size_long(*args) +grib_c_index_get_size_long = _eccode_swig.grib_c_index_get_size_long def grib_c_index_get_long(*args): - return _gribapi_swig.grib_c_index_get_long(*args) -grib_c_index_get_long = _gribapi_swig.grib_c_index_get_long + return _eccode_swig.grib_c_index_get_long(*args) +grib_c_index_get_long = _eccode_swig.grib_c_index_get_long def grib_c_index_get_real8(*args): - return _gribapi_swig.grib_c_index_get_real8(*args) -grib_c_index_get_real8 = _gribapi_swig.grib_c_index_get_real8 + return _eccode_swig.grib_c_index_get_real8(*args) +grib_c_index_get_real8 = _eccode_swig.grib_c_index_get_real8 def grib_c_index_get_string(*args): - return _gribapi_swig.grib_c_index_get_string(*args) -grib_c_index_get_string = _gribapi_swig.grib_c_index_get_string + return _eccode_swig.grib_c_index_get_string(*args) +grib_c_index_get_string = _eccode_swig.grib_c_index_get_string def grib_c_index_select_long(*args): - return _gribapi_swig.grib_c_index_select_long(*args) -grib_c_index_select_long = _gribapi_swig.grib_c_index_select_long + return _eccode_swig.grib_c_index_select_long(*args) +grib_c_index_select_long = _eccode_swig.grib_c_index_select_long def grib_c_index_select_real8(*args): - return _gribapi_swig.grib_c_index_select_real8(*args) -grib_c_index_select_real8 = _gribapi_swig.grib_c_index_select_real8 + return _eccode_swig.grib_c_index_select_real8(*args) +grib_c_index_select_real8 = _eccode_swig.grib_c_index_select_real8 def grib_c_index_select_string(*args): - return _gribapi_swig.grib_c_index_select_string(*args) -grib_c_index_select_string = _gribapi_swig.grib_c_index_select_string + return _eccode_swig.grib_c_index_select_string(*args) +grib_c_index_select_string = _eccode_swig.grib_c_index_select_string def grib_c_index_release(*args): - return _gribapi_swig.grib_c_index_release(*args) -grib_c_index_release = _gribapi_swig.grib_c_index_release + return _eccode_swig.grib_c_index_release(*args) +grib_c_index_release = _eccode_swig.grib_c_index_release def grib_c_iterator_delete(*args): - return _gribapi_swig.grib_c_iterator_delete(*args) -grib_c_iterator_delete = _gribapi_swig.grib_c_iterator_delete + return _eccode_swig.grib_c_iterator_delete(*args) +grib_c_iterator_delete = _eccode_swig.grib_c_iterator_delete def grib_c_iterator_next(*args): - return _gribapi_swig.grib_c_iterator_next(*args) -grib_c_iterator_next = _gribapi_swig.grib_c_iterator_next + return _eccode_swig.grib_c_iterator_next(*args) +grib_c_iterator_next = _eccode_swig.grib_c_iterator_next def grib_c_get_string(*args): - return _gribapi_swig.grib_c_get_string(*args) -grib_c_get_string = _gribapi_swig.grib_c_get_string + return _eccode_swig.grib_c_get_string(*args) +grib_c_get_string = _eccode_swig.grib_c_get_string def grib_c_set_string(*args): - return _gribapi_swig.grib_c_set_string(*args) -grib_c_set_string = _gribapi_swig.grib_c_set_string + return _eccode_swig.grib_c_set_string(*args) +grib_c_set_string = _eccode_swig.grib_c_set_string def grib_c_get_long(*args): - return _gribapi_swig.grib_c_get_long(*args) -grib_c_get_long = _gribapi_swig.grib_c_get_long + return _eccode_swig.grib_c_get_long(*args) +grib_c_get_long = _eccode_swig.grib_c_get_long def grib_c_set_long(*args): - return _gribapi_swig.grib_c_set_long(*args) -grib_c_set_long = _gribapi_swig.grib_c_set_long + return _eccode_swig.grib_c_set_long(*args) +grib_c_set_long = _eccode_swig.grib_c_set_long def grib_c_get_double(*args): - return _gribapi_swig.grib_c_get_double(*args) -grib_c_get_double = _gribapi_swig.grib_c_get_double + return _eccode_swig.grib_c_get_double(*args) +grib_c_get_double = _eccode_swig.grib_c_get_double def grib_c_set_double(*args): - return _gribapi_swig.grib_c_set_double(*args) -grib_c_set_double = _gribapi_swig.grib_c_set_double + return _eccode_swig.grib_c_set_double(*args) +grib_c_set_double = _eccode_swig.grib_c_set_double def grib_c_set_real8_array(*args): - return _gribapi_swig.grib_c_set_real8_array(*args) -grib_c_set_real8_array = _gribapi_swig.grib_c_set_real8_array + return _eccode_swig.grib_c_set_real8_array(*args) +grib_c_set_real8_array = _eccode_swig.grib_c_set_real8_array def grib_c_get_real8_array(*args): - return _gribapi_swig.grib_c_get_real8_array(*args) -grib_c_get_real8_array = _gribapi_swig.grib_c_get_real8_array + return _eccode_swig.grib_c_get_real8_array(*args) +grib_c_get_real8_array = _eccode_swig.grib_c_get_real8_array def grib_c_get_long_array(*args): - return _gribapi_swig.grib_c_get_long_array(*args) -grib_c_get_long_array = _gribapi_swig.grib_c_get_long_array + return _eccode_swig.grib_c_get_long_array(*args) +grib_c_get_long_array = _eccode_swig.grib_c_get_long_array def grib_c_set_long_array(*args): - return _gribapi_swig.grib_c_set_long_array(*args) -grib_c_set_long_array = _gribapi_swig.grib_c_set_long_array + return _eccode_swig.grib_c_set_long_array(*args) +grib_c_set_long_array = _eccode_swig.grib_c_set_long_array def grib_c_get_real8_element(*args): - return _gribapi_swig.grib_c_get_real8_element(*args) -grib_c_get_real8_element = _gribapi_swig.grib_c_get_real8_element + return _eccode_swig.grib_c_get_real8_element(*args) +grib_c_get_real8_element = _eccode_swig.grib_c_get_real8_element def grib_c_get_real8_elements(*args): - return _gribapi_swig.grib_c_get_real8_elements(*args) -grib_c_get_real8_elements = _gribapi_swig.grib_c_get_real8_elements + return _eccode_swig.grib_c_get_real8_elements(*args) +grib_c_get_real8_elements = _eccode_swig.grib_c_get_real8_elements def grib_c_set_missing(*args): - return _gribapi_swig.grib_c_set_missing(*args) -grib_c_set_missing = _gribapi_swig.grib_c_set_missing + return _eccode_swig.grib_c_set_missing(*args) +grib_c_set_missing = _eccode_swig.grib_c_set_missing def grib_c_set_key_vals(*args): - return _gribapi_swig.grib_c_set_key_vals(*args) -grib_c_set_key_vals = _gribapi_swig.grib_c_set_key_vals + return _eccode_swig.grib_c_set_key_vals(*args) +grib_c_set_key_vals = _eccode_swig.grib_c_set_key_vals def grib_c_is_missing(*args): - return _gribapi_swig.grib_c_is_missing(*args) -grib_c_is_missing = _gribapi_swig.grib_c_is_missing + return _eccode_swig.grib_c_is_missing(*args) +grib_c_is_missing = _eccode_swig.grib_c_is_missing def grib_c_is_defined(*args): - return _gribapi_swig.grib_c_is_defined(*args) -grib_c_is_defined = _gribapi_swig.grib_c_is_defined + return _eccode_swig.grib_c_is_defined(*args) +grib_c_is_defined = _eccode_swig.grib_c_is_defined def grib_c_find_nearest_single(*args): - return _gribapi_swig.grib_c_find_nearest_single(*args) -grib_c_find_nearest_single = _gribapi_swig.grib_c_find_nearest_single + return _eccode_swig.grib_c_find_nearest_single(*args) +grib_c_find_nearest_single = _eccode_swig.grib_c_find_nearest_single def grib_c_find_nearest_four_single(*args): - return _gribapi_swig.grib_c_find_nearest_four_single(*args) -grib_c_find_nearest_four_single = _gribapi_swig.grib_c_find_nearest_four_single + return _eccode_swig.grib_c_find_nearest_four_single(*args) +grib_c_find_nearest_four_single = _eccode_swig.grib_c_find_nearest_four_single def grib_c_get_message(*args): - return _gribapi_swig.grib_c_get_message(*args) -grib_c_get_message = _gribapi_swig.grib_c_get_message + return _eccode_swig.grib_c_get_message(*args) +grib_c_get_message = _eccode_swig.grib_c_get_message def grib_c_get_error_string(*args): - return _gribapi_swig.grib_c_get_error_string(*args) -grib_c_get_error_string = _gribapi_swig.grib_c_get_error_string + return _eccode_swig.grib_c_get_error_string(*args) +grib_c_get_error_string = _eccode_swig.grib_c_get_error_string def no_fail_on_wrong_length(*args): - return _gribapi_swig.no_fail_on_wrong_length(*args) -no_fail_on_wrong_length = _gribapi_swig.no_fail_on_wrong_length + return _eccode_swig.no_fail_on_wrong_length(*args) +no_fail_on_wrong_length = _eccode_swig.no_fail_on_wrong_length def grib_c_get_api_version(): - return _gribapi_swig.grib_c_get_api_version() -grib_c_get_api_version = _gribapi_swig.grib_c_get_api_version + return _eccode_swig.grib_c_get_api_version() +grib_c_get_api_version = _eccode_swig.grib_c_get_api_version def grib_c_gts_header_on(): - return _gribapi_swig.grib_c_gts_header_on() -grib_c_gts_header_on = _gribapi_swig.grib_c_gts_header_on + return _eccode_swig.grib_c_gts_header_on() +grib_c_gts_header_on = _eccode_swig.grib_c_gts_header_on def grib_c_gts_header_off(): - return _gribapi_swig.grib_c_gts_header_off() -grib_c_gts_header_off = _gribapi_swig.grib_c_gts_header_off + return _eccode_swig.grib_c_gts_header_off() +grib_c_gts_header_off = _eccode_swig.grib_c_gts_header_off diff --git a/python/swig_wrap_numpy.c b/python/swig_wrap_numpy.c index 0d2ce0f4c..edeb34d52 100644 --- a/python/swig_wrap_numpy.c +++ b/python/swig_wrap_numpy.c @@ -2682,16 +2682,16 @@ static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0}; #endif /*----------------------------------------------- - @(target):= _gribapi_swig.so + @(target):= _eccode_swig.so ------------------------------------------------*/ #if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__gribapi_swig +# define SWIG_init PyInit__eccode_swig #else -# define SWIG_init init_gribapi_swig +# define SWIG_init init_eccode_swig #endif -#define SWIG_name "_gribapi_swig" +#define SWIG_name "_eccode_swig" #define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION @@ -4519,14 +4519,18 @@ fail: SWIGINTERN PyObject *_wrap_grib_c_new_bufr_from_file(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; FILE *arg1 = (FILE *) 0 ; - int *arg2 = (int *) 0 ; - int temp2 ; - int res2 = 0 ; + int arg2 ; + int *arg3 = (int *) 0 ; + int val2 ; + int ecode2 = 0 ; + int temp3 ; + int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"OO:grib_c_new_bufr_from_file",&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOO:grib_c_new_bufr_from_file",&obj0,&obj1,&obj2)) SWIG_fail; { if ( PyFile_Check(obj0) ){ arg1 = PyFile_AsFile(obj0); @@ -4535,23 +4539,28 @@ SWIGINTERN PyObject *_wrap_grib_c_new_bufr_from_file(PyObject *SWIGUNUSEDPARM(se return NULL; } } - if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) { + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "grib_c_new_bufr_from_file" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) { int val; - int ecode = SWIG_AsVal_int(obj1, &val); + int ecode = SWIG_AsVal_int(obj2, &val); if (!SWIG_IsOK(ecode)) { - SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_bufr_from_file" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_bufr_from_file" "', argument " "3"" of type '" "int""'"); } - temp2 = (int)(val); - arg2 = &temp2; - res2 = SWIG_AddTmpMask(ecode); + temp3 = (int)(val); + arg3 = &temp3; + res3 = SWIG_AddTmpMask(ecode); } - result = (int)grib_c_new_bufr_from_file(arg1,arg2); + result = (int)grib_c_new_bufr_from_file(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); - if (SWIG_IsTmpObj(res2)) { - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); + if (SWIG_IsTmpObj(res3)) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { - int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); + int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: @@ -4562,14 +4571,18 @@ fail: SWIGINTERN PyObject *_wrap_grib_c_new_gts_from_file(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; FILE *arg1 = (FILE *) 0 ; - int *arg2 = (int *) 0 ; - int temp2 ; - int res2 = 0 ; + int arg2 ; + int *arg3 = (int *) 0 ; + int val2 ; + int ecode2 = 0 ; + int temp3 ; + int res3 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"OO:grib_c_new_gts_from_file",&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOO:grib_c_new_gts_from_file",&obj0,&obj1,&obj2)) SWIG_fail; { if ( PyFile_Check(obj0) ){ arg1 = PyFile_AsFile(obj0); @@ -4578,23 +4591,28 @@ SWIGINTERN PyObject *_wrap_grib_c_new_gts_from_file(PyObject *SWIGUNUSEDPARM(sel return NULL; } } - if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) { + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "grib_c_new_gts_from_file" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) { int val; - int ecode = SWIG_AsVal_int(obj1, &val); + int ecode = SWIG_AsVal_int(obj2, &val); if (!SWIG_IsOK(ecode)) { - SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_gts_from_file" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_new_gts_from_file" "', argument " "3"" of type '" "int""'"); } - temp2 = (int)(val); - arg2 = &temp2; - res2 = SWIG_AddTmpMask(ecode); + temp3 = (int)(val); + arg3 = &temp3; + res3 = SWIG_AddTmpMask(ecode); } - result = (int)grib_c_new_gts_from_file(arg1,arg2); + result = (int)grib_c_new_gts_from_file(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); - if (SWIG_IsTmpObj(res2)) { - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2))); + if (SWIG_IsTmpObj(res3)) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3))); } else { - int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; - resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags)); + int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ; + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags)); } return resultobj; fail: @@ -5375,6 +5393,45 @@ fail: } +SWIGINTERN PyObject *_wrap_grib_c_get_message_offset(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int *arg1 = (int *) 0 ; + size_t *arg2 = (size_t *) 0 ; + int temp1 ; + int res1 = 0 ; + size_t temp2 ; + int res2 = SWIG_TMPOBJ ; + PyObject * obj0 = 0 ; + int result; + + arg2 = &temp2; + if (!PyArg_ParseTuple(args,(char *)"O:grib_c_get_message_offset",&obj0)) SWIG_fail; + if (!(SWIG_IsOK((res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1),SWIGTYPE_p_int,0))))) { + int val; + int ecode = SWIG_AsVal_int(obj0, &val); + if (!SWIG_IsOK(ecode)) { + SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "grib_c_get_message_offset" "', argument " "1"" of type '" "int""'"); + } + temp1 = (int)(val); + arg1 = &temp1; + res1 = SWIG_AddTmpMask(ecode); + } + result = (int)grib_c_get_message_offset(arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + if (SWIG_IsTmpObj(res2)) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_size_t((*arg2))); + } else { + int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ; + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_size_t, new_flags)); + } + if (SWIG_IsNewObj(res1)) free((char*)arg1); + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) free((char*)arg1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_grib_c_get_native_type(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int *arg1 = (int *) 0 ; @@ -8176,6 +8233,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"grib_c_clone", _wrap_grib_c_clone, METH_VARARGS, NULL}, { (char *)"grib_c_copy_namespace", _wrap_grib_c_copy_namespace, METH_VARARGS, NULL}, { (char *)"grib_c_get_message_size", _wrap_grib_c_get_message_size, METH_VARARGS, NULL}, + { (char *)"grib_c_get_message_offset", _wrap_grib_c_get_message_offset, METH_VARARGS, NULL}, { (char *)"grib_c_get_native_type", _wrap_grib_c_get_native_type, METH_VARARGS, NULL}, { (char *)"grib_c_multi_new", _wrap_grib_c_multi_new, METH_VARARGS, NULL}, { (char *)"grib_c_multi_support_on", _wrap_grib_c_multi_support_on, METH_VARARGS, NULL}, diff --git a/python/swig_wrap_numpy.py b/python/swig_wrap_numpy.py index 02511d93d..e2c7ec3a8 100644 --- a/python/swig_wrap_numpy.py +++ b/python/swig_wrap_numpy.py @@ -12,20 +12,20 @@ if version_info >= (2,6,0): import imp fp = None try: - fp, pathname, description = imp.find_module('_gribapi_swig', [dirname(__file__)]) + fp, pathname, description = imp.find_module('_eccode_swig', [dirname(__file__)]) except ImportError: - import _gribapi_swig - return _gribapi_swig + import _eccode_swig + return _eccode_swig if fp is not None: try: - _mod = imp.load_module('_gribapi_swig', fp, pathname, description) + _mod = imp.load_module('_eccode_swig', fp, pathname, description) finally: fp.close() return _mod - _gribapi_swig = swig_import_helper() + _eccode_swig = swig_import_helper() del swig_import_helper else: - import _gribapi_swig + import _eccode_swig del version_info try: _swig_property = property @@ -68,68 +68,68 @@ except AttributeError: def cdata(*args): - return _gribapi_swig.cdata(*args) -cdata = _gribapi_swig.cdata + return _eccode_swig.cdata(*args) +cdata = _eccode_swig.cdata def memmove(*args): - return _gribapi_swig.memmove(*args) -memmove = _gribapi_swig.memmove -GRIB_SUCCESS = _gribapi_swig.GRIB_SUCCESS -GRIB_END_OF_FILE = _gribapi_swig.GRIB_END_OF_FILE -GRIB_INTERNAL_ERROR = _gribapi_swig.GRIB_INTERNAL_ERROR -GRIB_BUFFER_TOO_SMALL = _gribapi_swig.GRIB_BUFFER_TOO_SMALL -GRIB_NOT_IMPLEMENTED = _gribapi_swig.GRIB_NOT_IMPLEMENTED -GRIB_7777_NOT_FOUND = _gribapi_swig.GRIB_7777_NOT_FOUND -GRIB_ARRAY_TOO_SMALL = _gribapi_swig.GRIB_ARRAY_TOO_SMALL -GRIB_FILE_NOT_FOUND = _gribapi_swig.GRIB_FILE_NOT_FOUND -GRIB_CODE_NOT_FOUND_IN_TABLE = _gribapi_swig.GRIB_CODE_NOT_FOUND_IN_TABLE -GRIB_WRONG_ARRAY_SIZE = _gribapi_swig.GRIB_WRONG_ARRAY_SIZE -GRIB_NOT_FOUND = _gribapi_swig.GRIB_NOT_FOUND -GRIB_IO_PROBLEM = _gribapi_swig.GRIB_IO_PROBLEM -GRIB_INVALID_MESSAGE = _gribapi_swig.GRIB_INVALID_MESSAGE -GRIB_DECODING_ERROR = _gribapi_swig.GRIB_DECODING_ERROR -GRIB_ENCODING_ERROR = _gribapi_swig.GRIB_ENCODING_ERROR -GRIB_NO_MORE_IN_SET = _gribapi_swig.GRIB_NO_MORE_IN_SET -GRIB_GEOCALCULUS_PROBLEM = _gribapi_swig.GRIB_GEOCALCULUS_PROBLEM -GRIB_OUT_OF_MEMORY = _gribapi_swig.GRIB_OUT_OF_MEMORY -GRIB_READ_ONLY = _gribapi_swig.GRIB_READ_ONLY -GRIB_INVALID_ARGUMENT = _gribapi_swig.GRIB_INVALID_ARGUMENT -GRIB_NULL_HANDLE = _gribapi_swig.GRIB_NULL_HANDLE -GRIB_INVALID_SECTION_NUMBER = _gribapi_swig.GRIB_INVALID_SECTION_NUMBER -GRIB_VALUE_CANNOT_BE_MISSING = _gribapi_swig.GRIB_VALUE_CANNOT_BE_MISSING -GRIB_WRONG_LENGTH = _gribapi_swig.GRIB_WRONG_LENGTH -GRIB_INVALID_TYPE = _gribapi_swig.GRIB_INVALID_TYPE -GRIB_WRONG_STEP = _gribapi_swig.GRIB_WRONG_STEP -GRIB_WRONG_STEP_UNIT = _gribapi_swig.GRIB_WRONG_STEP_UNIT -GRIB_INVALID_FILE = _gribapi_swig.GRIB_INVALID_FILE -GRIB_INVALID_GRIB = _gribapi_swig.GRIB_INVALID_GRIB -GRIB_INVALID_INDEX = _gribapi_swig.GRIB_INVALID_INDEX -GRIB_INVALID_ITERATOR = _gribapi_swig.GRIB_INVALID_ITERATOR -GRIB_INVALID_KEYS_ITERATOR = _gribapi_swig.GRIB_INVALID_KEYS_ITERATOR -GRIB_INVALID_NEAREST = _gribapi_swig.GRIB_INVALID_NEAREST -GRIB_INVALID_ORDERBY = _gribapi_swig.GRIB_INVALID_ORDERBY -GRIB_MISSING_KEY = _gribapi_swig.GRIB_MISSING_KEY -GRIB_OUT_OF_AREA = _gribapi_swig.GRIB_OUT_OF_AREA -GRIB_CONCEPT_NO_MATCH = _gribapi_swig.GRIB_CONCEPT_NO_MATCH -GRIB_NO_DEFINITIONS = _gribapi_swig.GRIB_NO_DEFINITIONS -GRIB_WRONG_TYPE = _gribapi_swig.GRIB_WRONG_TYPE -GRIB_END = _gribapi_swig.GRIB_END -GRIB_NO_VALUES = _gribapi_swig.GRIB_NO_VALUES -GRIB_WRONG_GRID = _gribapi_swig.GRIB_WRONG_GRID -GRIB_END_OF_INDEX = _gribapi_swig.GRIB_END_OF_INDEX -GRIB_NULL_INDEX = _gribapi_swig.GRIB_NULL_INDEX -GRIB_PREMATURE_END_OF_FILE = _gribapi_swig.GRIB_PREMATURE_END_OF_FILE -GRIB_INTERNAL_ARRAY_TOO_SMALL = _gribapi_swig.GRIB_INTERNAL_ARRAY_TOO_SMALL -GRIB_MESSAGE_TOO_LARGE = _gribapi_swig.GRIB_MESSAGE_TOO_LARGE -GRIB_CONSTANT_FIELD = _gribapi_swig.GRIB_CONSTANT_FIELD -GRIB_SWITCH_NO_MATCH = _gribapi_swig.GRIB_SWITCH_NO_MATCH -GRIB_UNDERFLOW = _gribapi_swig.GRIB_UNDERFLOW -GRIB_MESSAGE_MALFORMED = _gribapi_swig.GRIB_MESSAGE_MALFORMED -GRIB_CORRUPTED_INDEX = _gribapi_swig.GRIB_CORRUPTED_INDEX -GRIB_INVALID_BPV = _gribapi_swig.GRIB_INVALID_BPV -GRIB_DIFFERENT_EDITION = _gribapi_swig.GRIB_DIFFERENT_EDITION -GRIB_VALUE_DIFFERENT = _gribapi_swig.GRIB_VALUE_DIFFERENT -GRIB_INVALID_KEY_VALUE = _gribapi_swig.GRIB_INVALID_KEY_VALUE + return _eccode_swig.memmove(*args) +memmove = _eccode_swig.memmove +GRIB_SUCCESS = _eccode_swig.GRIB_SUCCESS +GRIB_END_OF_FILE = _eccode_swig.GRIB_END_OF_FILE +GRIB_INTERNAL_ERROR = _eccode_swig.GRIB_INTERNAL_ERROR +GRIB_BUFFER_TOO_SMALL = _eccode_swig.GRIB_BUFFER_TOO_SMALL +GRIB_NOT_IMPLEMENTED = _eccode_swig.GRIB_NOT_IMPLEMENTED +GRIB_7777_NOT_FOUND = _eccode_swig.GRIB_7777_NOT_FOUND +GRIB_ARRAY_TOO_SMALL = _eccode_swig.GRIB_ARRAY_TOO_SMALL +GRIB_FILE_NOT_FOUND = _eccode_swig.GRIB_FILE_NOT_FOUND +GRIB_CODE_NOT_FOUND_IN_TABLE = _eccode_swig.GRIB_CODE_NOT_FOUND_IN_TABLE +GRIB_WRONG_ARRAY_SIZE = _eccode_swig.GRIB_WRONG_ARRAY_SIZE +GRIB_NOT_FOUND = _eccode_swig.GRIB_NOT_FOUND +GRIB_IO_PROBLEM = _eccode_swig.GRIB_IO_PROBLEM +GRIB_INVALID_MESSAGE = _eccode_swig.GRIB_INVALID_MESSAGE +GRIB_DECODING_ERROR = _eccode_swig.GRIB_DECODING_ERROR +GRIB_ENCODING_ERROR = _eccode_swig.GRIB_ENCODING_ERROR +GRIB_NO_MORE_IN_SET = _eccode_swig.GRIB_NO_MORE_IN_SET +GRIB_GEOCALCULUS_PROBLEM = _eccode_swig.GRIB_GEOCALCULUS_PROBLEM +GRIB_OUT_OF_MEMORY = _eccode_swig.GRIB_OUT_OF_MEMORY +GRIB_READ_ONLY = _eccode_swig.GRIB_READ_ONLY +GRIB_INVALID_ARGUMENT = _eccode_swig.GRIB_INVALID_ARGUMENT +GRIB_NULL_HANDLE = _eccode_swig.GRIB_NULL_HANDLE +GRIB_INVALID_SECTION_NUMBER = _eccode_swig.GRIB_INVALID_SECTION_NUMBER +GRIB_VALUE_CANNOT_BE_MISSING = _eccode_swig.GRIB_VALUE_CANNOT_BE_MISSING +GRIB_WRONG_LENGTH = _eccode_swig.GRIB_WRONG_LENGTH +GRIB_INVALID_TYPE = _eccode_swig.GRIB_INVALID_TYPE +GRIB_WRONG_STEP = _eccode_swig.GRIB_WRONG_STEP +GRIB_WRONG_STEP_UNIT = _eccode_swig.GRIB_WRONG_STEP_UNIT +GRIB_INVALID_FILE = _eccode_swig.GRIB_INVALID_FILE +GRIB_INVALID_GRIB = _eccode_swig.GRIB_INVALID_GRIB +GRIB_INVALID_INDEX = _eccode_swig.GRIB_INVALID_INDEX +GRIB_INVALID_ITERATOR = _eccode_swig.GRIB_INVALID_ITERATOR +GRIB_INVALID_KEYS_ITERATOR = _eccode_swig.GRIB_INVALID_KEYS_ITERATOR +GRIB_INVALID_NEAREST = _eccode_swig.GRIB_INVALID_NEAREST +GRIB_INVALID_ORDERBY = _eccode_swig.GRIB_INVALID_ORDERBY +GRIB_MISSING_KEY = _eccode_swig.GRIB_MISSING_KEY +GRIB_OUT_OF_AREA = _eccode_swig.GRIB_OUT_OF_AREA +GRIB_CONCEPT_NO_MATCH = _eccode_swig.GRIB_CONCEPT_NO_MATCH +GRIB_NO_DEFINITIONS = _eccode_swig.GRIB_NO_DEFINITIONS +GRIB_WRONG_TYPE = _eccode_swig.GRIB_WRONG_TYPE +GRIB_END = _eccode_swig.GRIB_END +GRIB_NO_VALUES = _eccode_swig.GRIB_NO_VALUES +GRIB_WRONG_GRID = _eccode_swig.GRIB_WRONG_GRID +GRIB_END_OF_INDEX = _eccode_swig.GRIB_END_OF_INDEX +GRIB_NULL_INDEX = _eccode_swig.GRIB_NULL_INDEX +GRIB_PREMATURE_END_OF_FILE = _eccode_swig.GRIB_PREMATURE_END_OF_FILE +GRIB_INTERNAL_ARRAY_TOO_SMALL = _eccode_swig.GRIB_INTERNAL_ARRAY_TOO_SMALL +GRIB_MESSAGE_TOO_LARGE = _eccode_swig.GRIB_MESSAGE_TOO_LARGE +GRIB_CONSTANT_FIELD = _eccode_swig.GRIB_CONSTANT_FIELD +GRIB_SWITCH_NO_MATCH = _eccode_swig.GRIB_SWITCH_NO_MATCH +GRIB_UNDERFLOW = _eccode_swig.GRIB_UNDERFLOW +GRIB_MESSAGE_MALFORMED = _eccode_swig.GRIB_MESSAGE_MALFORMED +GRIB_CORRUPTED_INDEX = _eccode_swig.GRIB_CORRUPTED_INDEX +GRIB_INVALID_BPV = _eccode_swig.GRIB_INVALID_BPV +GRIB_DIFFERENT_EDITION = _eccode_swig.GRIB_DIFFERENT_EDITION +GRIB_VALUE_DIFFERENT = _eccode_swig.GRIB_VALUE_DIFFERENT +GRIB_INVALID_KEY_VALUE = _eccode_swig.GRIB_INVALID_KEY_VALUE class intp(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, intp, name, value) @@ -137,22 +137,22 @@ class intp(_object): __getattr__ = lambda self, name: _swig_getattr(self, intp, name) __repr__ = _swig_repr def __init__(self): - this = _gribapi_swig.new_intp() + this = _eccode_swig.new_intp() try: self.this.append(this) except: self.this = this - __swig_destroy__ = _gribapi_swig.delete_intp + __swig_destroy__ = _eccode_swig.delete_intp __del__ = lambda self : None; - def assign(self, *args): return _gribapi_swig.intp_assign(self, *args) - def value(self): return _gribapi_swig.intp_value(self) - def cast(self): return _gribapi_swig.intp_cast(self) - __swig_getmethods__["frompointer"] = lambda x: _gribapi_swig.intp_frompointer - if _newclass:frompointer = staticmethod(_gribapi_swig.intp_frompointer) -intp_swigregister = _gribapi_swig.intp_swigregister + def assign(self, *args): return _eccode_swig.intp_assign(self, *args) + def value(self): return _eccode_swig.intp_value(self) + def cast(self): return _eccode_swig.intp_cast(self) + __swig_getmethods__["frompointer"] = lambda x: _eccode_swig.intp_frompointer + if _newclass:frompointer = staticmethod(_eccode_swig.intp_frompointer) +intp_swigregister = _eccode_swig.intp_swigregister intp_swigregister(intp) def intp_frompointer(*args): - return _gribapi_swig.intp_frompointer(*args) -intp_frompointer = _gribapi_swig.intp_frompointer + return _eccode_swig.intp_frompointer(*args) +intp_frompointer = _eccode_swig.intp_frompointer class longp(_object): __swig_setmethods__ = {} @@ -161,22 +161,22 @@ class longp(_object): __getattr__ = lambda self, name: _swig_getattr(self, longp, name) __repr__ = _swig_repr def __init__(self): - this = _gribapi_swig.new_longp() + this = _eccode_swig.new_longp() try: self.this.append(this) except: self.this = this - __swig_destroy__ = _gribapi_swig.delete_longp + __swig_destroy__ = _eccode_swig.delete_longp __del__ = lambda self : None; - def assign(self, *args): return _gribapi_swig.longp_assign(self, *args) - def value(self): return _gribapi_swig.longp_value(self) - def cast(self): return _gribapi_swig.longp_cast(self) - __swig_getmethods__["frompointer"] = lambda x: _gribapi_swig.longp_frompointer - if _newclass:frompointer = staticmethod(_gribapi_swig.longp_frompointer) -longp_swigregister = _gribapi_swig.longp_swigregister + def assign(self, *args): return _eccode_swig.longp_assign(self, *args) + def value(self): return _eccode_swig.longp_value(self) + def cast(self): return _eccode_swig.longp_cast(self) + __swig_getmethods__["frompointer"] = lambda x: _eccode_swig.longp_frompointer + if _newclass:frompointer = staticmethod(_eccode_swig.longp_frompointer) +longp_swigregister = _eccode_swig.longp_swigregister longp_swigregister(longp) def longp_frompointer(*args): - return _gribapi_swig.longp_frompointer(*args) -longp_frompointer = _gribapi_swig.longp_frompointer + return _eccode_swig.longp_frompointer(*args) +longp_frompointer = _eccode_swig.longp_frompointer class doublep(_object): __swig_setmethods__ = {} @@ -185,386 +185,390 @@ class doublep(_object): __getattr__ = lambda self, name: _swig_getattr(self, doublep, name) __repr__ = _swig_repr def __init__(self): - this = _gribapi_swig.new_doublep() + this = _eccode_swig.new_doublep() try: self.this.append(this) except: self.this = this - __swig_destroy__ = _gribapi_swig.delete_doublep + __swig_destroy__ = _eccode_swig.delete_doublep __del__ = lambda self : None; - def assign(self, *args): return _gribapi_swig.doublep_assign(self, *args) - def value(self): return _gribapi_swig.doublep_value(self) - def cast(self): return _gribapi_swig.doublep_cast(self) - __swig_getmethods__["frompointer"] = lambda x: _gribapi_swig.doublep_frompointer - if _newclass:frompointer = staticmethod(_gribapi_swig.doublep_frompointer) -doublep_swigregister = _gribapi_swig.doublep_swigregister + def assign(self, *args): return _eccode_swig.doublep_assign(self, *args) + def value(self): return _eccode_swig.doublep_value(self) + def cast(self): return _eccode_swig.doublep_cast(self) + __swig_getmethods__["frompointer"] = lambda x: _eccode_swig.doublep_frompointer + if _newclass:frompointer = staticmethod(_eccode_swig.doublep_frompointer) +doublep_swigregister = _eccode_swig.doublep_swigregister doublep_swigregister(doublep) def doublep_frompointer(*args): - return _gribapi_swig.doublep_frompointer(*args) -doublep_frompointer = _gribapi_swig.doublep_frompointer + return _eccode_swig.doublep_frompointer(*args) +doublep_frompointer = _eccode_swig.doublep_frompointer def new_doubleArray(*args): - return _gribapi_swig.new_doubleArray(*args) -new_doubleArray = _gribapi_swig.new_doubleArray + return _eccode_swig.new_doubleArray(*args) +new_doubleArray = _eccode_swig.new_doubleArray def delete_doubleArray(*args): - return _gribapi_swig.delete_doubleArray(*args) -delete_doubleArray = _gribapi_swig.delete_doubleArray + return _eccode_swig.delete_doubleArray(*args) +delete_doubleArray = _eccode_swig.delete_doubleArray def doubleArray_getitem(*args): - return _gribapi_swig.doubleArray_getitem(*args) -doubleArray_getitem = _gribapi_swig.doubleArray_getitem + return _eccode_swig.doubleArray_getitem(*args) +doubleArray_getitem = _eccode_swig.doubleArray_getitem def doubleArray_setitem(*args): - return _gribapi_swig.doubleArray_setitem(*args) -doubleArray_setitem = _gribapi_swig.doubleArray_setitem + return _eccode_swig.doubleArray_setitem(*args) +doubleArray_setitem = _eccode_swig.doubleArray_setitem def new_longArray(*args): - return _gribapi_swig.new_longArray(*args) -new_longArray = _gribapi_swig.new_longArray + return _eccode_swig.new_longArray(*args) +new_longArray = _eccode_swig.new_longArray def delete_longArray(*args): - return _gribapi_swig.delete_longArray(*args) -delete_longArray = _gribapi_swig.delete_longArray + return _eccode_swig.delete_longArray(*args) +delete_longArray = _eccode_swig.delete_longArray def longArray_getitem(*args): - return _gribapi_swig.longArray_getitem(*args) -longArray_getitem = _gribapi_swig.longArray_getitem + return _eccode_swig.longArray_getitem(*args) +longArray_getitem = _eccode_swig.longArray_getitem def longArray_setitem(*args): - return _gribapi_swig.longArray_setitem(*args) -longArray_setitem = _gribapi_swig.longArray_setitem + return _eccode_swig.longArray_setitem(*args) +longArray_setitem = _eccode_swig.longArray_setitem def new_intArray(*args): - return _gribapi_swig.new_intArray(*args) -new_intArray = _gribapi_swig.new_intArray + return _eccode_swig.new_intArray(*args) +new_intArray = _eccode_swig.new_intArray def delete_intArray(*args): - return _gribapi_swig.delete_intArray(*args) -delete_intArray = _gribapi_swig.delete_intArray + return _eccode_swig.delete_intArray(*args) +delete_intArray = _eccode_swig.delete_intArray def intArray_getitem(*args): - return _gribapi_swig.intArray_getitem(*args) -intArray_getitem = _gribapi_swig.intArray_getitem + return _eccode_swig.intArray_getitem(*args) +intArray_getitem = _eccode_swig.intArray_getitem def intArray_setitem(*args): - return _gribapi_swig.intArray_setitem(*args) -intArray_setitem = _gribapi_swig.intArray_setitem + return _eccode_swig.intArray_setitem(*args) +intArray_setitem = _eccode_swig.intArray_setitem def grib_c_new_from_file(*args): - return _gribapi_swig.grib_c_new_from_file(*args) -grib_c_new_from_file = _gribapi_swig.grib_c_new_from_file + return _eccode_swig.grib_c_new_from_file(*args) +grib_c_new_from_file = _eccode_swig.grib_c_new_from_file def grib_c_new_bufr_from_file(*args): - return _gribapi_swig.grib_c_new_bufr_from_file(*args) -grib_c_new_bufr_from_file = _gribapi_swig.grib_c_new_bufr_from_file + return _eccode_swig.grib_c_new_bufr_from_file(*args) +grib_c_new_bufr_from_file = _eccode_swig.grib_c_new_bufr_from_file def grib_c_new_gts_from_file(*args): - return _gribapi_swig.grib_c_new_gts_from_file(*args) -grib_c_new_gts_from_file = _gribapi_swig.grib_c_new_gts_from_file + return _eccode_swig.grib_c_new_gts_from_file(*args) +grib_c_new_gts_from_file = _eccode_swig.grib_c_new_gts_from_file def grib_c_iterator_new(*args): - return _gribapi_swig.grib_c_iterator_new(*args) -grib_c_iterator_new = _gribapi_swig.grib_c_iterator_new + return _eccode_swig.grib_c_iterator_new(*args) +grib_c_iterator_new = _eccode_swig.grib_c_iterator_new def grib_c_keys_iterator_new(*args): - return _gribapi_swig.grib_c_keys_iterator_new(*args) -grib_c_keys_iterator_new = _gribapi_swig.grib_c_keys_iterator_new + return _eccode_swig.grib_c_keys_iterator_new(*args) +grib_c_keys_iterator_new = _eccode_swig.grib_c_keys_iterator_new def grib_c_new_from_samples(*args): - return _gribapi_swig.grib_c_new_from_samples(*args) -grib_c_new_from_samples = _gribapi_swig.grib_c_new_from_samples + return _eccode_swig.grib_c_new_from_samples(*args) +grib_c_new_from_samples = _eccode_swig.grib_c_new_from_samples def grib_c_index_new_from_file(*args): - return _gribapi_swig.grib_c_index_new_from_file(*args) -grib_c_index_new_from_file = _gribapi_swig.grib_c_index_new_from_file + return _eccode_swig.grib_c_index_new_from_file(*args) +grib_c_index_new_from_file = _eccode_swig.grib_c_index_new_from_file def grib_c_index_add_file(*args): - return _gribapi_swig.grib_c_index_add_file(*args) -grib_c_index_add_file = _gribapi_swig.grib_c_index_add_file + return _eccode_swig.grib_c_index_add_file(*args) +grib_c_index_add_file = _eccode_swig.grib_c_index_add_file def grib_c_new_from_index(*args): - return _gribapi_swig.grib_c_new_from_index(*args) -grib_c_new_from_index = _gribapi_swig.grib_c_new_from_index + return _eccode_swig.grib_c_new_from_index(*args) +grib_c_new_from_index = _eccode_swig.grib_c_new_from_index def grib_c_index_write(*args): - return _gribapi_swig.grib_c_index_write(*args) -grib_c_index_write = _gribapi_swig.grib_c_index_write + return _eccode_swig.grib_c_index_write(*args) +grib_c_index_write = _eccode_swig.grib_c_index_write def grib_c_index_read(*args): - return _gribapi_swig.grib_c_index_read(*args) -grib_c_index_read = _gribapi_swig.grib_c_index_read + return _eccode_swig.grib_c_index_read(*args) +grib_c_index_read = _eccode_swig.grib_c_index_read def grib_c_new_from_message(*args): - return _gribapi_swig.grib_c_new_from_message(*args) -grib_c_new_from_message = _gribapi_swig.grib_c_new_from_message + return _eccode_swig.grib_c_new_from_message(*args) +grib_c_new_from_message = _eccode_swig.grib_c_new_from_message def grib_c_count_in_file(*args): - return _gribapi_swig.grib_c_count_in_file(*args) -grib_c_count_in_file = _gribapi_swig.grib_c_count_in_file + return _eccode_swig.grib_c_count_in_file(*args) +grib_c_count_in_file = _eccode_swig.grib_c_count_in_file def grib_c_release(*args): - return _gribapi_swig.grib_c_release(*args) -grib_c_release = _gribapi_swig.grib_c_release + return _eccode_swig.grib_c_release(*args) +grib_c_release = _eccode_swig.grib_c_release def grib_c_write(*args): - return _gribapi_swig.grib_c_write(*args) -grib_c_write = _gribapi_swig.grib_c_write + return _eccode_swig.grib_c_write(*args) +grib_c_write = _eccode_swig.grib_c_write def grib_c_get_size_long(*args): - return _gribapi_swig.grib_c_get_size_long(*args) -grib_c_get_size_long = _gribapi_swig.grib_c_get_size_long + return _eccode_swig.grib_c_get_size_long(*args) +grib_c_get_size_long = _eccode_swig.grib_c_get_size_long def grib_c_get_string_length(*args): - return _gribapi_swig.grib_c_get_string_length(*args) -grib_c_get_string_length = _gribapi_swig.grib_c_get_string_length + return _eccode_swig.grib_c_get_string_length(*args) +grib_c_get_string_length = _eccode_swig.grib_c_get_string_length def grib_c_clone(*args): - return _gribapi_swig.grib_c_clone(*args) -grib_c_clone = _gribapi_swig.grib_c_clone + return _eccode_swig.grib_c_clone(*args) +grib_c_clone = _eccode_swig.grib_c_clone def grib_c_copy_namespace(*args): - return _gribapi_swig.grib_c_copy_namespace(*args) -grib_c_copy_namespace = _gribapi_swig.grib_c_copy_namespace + return _eccode_swig.grib_c_copy_namespace(*args) +grib_c_copy_namespace = _eccode_swig.grib_c_copy_namespace def grib_c_get_message_size(*args): - return _gribapi_swig.grib_c_get_message_size(*args) -grib_c_get_message_size = _gribapi_swig.grib_c_get_message_size + return _eccode_swig.grib_c_get_message_size(*args) +grib_c_get_message_size = _eccode_swig.grib_c_get_message_size + +def grib_c_get_message_offset(*args): + return _eccode_swig.grib_c_get_message_offset(*args) +grib_c_get_message_offset = _eccode_swig.grib_c_get_message_offset def grib_c_get_native_type(*args): - return _gribapi_swig.grib_c_get_native_type(*args) -grib_c_get_native_type = _gribapi_swig.grib_c_get_native_type + return _eccode_swig.grib_c_get_native_type(*args) +grib_c_get_native_type = _eccode_swig.grib_c_get_native_type def grib_c_multi_new(): - return _gribapi_swig.grib_c_multi_new() -grib_c_multi_new = _gribapi_swig.grib_c_multi_new + return _eccode_swig.grib_c_multi_new() +grib_c_multi_new = _eccode_swig.grib_c_multi_new def grib_c_multi_support_on(): - return _gribapi_swig.grib_c_multi_support_on() -grib_c_multi_support_on = _gribapi_swig.grib_c_multi_support_on + return _eccode_swig.grib_c_multi_support_on() +grib_c_multi_support_on = _eccode_swig.grib_c_multi_support_on def grib_c_multi_write(*args): - return _gribapi_swig.grib_c_multi_write(*args) -grib_c_multi_write = _gribapi_swig.grib_c_multi_write + return _eccode_swig.grib_c_multi_write(*args) +grib_c_multi_write = _eccode_swig.grib_c_multi_write def grib_c_multi_support_off(): - return _gribapi_swig.grib_c_multi_support_off() -grib_c_multi_support_off = _gribapi_swig.grib_c_multi_support_off + return _eccode_swig.grib_c_multi_support_off() +grib_c_multi_support_off = _eccode_swig.grib_c_multi_support_off def grib_c_multi_release(*args): - return _gribapi_swig.grib_c_multi_release(*args) -grib_c_multi_release = _gribapi_swig.grib_c_multi_release + return _eccode_swig.grib_c_multi_release(*args) +grib_c_multi_release = _eccode_swig.grib_c_multi_release def grib_c_multi_append(*args): - return _gribapi_swig.grib_c_multi_append(*args) -grib_c_multi_append = _gribapi_swig.grib_c_multi_append + return _eccode_swig.grib_c_multi_append(*args) +grib_c_multi_append = _eccode_swig.grib_c_multi_append def grib_c_gribex_mode_on(): - return _gribapi_swig.grib_c_gribex_mode_on() -grib_c_gribex_mode_on = _gribapi_swig.grib_c_gribex_mode_on + return _eccode_swig.grib_c_gribex_mode_on() +grib_c_gribex_mode_on = _eccode_swig.grib_c_gribex_mode_on def grib_c_gribex_mode_off(): - return _gribapi_swig.grib_c_gribex_mode_off() -grib_c_gribex_mode_off = _gribapi_swig.grib_c_gribex_mode_off + return _eccode_swig.grib_c_gribex_mode_off() +grib_c_gribex_mode_off = _eccode_swig.grib_c_gribex_mode_off def grib_c_keys_iterator_next(*args): - return _gribapi_swig.grib_c_keys_iterator_next(*args) -grib_c_keys_iterator_next = _gribapi_swig.grib_c_keys_iterator_next + return _eccode_swig.grib_c_keys_iterator_next(*args) +grib_c_keys_iterator_next = _eccode_swig.grib_c_keys_iterator_next def grib_c_keys_iterator_delete(*args): - return _gribapi_swig.grib_c_keys_iterator_delete(*args) -grib_c_keys_iterator_delete = _gribapi_swig.grib_c_keys_iterator_delete + return _eccode_swig.grib_c_keys_iterator_delete(*args) +grib_c_keys_iterator_delete = _eccode_swig.grib_c_keys_iterator_delete def grib_c_skip_computed(*args): - return _gribapi_swig.grib_c_skip_computed(*args) -grib_c_skip_computed = _gribapi_swig.grib_c_skip_computed + return _eccode_swig.grib_c_skip_computed(*args) +grib_c_skip_computed = _eccode_swig.grib_c_skip_computed def grib_c_skip_coded(*args): - return _gribapi_swig.grib_c_skip_coded(*args) -grib_c_skip_coded = _gribapi_swig.grib_c_skip_coded + return _eccode_swig.grib_c_skip_coded(*args) +grib_c_skip_coded = _eccode_swig.grib_c_skip_coded def grib_c_skip_edition_specific(*args): - return _gribapi_swig.grib_c_skip_edition_specific(*args) -grib_c_skip_edition_specific = _gribapi_swig.grib_c_skip_edition_specific + return _eccode_swig.grib_c_skip_edition_specific(*args) +grib_c_skip_edition_specific = _eccode_swig.grib_c_skip_edition_specific def grib_c_skip_duplicates(*args): - return _gribapi_swig.grib_c_skip_duplicates(*args) -grib_c_skip_duplicates = _gribapi_swig.grib_c_skip_duplicates + return _eccode_swig.grib_c_skip_duplicates(*args) +grib_c_skip_duplicates = _eccode_swig.grib_c_skip_duplicates def grib_c_skip_read_only(*args): - return _gribapi_swig.grib_c_skip_read_only(*args) -grib_c_skip_read_only = _gribapi_swig.grib_c_skip_read_only + return _eccode_swig.grib_c_skip_read_only(*args) +grib_c_skip_read_only = _eccode_swig.grib_c_skip_read_only def grib_c_skip_function(*args): - return _gribapi_swig.grib_c_skip_function(*args) -grib_c_skip_function = _gribapi_swig.grib_c_skip_function + return _eccode_swig.grib_c_skip_function(*args) +grib_c_skip_function = _eccode_swig.grib_c_skip_function def grib_c_keys_iterator_rewind(*args): - return _gribapi_swig.grib_c_keys_iterator_rewind(*args) -grib_c_keys_iterator_rewind = _gribapi_swig.grib_c_keys_iterator_rewind + return _eccode_swig.grib_c_keys_iterator_rewind(*args) +grib_c_keys_iterator_rewind = _eccode_swig.grib_c_keys_iterator_rewind def grib_c_keys_iterator_get_name(*args): - return _gribapi_swig.grib_c_keys_iterator_get_name(*args) -grib_c_keys_iterator_get_name = _gribapi_swig.grib_c_keys_iterator_get_name + return _eccode_swig.grib_c_keys_iterator_get_name(*args) +grib_c_keys_iterator_get_name = _eccode_swig.grib_c_keys_iterator_get_name def grib_c_index_get_size_long(*args): - return _gribapi_swig.grib_c_index_get_size_long(*args) -grib_c_index_get_size_long = _gribapi_swig.grib_c_index_get_size_long + return _eccode_swig.grib_c_index_get_size_long(*args) +grib_c_index_get_size_long = _eccode_swig.grib_c_index_get_size_long def grib_c_index_get_long(*args): - return _gribapi_swig.grib_c_index_get_long(*args) -grib_c_index_get_long = _gribapi_swig.grib_c_index_get_long + return _eccode_swig.grib_c_index_get_long(*args) +grib_c_index_get_long = _eccode_swig.grib_c_index_get_long def grib_c_index_get_real8(*args): - return _gribapi_swig.grib_c_index_get_real8(*args) -grib_c_index_get_real8 = _gribapi_swig.grib_c_index_get_real8 + return _eccode_swig.grib_c_index_get_real8(*args) +grib_c_index_get_real8 = _eccode_swig.grib_c_index_get_real8 def grib_c_index_get_string(*args): - return _gribapi_swig.grib_c_index_get_string(*args) -grib_c_index_get_string = _gribapi_swig.grib_c_index_get_string + return _eccode_swig.grib_c_index_get_string(*args) +grib_c_index_get_string = _eccode_swig.grib_c_index_get_string def grib_c_index_select_long(*args): - return _gribapi_swig.grib_c_index_select_long(*args) -grib_c_index_select_long = _gribapi_swig.grib_c_index_select_long + return _eccode_swig.grib_c_index_select_long(*args) +grib_c_index_select_long = _eccode_swig.grib_c_index_select_long def grib_c_index_select_real8(*args): - return _gribapi_swig.grib_c_index_select_real8(*args) -grib_c_index_select_real8 = _gribapi_swig.grib_c_index_select_real8 + return _eccode_swig.grib_c_index_select_real8(*args) +grib_c_index_select_real8 = _eccode_swig.grib_c_index_select_real8 def grib_c_index_select_string(*args): - return _gribapi_swig.grib_c_index_select_string(*args) -grib_c_index_select_string = _gribapi_swig.grib_c_index_select_string + return _eccode_swig.grib_c_index_select_string(*args) +grib_c_index_select_string = _eccode_swig.grib_c_index_select_string def grib_c_index_release(*args): - return _gribapi_swig.grib_c_index_release(*args) -grib_c_index_release = _gribapi_swig.grib_c_index_release + return _eccode_swig.grib_c_index_release(*args) +grib_c_index_release = _eccode_swig.grib_c_index_release def grib_c_iterator_delete(*args): - return _gribapi_swig.grib_c_iterator_delete(*args) -grib_c_iterator_delete = _gribapi_swig.grib_c_iterator_delete + return _eccode_swig.grib_c_iterator_delete(*args) +grib_c_iterator_delete = _eccode_swig.grib_c_iterator_delete def grib_c_iterator_next(*args): - return _gribapi_swig.grib_c_iterator_next(*args) -grib_c_iterator_next = _gribapi_swig.grib_c_iterator_next + return _eccode_swig.grib_c_iterator_next(*args) +grib_c_iterator_next = _eccode_swig.grib_c_iterator_next def grib_c_get_string(*args): - return _gribapi_swig.grib_c_get_string(*args) -grib_c_get_string = _gribapi_swig.grib_c_get_string + return _eccode_swig.grib_c_get_string(*args) +grib_c_get_string = _eccode_swig.grib_c_get_string def grib_c_set_string(*args): - return _gribapi_swig.grib_c_set_string(*args) -grib_c_set_string = _gribapi_swig.grib_c_set_string + return _eccode_swig.grib_c_set_string(*args) +grib_c_set_string = _eccode_swig.grib_c_set_string def grib_c_get_long(*args): - return _gribapi_swig.grib_c_get_long(*args) -grib_c_get_long = _gribapi_swig.grib_c_get_long + return _eccode_swig.grib_c_get_long(*args) +grib_c_get_long = _eccode_swig.grib_c_get_long def grib_c_set_long(*args): - return _gribapi_swig.grib_c_set_long(*args) -grib_c_set_long = _gribapi_swig.grib_c_set_long + return _eccode_swig.grib_c_set_long(*args) +grib_c_set_long = _eccode_swig.grib_c_set_long def grib_c_get_double(*args): - return _gribapi_swig.grib_c_get_double(*args) -grib_c_get_double = _gribapi_swig.grib_c_get_double + return _eccode_swig.grib_c_get_double(*args) +grib_c_get_double = _eccode_swig.grib_c_get_double def grib_c_set_double(*args): - return _gribapi_swig.grib_c_set_double(*args) -grib_c_set_double = _gribapi_swig.grib_c_set_double + return _eccode_swig.grib_c_set_double(*args) +grib_c_set_double = _eccode_swig.grib_c_set_double def grib_c_set_real8_array(*args): - return _gribapi_swig.grib_c_set_real8_array(*args) -grib_c_set_real8_array = _gribapi_swig.grib_c_set_real8_array + return _eccode_swig.grib_c_set_real8_array(*args) +grib_c_set_real8_array = _eccode_swig.grib_c_set_real8_array def grib_c_get_real8_array(*args): - return _gribapi_swig.grib_c_get_real8_array(*args) -grib_c_get_real8_array = _gribapi_swig.grib_c_get_real8_array + return _eccode_swig.grib_c_get_real8_array(*args) +grib_c_get_real8_array = _eccode_swig.grib_c_get_real8_array def grib_c_get_long_array(*args): - return _gribapi_swig.grib_c_get_long_array(*args) -grib_c_get_long_array = _gribapi_swig.grib_c_get_long_array + return _eccode_swig.grib_c_get_long_array(*args) +grib_c_get_long_array = _eccode_swig.grib_c_get_long_array def grib_c_set_long_array(*args): - return _gribapi_swig.grib_c_set_long_array(*args) -grib_c_set_long_array = _gribapi_swig.grib_c_set_long_array + return _eccode_swig.grib_c_set_long_array(*args) +grib_c_set_long_array = _eccode_swig.grib_c_set_long_array def grib_c_get_real8_element(*args): - return _gribapi_swig.grib_c_get_real8_element(*args) -grib_c_get_real8_element = _gribapi_swig.grib_c_get_real8_element + return _eccode_swig.grib_c_get_real8_element(*args) +grib_c_get_real8_element = _eccode_swig.grib_c_get_real8_element def grib_c_get_real8_elements(*args): - return _gribapi_swig.grib_c_get_real8_elements(*args) -grib_c_get_real8_elements = _gribapi_swig.grib_c_get_real8_elements + return _eccode_swig.grib_c_get_real8_elements(*args) +grib_c_get_real8_elements = _eccode_swig.grib_c_get_real8_elements def grib_c_set_missing(*args): - return _gribapi_swig.grib_c_set_missing(*args) -grib_c_set_missing = _gribapi_swig.grib_c_set_missing + return _eccode_swig.grib_c_set_missing(*args) +grib_c_set_missing = _eccode_swig.grib_c_set_missing def grib_c_set_key_vals(*args): - return _gribapi_swig.grib_c_set_key_vals(*args) -grib_c_set_key_vals = _gribapi_swig.grib_c_set_key_vals + return _eccode_swig.grib_c_set_key_vals(*args) +grib_c_set_key_vals = _eccode_swig.grib_c_set_key_vals def grib_c_is_missing(*args): - return _gribapi_swig.grib_c_is_missing(*args) -grib_c_is_missing = _gribapi_swig.grib_c_is_missing + return _eccode_swig.grib_c_is_missing(*args) +grib_c_is_missing = _eccode_swig.grib_c_is_missing def grib_c_is_defined(*args): - return _gribapi_swig.grib_c_is_defined(*args) -grib_c_is_defined = _gribapi_swig.grib_c_is_defined + return _eccode_swig.grib_c_is_defined(*args) +grib_c_is_defined = _eccode_swig.grib_c_is_defined def with_numpy(): - return _gribapi_swig.with_numpy() -with_numpy = _gribapi_swig.with_numpy + return _eccode_swig.with_numpy() +with_numpy = _eccode_swig.with_numpy def grib_set_double_ndarray(*args): - return _gribapi_swig.grib_set_double_ndarray(*args) -grib_set_double_ndarray = _gribapi_swig.grib_set_double_ndarray + return _eccode_swig.grib_set_double_ndarray(*args) +grib_set_double_ndarray = _eccode_swig.grib_set_double_ndarray def grib_set_long_ndarray(*args): - return _gribapi_swig.grib_set_long_ndarray(*args) -grib_set_long_ndarray = _gribapi_swig.grib_set_long_ndarray + return _eccode_swig.grib_set_long_ndarray(*args) +grib_set_long_ndarray = _eccode_swig.grib_set_long_ndarray def grib_get_double_ndarray(*args): - return _gribapi_swig.grib_get_double_ndarray(*args) -grib_get_double_ndarray = _gribapi_swig.grib_get_double_ndarray + return _eccode_swig.grib_get_double_ndarray(*args) +grib_get_double_ndarray = _eccode_swig.grib_get_double_ndarray def grib_get_long_ndarray(*args): - return _gribapi_swig.grib_get_long_ndarray(*args) -grib_get_long_ndarray = _gribapi_swig.grib_get_long_ndarray + return _eccode_swig.grib_get_long_ndarray(*args) +grib_get_long_ndarray = _eccode_swig.grib_get_long_ndarray def grib_get_double_ndelements(*args): - return _gribapi_swig.grib_get_double_ndelements(*args) -grib_get_double_ndelements = _gribapi_swig.grib_get_double_ndelements + return _eccode_swig.grib_get_double_ndelements(*args) +grib_get_double_ndelements = _eccode_swig.grib_get_double_ndelements def grib_c_find_nearest_single(*args): - return _gribapi_swig.grib_c_find_nearest_single(*args) -grib_c_find_nearest_single = _gribapi_swig.grib_c_find_nearest_single + return _eccode_swig.grib_c_find_nearest_single(*args) +grib_c_find_nearest_single = _eccode_swig.grib_c_find_nearest_single def grib_c_find_nearest_four_single(*args): - return _gribapi_swig.grib_c_find_nearest_four_single(*args) -grib_c_find_nearest_four_single = _gribapi_swig.grib_c_find_nearest_four_single + return _eccode_swig.grib_c_find_nearest_four_single(*args) +grib_c_find_nearest_four_single = _eccode_swig.grib_c_find_nearest_four_single def grib_c_get_message(*args): - return _gribapi_swig.grib_c_get_message(*args) -grib_c_get_message = _gribapi_swig.grib_c_get_message + return _eccode_swig.grib_c_get_message(*args) +grib_c_get_message = _eccode_swig.grib_c_get_message def grib_c_get_error_string(*args): - return _gribapi_swig.grib_c_get_error_string(*args) -grib_c_get_error_string = _gribapi_swig.grib_c_get_error_string + return _eccode_swig.grib_c_get_error_string(*args) +grib_c_get_error_string = _eccode_swig.grib_c_get_error_string def no_fail_on_wrong_length(*args): - return _gribapi_swig.no_fail_on_wrong_length(*args) -no_fail_on_wrong_length = _gribapi_swig.no_fail_on_wrong_length + return _eccode_swig.no_fail_on_wrong_length(*args) +no_fail_on_wrong_length = _eccode_swig.no_fail_on_wrong_length def grib_c_get_api_version(): - return _gribapi_swig.grib_c_get_api_version() -grib_c_get_api_version = _gribapi_swig.grib_c_get_api_version + return _eccode_swig.grib_c_get_api_version() +grib_c_get_api_version = _eccode_swig.grib_c_get_api_version def grib_c_gts_header_on(): - return _gribapi_swig.grib_c_gts_header_on() -grib_c_gts_header_on = _gribapi_swig.grib_c_gts_header_on + return _eccode_swig.grib_c_gts_header_on() +grib_c_gts_header_on = _eccode_swig.grib_c_gts_header_on def grib_c_gts_header_off(): - return _gribapi_swig.grib_c_gts_header_off() -grib_c_gts_header_off = _gribapi_swig.grib_c_gts_header_off + return _eccode_swig.grib_c_gts_header_off() +grib_c_gts_header_off = _eccode_swig.grib_c_gts_header_off diff --git a/python/test_general.py b/python/test_general.py index 53fb7f35e..49526c2d9 100755 --- a/python/test_general.py +++ b/python/test_general.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from gribapi import * +from eccode import * import random import traceback @@ -14,7 +14,7 @@ class Usage(Exception): def test(): # test new from sample - #grib_release(grib_new_from_samples("GRIB2")) + #release(grib_new_from_samples("GRIB2")) if len(sys.argv) < 2: raise Usage @@ -29,7 +29,7 @@ def test(): while 1: gid = grib_new_from_file(fid) if not gid: break - grib_release(gid) + release(gid) fid.close() fid = open(infile,"r") @@ -70,16 +70,16 @@ def test(): #grib_print(gid,"centre") if i == 0: - print "Message size: ",grib_get_message_size(gid) - nval = grib_get_size(gid,"values") + print "Message size: ",get_message_size(gid) + nval = get_size(gid,"values") print "Number of values in message %d is %d" % (i,nval) print "== %s %s %s %d ==" % \ ( \ - grib_get_string(gid,"shortName"), \ - grib_get_string(gid,"name"), \ - grib_get_string(gid,"typeOfLevel"), \ - grib_get_long(gid,"level"), \ + get_string(gid,"shortName"), \ + get_string(gid,"name"), \ + get_string(gid,"typeOfLevel"), \ + get_long(gid,"level"), \ ) print "Nearest point to 10,10: " @@ -91,61 +91,61 @@ def test(): for i in range(0,5): rand_index = random.randint(1,nval) rand_list.append(rand_index) - myval = grib_get_double_element(gid,"values",rand_index) + myval = get_double_element(gid,"values",rand_index) print "Random index value[%d] = %.8f" % (rand_index,myval) - all4rand = grib_get_double_elements(gid,"values",rand_list) + all4rand = get_double_elements(gid,"values",rand_list) print "All at once index values: ",all4rand - centre = grib_get_string(gid,"centre") - grib_set_string(gid,"centre","ecmf") - new_centre = grib_get_string(gid,"centre") + centre = get_string(gid,"centre") + set_string(gid,"centre","ecmf") + new_centre = get_string(gid,"centre") print "Before/after string centre: %s/%s" % (centre,new_centre) - centre = grib_get_long(gid,"centre") - grib_set_long(gid,"centre",99) - new_centre = grib_get_long(gid,"centre") + centre = get_long(gid,"centre") + set_long(gid,"centre",99) + new_centre = get_long(gid,"centre") print "Before/after numeric centre: %d/%d" % (centre,new_centre) - centre = grib_get_double(gid,"centre") - grib_set_double(gid,"centre",9) - new_centre = grib_get_double(gid,"centre") + centre = get_double(gid,"centre") + set_double(gid,"centre",9) + new_centre = get_double(gid,"centre") print "Before/after numeric floating point centre: %f/%f" % (centre,new_centre) - vals = grib_get_double_array(gid,"values") + vals = get_double_array(gid,"values") print "Values before: ",vals[:10] - grib_set_double_array(gid,"values",(1.0, 2.0, 3.14)) - vals = grib_get_double_array(gid,"values") + set_double_array(gid,"values",(1.0, 2.0, 3.14)) + vals = get_double_array(gid,"values") print "Values after: ",vals[:10] print "Saving modified message to %s" % outfile if WRITE: grib_write(gid,out) print "Creating and saving a clone to %s" % clonefile - clone_gid = grib_clone(gid) + clone_gid = clone(gid) if WRITE: grib_write(clone_gid,clone_fid) - grib_release(clone_gid) + release(clone_gid) - Ni = grib_get(gid,"Ni") + Ni = get(gid,"Ni") print "Setting Ni to missing from --> ",Ni - grib_set_missing(gid,"Ni") - assert grib_is_missing(gid,"Ni") - miss_Ni = grib_get(gid,"Ni") + set_missing(gid,"Ni") + assert is_missing(gid,"Ni") + miss_Ni = get(gid,"Ni") print "Ni is now --> ",miss_Ni - grib_set(gid,"Ni",Ni) - new_Ni = grib_get(gid,"Ni") + set(gid,"Ni",Ni) + new_Ni = get(gid,"Ni") print "Set Ni back to its original value --> ",new_Ni assert Ni == new_Ni print "Check some keys to see if they are defined" - assert grib_is_defined(gid,"Ni") - assert grib_is_defined(gid,"edition") - assert not grib_is_defined(gid,"DarkThrone") + assert is_defined(gid,"Ni") + assert is_defined(gid,"edition") + assert not is_defined(gid,"DarkThrone") #grib_multi_write(gid,multi) - grib_release(gid) + release(gid) fid.close() out.close() @@ -156,7 +156,7 @@ def test(): def main(): try: test() - except GribInternalError,err: + except InternalError,err: if VERBOSE: traceback.print_exc(file=sys.stderr) else: diff --git a/src/Makefile.am b/src/Makefile.am index be3f0318f..aa687d514 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,278 +12,278 @@ include_HEADERS = grib_api.h libgrib_api_la_prototypes= \ action.c \ - action_class_alias.c \ - action_class_gen.c \ - action_class_if.c \ - action_class_switch.c \ - grib_accessor_class_g1fcperiod.c \ - grib_accessor_class_g1end_of_interval_monthly.c \ - grib_accessor_class_mars_param.c \ - action_class_section.c \ - action_class_list.c \ - action_class_while.c \ - action_class_put.c \ - action_class_meta.c \ - action_class_remove.c \ - action_class_assert.c \ - action_class_template.c \ - action_class_trigger.c \ - action_class_when.c \ - action_class_concept.c \ - action_class_set.c \ - action_class_set_darray.c \ - action_class_set_iarray.c \ - action_class_noop.c \ - action_class_write.c \ - action_class_print.c \ - action_class_variable.c \ - action_class_modify.c \ - grib_accessor.c \ - grib_concept.c \ - grib_darray.c \ - grib_iarray.c \ - grib_accessor_class_array.c \ - grib_accessor_class_assert.c \ - grib_accessor_class_ascii.c \ - grib_accessor_class_bit.c \ - grib_accessor_class_bitmap.c \ - grib_accessor_class_bits.c \ - grib_accessor_class_bits_per_value.c \ - grib_accessor_class_g1bitmap.c \ - grib_accessor_class_g2bitmap.c \ - grib_accessor_class_concept.c \ - grib_accessor_class_decimal_precision.c \ - grib_accessor_class_divdouble.c \ - grib_accessor_class_budgdate.c \ - grib_accessor_class_validity_date.c \ - grib_accessor_class_validity_time.c \ - grib_accessor_class_bytes.c \ - grib_accessor_class.c \ - grib_accessor_class_change_scanning_direction.c \ - grib_accessor_class_codeflag.c \ - grib_accessor_class_codetable.c \ - grib_accessor_class_codetable_units.c \ - grib_accessor_class_codetable_title.c \ - grib_accessor_class_count_file.c \ - grib_accessor_class_count_total.c \ - grib_accessor_class_double.c \ - grib_accessor_class_element.c \ - grib_accessor_class_evaluate.c \ - grib_accessor_class_g1area.c \ - grib_accessor_class_g1date.c \ - grib_accessor_class_g1monthlydate.c \ - grib_accessor_class_library_version.c \ - grib_accessor_class_when.c \ - grib_accessor_class_g1verificationdate.c \ - grib_accessor_class_g1day_of_the_year_date.c \ - grib_accessor_class_g1_half_byte_codeflag.c \ - grib_accessor_class_g1forecastmonth.c \ - grib_accessor_class_g1step_range.c \ - grib_accessor_class_g2step_range.c \ - grib_accessor_class_data_g22order_packing.c \ - grib_accessor_class_mars_step.c \ - grib_accessor_class_g1param.c \ - grib_accessor_class_g1p1p2.c \ - grib_accessor_class_g1_increment.c \ - grib_accessor_class_latlon_increment.c \ - grib_accessor_class_g2date.c \ - grib_accessor_class_g2level.c \ - grib_accessor_class_g2step.c \ - grib_accessor_class_g2end_step.c \ - grib_accessor_class_g2latlon.c \ - grib_accessor_class_g2lon.c \ - grib_accessor_class_global_gaussian.c \ - grib_accessor_class_gen.c \ - grib_accessor_class_gts_header.c \ - grib_accessor_class_ifs_param.c \ - grib_accessor_class_julian_day.c \ - grib_accessor_class_latlonvalues.c \ - grib_accessor_class_latitudes.c \ - grib_accessor_class_longitudes.c \ - grib_accessor_class_missing.c \ - grib_accessor_class_offset_file.c \ - grib_accessor_class_scale.c \ - grib_accessor_class_from_scale_factor_scaled_value.c \ - grib_accessor_class_times.c \ - grib_accessor_class_forward.c \ - grib_accessor_class_g2bitmap_present.c \ - grib_accessor_class_ibmfloat.c \ - grib_accessor_class_ieeefloat.c \ - grib_accessor_class_constant.c \ - grib_accessor_class_iterator.c \ - grib_accessor_class_message.c \ - grib_accessor_class_nearest.c \ - grib_accessor_class_box.c \ - grib_accessor_class_ksec1expver.c \ - grib_accessor_class_laplacian.c \ - grib_accessor_class_label.c \ - grib_accessor_class_long.c \ - grib_accessor_class_lookup.c \ - grib_accessor_class_octect_number.c \ - grib_accessor_class_headers_only.c \ - grib_accessor_class_padding.c \ - grib_accessor_class_pad.c \ - grib_accessor_class_padto.c \ - grib_accessor_class_padtoeven.c \ - grib_accessor_class_padtomultiple.c \ - grib_accessor_class_section_padding.c \ - grib_accessor_class_section_pointer.c \ - grib_accessor_class_position.c \ - grib_accessor_class_signed.c \ - grib_accessor_class_signed_bits.c \ - grib_accessor_class_section.c \ - grib_accessor_class_step_in_units.c \ - grib_accessor_class_section_length.c \ - grib_accessor_class_g1_message_length.c \ - grib_accessor_class_g1_section4_length.c \ - grib_accessor_class_size.c \ - grib_accessor_class_scale_values.c \ - grib_accessor_class_offset_values.c \ - grib_accessor_class_sprintf.c \ - grib_accessor_class_round.c \ - grib_accessor_class_spectral_truncation.c \ - grib_accessor_class_time.c \ - grib_accessor_class_transient.c \ - grib_accessor_class_values.c \ - grib_accessor_class_simple_packing_error.c \ - grib_accessor_class_data_simple_packing.c \ - grib_accessor_class_data_szip_packing.c \ - grib_accessor_class_count_missing.c \ - grib_accessor_class_data_sh_packed.c \ - grib_accessor_class_data_sh_unpacked.c \ - grib_accessor_class_number_of_values_data_raw_packing.c \ - grib_accessor_class_data_g1simple_packing.c \ - grib_accessor_class_data_g1shsimple_packing.c \ - grib_accessor_class_data_shsimple_packing.c \ - grib_accessor_class_data_constant_field.c \ - grib_accessor_class_data_dummy_field.c \ - grib_2order_packer_simple.c \ - grib_accessor_class_variable.c \ - grib_accessor_class_second_order_bits_per_value.c \ - grib_accessor_class_data_g2simple_packing.c \ - grib_accessor_class_data_g2simple_packing_with_preprocessing.c \ - grib_accessor_class_data_g2shsimple_packing.c \ - grib_accessor_class_data_g2complex_packing.c \ - grib_accessor_class_data_2order_packing.c \ - grib_accessor_class_data_2order_packing_count.c \ - grib_accessor_class_data_g1second_order_row_by_row_packing.c \ - grib_accessor_class_data_g1second_order_constant_width_packing.c \ - grib_accessor_class_data_g1second_order_general_packing.c \ - grib_accessor_class_data_g1second_order_general_extended_packing.c \ - grib_accessor_class_g2grid.c \ - grib_accessor_class_data_apply_bitmap.c \ - grib_accessor_class_data_apply_boustrophedonic.c \ - grib_accessor_class_data_secondary_bitmap.c \ - grib_accessor_class_data_g1secondary_bitmap.c \ - grib_accessor_class_data_g2secondary_bitmap.c \ - grib_accessor_class_data_jpeg2000_packing.c \ - grib_accessor_class_data_png_packing.c \ - grib_accessor_class_data_raw_packing.c \ - grib_accessor_class_data_complex_packing.c \ - grib_accessor_class_data_g1complex_packing.c \ - grib_accessor_class_gds_not_present_bitmap.c \ - grib_accessor_class_data_apply_gdsnotpresent.c \ - grib_accessor_class_gds_is_present.c \ - grib_accessor_class_select_step_template.c \ - grib_accessor_class_local_definition.c \ - grib_accessor_class_g2_eps.c \ - grib_accessor_class_g2_mars_labeling.c \ - grib_accessor_class_md5.c \ - grib_jasper_encoding.c \ - grib_openjpeg_encoding.c \ - action_class_set_missing.c \ - grib_accessor_class_number_of_points.c \ - grib_accessor_class_suppressed.c \ - grib_index.c \ - grib_accessor_class_number_of_points_gaussian.c \ - grib_accessor_class_number_of_values.c \ - grib_accessor_class_number_of_coded_values.c \ - grib_accessor_class_g1number_of_coded_values_sh_complex.c \ - grib_accessor_class_g1number_of_coded_values_sh_simple.c \ - grib_accessor_class_dirty.c \ - grib_accessor_class_statistics.c \ - grib_accessor_class_statistics_spectral.c \ - grib_accessor_class_unsigned.c \ - grib_accessor_class_unsigned_bits.c \ - grib_accessor_class_spd.c \ - grib_accessor_class_sum.c \ - grib_accessor_class_vector.c \ - grib_accessor_class_long_vector.c \ - grib_gaussian_reduced.c \ - grib_accessor_class_abstract_vector.c \ - grib_accessor_class_abstract_long_vector.c \ - grib_loader_from_handle.c \ - grib_bits.c \ - grib_timer.c \ - grib_ibmfloat.c \ - grib_ieeefloat.c \ - grib_accessor_class_reference_value_error.c \ - grib_memory.c \ - grib_buffer.c \ - grib_dumper.c \ - grib_dumper_class_serialize.c \ - grib_dumper_class_debug.c \ - grib_dumper_class_default.c \ - grib_dumper_class_keys.c \ - grib_dumper_class_c_code.c \ - grib_dumper_class_wmo.c \ - grib_dumper_class.c \ - grib_context.c \ - grib_date.c \ - grib_fieldset.c \ - grib_filepool.c \ - grib_geography.c \ - grib_handle.c \ - grib_header_compute.c \ - grib_hash_keys.c \ - grib_io.c \ - grib_trie.c \ - grib_itrie.c \ - grib_rules.c \ - grib_keys_iterator.c \ - grib_parse_utils.c \ - grib_query.c \ - grib_scaling.c \ - grib_templates.c \ - grib_dependency.c \ - grib_value.c \ - grib_errors.c \ - grib_expression_class_binop.c \ - grib_expression_class_true.c \ - grib_expression_class_string_compare.c \ - grib_expression_class_unop.c \ - grib_expression_class_functor.c \ - grib_expression_class_accessor.c \ - grib_expression_class_long.c \ - grib_expression_class_double.c \ - grib_expression_class_string.c \ - grib_box.c \ - grib_box_class.c \ - grib_box_class_gen.c \ - grib_box_class_regular_gaussian.c \ - grib_box_class_reduced_gaussian.c \ - grib_nearest.c \ - grib_nearest_class.c \ - grib_nearest_class_gen.c \ - grib_nearest_class_regular.c \ - grib_nearest_class_reduced.c \ - grib_nearest_class_latlon_reduced.c \ - grib_nearest_class_sh.c \ - grib_iterator_class_polar_stereographic.c \ - grib_iterator_class_lambert_azimuthal_equal_area.c \ + action_class_alias.c \ + action_class_gen.c \ + action_class_if.c \ + action_class_switch.c \ + grib_accessor_class_g1fcperiod.c \ + grib_accessor_class_g1end_of_interval_monthly.c \ + grib_accessor_class_mars_param.c \ + action_class_section.c \ + action_class_list.c \ + action_class_while.c \ + action_class_put.c \ + action_class_meta.c \ + action_class_remove.c \ + action_class_assert.c \ + action_class_template.c \ + action_class_trigger.c \ + action_class_when.c \ + action_class_concept.c \ + action_class_set.c \ + action_class_set_darray.c \ + action_class_set_iarray.c \ + action_class_noop.c \ + action_class_write.c \ + action_class_print.c \ + action_class_variable.c \ + action_class_modify.c \ + grib_accessor.c \ + grib_concept.c \ + grib_darray.c \ + grib_iarray.c \ + grib_accessor_class_array.c \ + grib_accessor_class_assert.c \ + grib_accessor_class_ascii.c \ + grib_accessor_class_bit.c \ + grib_accessor_class_bitmap.c \ + grib_accessor_class_bits.c \ + grib_accessor_class_bits_per_value.c \ + grib_accessor_class_g1bitmap.c \ + grib_accessor_class_g2bitmap.c \ + grib_accessor_class_concept.c \ + grib_accessor_class_decimal_precision.c \ + grib_accessor_class_divdouble.c \ + grib_accessor_class_budgdate.c \ + grib_accessor_class_validity_date.c \ + grib_accessor_class_validity_time.c \ + grib_accessor_class_bytes.c \ + grib_accessor_class.c \ + grib_accessor_class_change_scanning_direction.c \ + grib_accessor_class_codeflag.c \ + grib_accessor_class_codetable.c \ + grib_accessor_class_codetable_units.c \ + grib_accessor_class_codetable_title.c \ + grib_accessor_class_count_file.c \ + grib_accessor_class_count_total.c \ + grib_accessor_class_double.c \ + grib_accessor_class_element.c \ + grib_accessor_class_evaluate.c \ + grib_accessor_class_g1area.c \ + grib_accessor_class_g1date.c \ + grib_accessor_class_g1monthlydate.c \ + grib_accessor_class_library_version.c \ + grib_accessor_class_when.c \ + grib_accessor_class_g1verificationdate.c \ + grib_accessor_class_g1day_of_the_year_date.c \ + grib_accessor_class_g1_half_byte_codeflag.c \ + grib_accessor_class_g1forecastmonth.c \ + grib_accessor_class_g1step_range.c \ + grib_accessor_class_g2step_range.c \ + grib_accessor_class_data_g22order_packing.c \ + grib_accessor_class_mars_step.c \ + grib_accessor_class_g1param.c \ + grib_accessor_class_g1p1p2.c \ + grib_accessor_class_g1_increment.c \ + grib_accessor_class_latlon_increment.c \ + grib_accessor_class_g2date.c \ + grib_accessor_class_g2level.c \ + grib_accessor_class_g2step.c \ + grib_accessor_class_g2end_step.c \ + grib_accessor_class_g2latlon.c \ + grib_accessor_class_g2lon.c \ + grib_accessor_class_global_gaussian.c \ + grib_accessor_class_gen.c \ + grib_accessor_class_gts_header.c \ + grib_accessor_class_ifs_param.c \ + grib_accessor_class_julian_day.c \ + grib_accessor_class_latlonvalues.c \ + grib_accessor_class_latitudes.c \ + grib_accessor_class_longitudes.c \ + grib_accessor_class_missing.c \ + grib_accessor_class_offset_file.c \ + grib_accessor_class_scale.c \ + grib_accessor_class_from_scale_factor_scaled_value.c \ + grib_accessor_class_times.c \ + grib_accessor_class_forward.c \ + grib_accessor_class_g2bitmap_present.c \ + grib_accessor_class_ibmfloat.c \ + grib_accessor_class_ieeefloat.c \ + grib_accessor_class_constant.c \ + grib_accessor_class_iterator.c \ + grib_accessor_class_message.c \ + grib_accessor_class_nearest.c \ + grib_accessor_class_box.c \ + grib_accessor_class_ksec1expver.c \ + grib_accessor_class_laplacian.c \ + grib_accessor_class_label.c \ + grib_accessor_class_long.c \ + grib_accessor_class_lookup.c \ + grib_accessor_class_octect_number.c \ + grib_accessor_class_headers_only.c \ + grib_accessor_class_padding.c \ + grib_accessor_class_pad.c \ + grib_accessor_class_padto.c \ + grib_accessor_class_padtoeven.c \ + grib_accessor_class_padtomultiple.c \ + grib_accessor_class_section_padding.c \ + grib_accessor_class_section_pointer.c \ + grib_accessor_class_position.c \ + grib_accessor_class_signed.c \ + grib_accessor_class_signed_bits.c \ + grib_accessor_class_section.c \ + grib_accessor_class_step_in_units.c \ + grib_accessor_class_section_length.c \ + grib_accessor_class_g1_message_length.c \ + grib_accessor_class_g1_section4_length.c \ + grib_accessor_class_size.c \ + grib_accessor_class_scale_values.c \ + grib_accessor_class_offset_values.c \ + grib_accessor_class_sprintf.c \ + grib_accessor_class_round.c \ + grib_accessor_class_spectral_truncation.c \ + grib_accessor_class_time.c \ + grib_accessor_class_transient.c \ + grib_accessor_class_values.c \ + grib_accessor_class_simple_packing_error.c \ + grib_accessor_class_data_simple_packing.c \ + grib_accessor_class_data_szip_packing.c \ + grib_accessor_class_count_missing.c \ + grib_accessor_class_data_sh_packed.c \ + grib_accessor_class_data_sh_unpacked.c \ + grib_accessor_class_number_of_values_data_raw_packing.c \ + grib_accessor_class_data_g1simple_packing.c \ + grib_accessor_class_data_g1shsimple_packing.c \ + grib_accessor_class_data_shsimple_packing.c \ + grib_accessor_class_data_constant_field.c \ + grib_accessor_class_data_dummy_field.c \ + grib_2order_packer_simple.c \ + grib_accessor_class_variable.c \ + grib_accessor_class_second_order_bits_per_value.c \ + grib_accessor_class_data_g2simple_packing.c \ + grib_accessor_class_data_g2simple_packing_with_preprocessing.c \ + grib_accessor_class_data_g2shsimple_packing.c \ + grib_accessor_class_data_g2complex_packing.c \ + grib_accessor_class_data_2order_packing.c \ + grib_accessor_class_data_2order_packing_count.c \ + grib_accessor_class_data_g1second_order_row_by_row_packing.c \ + grib_accessor_class_data_g1second_order_constant_width_packing.c \ + grib_accessor_class_data_g1second_order_general_packing.c \ + grib_accessor_class_data_g1second_order_general_extended_packing.c \ + grib_accessor_class_g2grid.c \ + grib_accessor_class_data_apply_bitmap.c \ + grib_accessor_class_data_apply_boustrophedonic.c \ + grib_accessor_class_data_secondary_bitmap.c \ + grib_accessor_class_data_g1secondary_bitmap.c \ + grib_accessor_class_data_g2secondary_bitmap.c \ + grib_accessor_class_data_jpeg2000_packing.c \ + grib_accessor_class_data_png_packing.c \ + grib_accessor_class_data_raw_packing.c \ + grib_accessor_class_data_complex_packing.c \ + grib_accessor_class_data_g1complex_packing.c \ + grib_accessor_class_gds_not_present_bitmap.c \ + grib_accessor_class_data_apply_gdsnotpresent.c \ + grib_accessor_class_gds_is_present.c \ + grib_accessor_class_select_step_template.c \ + grib_accessor_class_local_definition.c \ + grib_accessor_class_g2_eps.c \ + grib_accessor_class_g2_mars_labeling.c \ + grib_accessor_class_md5.c \ + grib_jasper_encoding.c \ + grib_openjpeg_encoding.c \ + action_class_set_missing.c \ + grib_accessor_class_number_of_points.c \ + grib_accessor_class_suppressed.c \ + grib_index.c \ + grib_accessor_class_number_of_points_gaussian.c \ + grib_accessor_class_number_of_values.c \ + grib_accessor_class_number_of_coded_values.c \ + grib_accessor_class_g1number_of_coded_values_sh_complex.c \ + grib_accessor_class_g1number_of_coded_values_sh_simple.c \ + grib_accessor_class_dirty.c \ + grib_accessor_class_statistics.c \ + grib_accessor_class_statistics_spectral.c \ + grib_accessor_class_unsigned.c \ + grib_accessor_class_unsigned_bits.c \ + grib_accessor_class_spd.c \ + grib_accessor_class_sum.c \ + grib_accessor_class_vector.c \ + grib_accessor_class_long_vector.c \ + grib_gaussian_reduced.c \ + grib_accessor_class_abstract_vector.c \ + grib_accessor_class_abstract_long_vector.c \ + grib_loader_from_handle.c \ + grib_bits.c \ + grib_timer.c \ + grib_ibmfloat.c \ + grib_ieeefloat.c \ + grib_accessor_class_reference_value_error.c \ + grib_memory.c \ + grib_buffer.c \ + grib_dumper.c \ + grib_dumper_class_serialize.c \ + grib_dumper_class_debug.c \ + grib_dumper_class_default.c \ + grib_dumper_class_keys.c \ + grib_dumper_class_c_code.c \ + grib_dumper_class_wmo.c \ + grib_dumper_class.c \ + grib_context.c \ + grib_date.c \ + grib_fieldset.c \ + grib_filepool.c \ + grib_geography.c \ + grib_handle.c \ + grib_header_compute.c \ + grib_hash_keys.c \ + grib_io.c \ + grib_trie.c \ + grib_itrie.c \ + grib_rules.c \ + grib_keys_iterator.c \ + grib_parse_utils.c \ + grib_query.c \ + grib_scaling.c \ + grib_templates.c \ + grib_dependency.c \ + grib_value.c \ + grib_errors.c \ + grib_expression_class_binop.c \ + grib_expression_class_true.c \ + grib_expression_class_string_compare.c \ + grib_expression_class_unop.c \ + grib_expression_class_functor.c \ + grib_expression_class_accessor.c \ + grib_expression_class_long.c \ + grib_expression_class_double.c \ + grib_expression_class_string.c \ + grib_box.c \ + grib_box_class.c \ + grib_box_class_gen.c \ + grib_box_class_regular_gaussian.c \ + grib_box_class_reduced_gaussian.c \ + grib_nearest.c \ + grib_nearest_class.c \ + grib_nearest_class_gen.c \ + grib_nearest_class_regular.c \ + grib_nearest_class_reduced.c \ + grib_nearest_class_latlon_reduced.c \ + grib_nearest_class_sh.c \ + grib_iterator_class_polar_stereographic.c \ + grib_iterator_class_lambert_azimuthal_equal_area.c \ grib_iterator_class_lambert_conformal.c \ - grib_iterator.c \ - grib_iterator_class.c \ - grib_iterator_class_gaussian.c \ - grib_iterator_class_gaussian_reduced.c \ - grib_iterator_class_latlon_reduced.c \ - grib_iterator_class_gen.c \ - grib_iterator_class_latlon.c \ - grib_iterator_class_regular.c \ - grib_expression.c \ - grib_util.c \ - compile.c \ - functions.c + grib_iterator.c \ + grib_iterator_class.c \ + grib_iterator_class_gaussian.c \ + grib_iterator_class_gaussian_reduced.c \ + grib_iterator_class_latlon_reduced.c \ + grib_iterator_class_gen.c \ + grib_iterator_class_latlon.c \ + grib_iterator_class_regular.c \ + grib_expression.c \ + grib_util.c \ + compile.c \ + functions.c libgrib_api_extra_prototypes = grib_bits_any_endian.c grib_bits_any_endian_simple.c diff --git a/src/action_class_concept.c b/src/action_class_concept.c index d38bc8cb4..847c5e803 100644 --- a/src/action_class_concept.c +++ b/src/action_class_concept.c @@ -220,13 +220,13 @@ static grib_concept_value* get_concept(grib_handle* h,grib_action_concept* self) id=grib_itrie_get_id(h->context->concepts_index,key); if ((c=h->context->concepts[id])!=NULL) return c; - if (*local && (full=grib_context_full_path(context,local))!=NULL) { + if (*local && (full=grib_context_full_defs_path(context,local))!=NULL) { c=grib_parse_concept_file(context,full); grib_context_log(h->context,GRIB_LOG_DEBUG, "Loading concept %s from %s",((grib_action*)self)->name,full); } - if ((full=grib_context_full_path(context,master))==NULL) { + if ((full=grib_context_full_defs_path(context,master))==NULL) { grib_context_log(h->context,GRIB_LOG_ERROR, "Unable to load %s from %s ",((grib_action*)self)->name,full); return NULL; diff --git a/src/action_class_section.c b/src/action_class_section.c index 88e261638..f29880079 100644 --- a/src/action_class_section.c +++ b/src/action_class_section.c @@ -76,8 +76,9 @@ static void init_class(grib_action_class* c) } /* END_CLASS_IMP */ -#if 0 -/* new GCC compiler v4.5.0 complains function is defined but not used*/ +/* + * new GCC compiler v4.5.0 complains function is defined but not used + * static void check_sections(grib_section *s,grib_handle* h) { grib_accessor *a = s?s->block->first:NULL; @@ -89,7 +90,7 @@ static void check_sections(grib_section *s,grib_handle* h) a = a->next; } } -#endif +*/ static int notify_change(grib_action* act, grib_accessor * notified, grib_accessor* changed) diff --git a/src/action_class_template.c b/src/action_class_template.c index 26e1205f7..e00517e34 100644 --- a/src/action_class_template.c +++ b/src/action_class_template.c @@ -136,7 +136,7 @@ grib_action* get_empty_template(grib_context* c,int *err) { char fname[]="empty_template.def"; char* path=0; - path=grib_context_full_path(c,fname); + path=grib_context_full_defs_path(c,fname); if (path) { *err=GRIB_SUCCESS; return grib_parse_file(c, path); @@ -165,7 +165,7 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader *h ){ if(a->arg){ ret = grib_recompose_name(p->h,as,a->arg,fname,1); - if ((fpath=grib_context_full_path(p->h->context,fname))==NULL) { + if ((fpath=grib_context_full_defs_path(p->h->context,fname))==NULL) { if (!a->nofail) { grib_context_log(p->h->context,GRIB_LOG_ERROR, "Unable to find template %s from %s ",act->name,fname); @@ -212,7 +212,7 @@ static grib_action* reparse(grib_action* a,grib_accessor* acc,int *doit) char fname[1024]; grib_recompose_name(acc->parent->h,NULL,self->arg,fname,1); - if ((fpath=grib_context_full_path(acc->parent->h->context,fname))==NULL) { + if ((fpath=grib_context_full_defs_path(acc->parent->h->context,fname))==NULL) { if (!self->nofail) { grib_context_log(acc->parent->h->context,GRIB_LOG_ERROR, "Unable to find template %s from %s ",a->name,fname); diff --git a/src/action_class_write.c b/src/action_class_write.c index 21401cc11..96d81dab7 100755 --- a/src/action_class_write.c +++ b/src/action_class_write.c @@ -106,35 +106,35 @@ grib_action* grib_action_create_write( grib_context* context, const char* name,i static int execute(grib_action* act, grib_handle *h) { - int ioerr=0; - grib_action_write* a = (grib_action_write*) act; - int err =GRIB_SUCCESS; - size_t size; - const void* buffer=NULL; - char* filename; - char string[1024]={0,}; + int ioerr = 0; + grib_action_write* a = (grib_action_write*) act; + int err = GRIB_SUCCESS; + size_t size; + const void* buffer = NULL; + char* filename; + char string[1024] = { 0, }; - grib_file* of=NULL; + grib_file* of = NULL; - if ((err=grib_get_message(h,&buffer,&size))!= GRIB_SUCCESS) { - grib_context_log(act->context,GRIB_LOG_ERROR,"unable to get message\n"); - return err; - } + if ((err = grib_get_message(h, &buffer, &size)) != GRIB_SUCCESS) { + grib_context_log(act->context, GRIB_LOG_ERROR,"unable to get message\n"); + return err; + } - if (strlen(a->name)!=0) { - err = grib_recompose_name(h,NULL,a->name,string,0); - filename=string; - } else { - filename = act->context->outfilename ? act->context->outfilename : "filter.out"; - } + if (strlen(a->name) != 0) { + err = grib_recompose_name(h, NULL, a->name, string, 0); + filename = string; + } else { + filename = act->context->outfilename ? act->context->outfilename : "filter.out"; + } - if (a->append) of=grib_file_open(filename,"a",&err); - else of=grib_file_open(filename,"w",&err); + if (a->append) of = grib_file_open(filename, "a", &err); + else of = grib_file_open(filename, "w", &err); - if (!of || !of->handle) { - grib_context_log(act->context,GRIB_LOG_ERROR,"unable to open file %s\n",filename); - return GRIB_IO_PROBLEM; - } + if (!of || !of->handle) { + grib_context_log(act->context, GRIB_LOG_ERROR,"unable to open file %s\n", filename); + return GRIB_IO_PROBLEM; + } if (h->gts_header) { if (fwrite(h->gts_header, 1, h->gts_header_len, of->handle) != h->gts_header_len) { @@ -145,45 +145,44 @@ static int execute(grib_action* act, grib_handle *h) } } - if(fwrite(buffer,1,size,of->handle) != size) { - ioerr=errno; - grib_context_log(act->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR), - "Error writing to %s",filename); - return GRIB_IO_PROBLEM; - } + if (fwrite(buffer, 1, size, of->handle) != size) { + ioerr = errno; + grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), + "Error writing to %s", filename); + return GRIB_IO_PROBLEM; + } - if (a->padtomultiple) { - char* zeros; - size_t padding=a->padtomultiple - size%a->padtomultiple; - /* printf("XXX padding=%d size=%d padtomultiple=%d\n",padding,size,a->padtomultiple); */ - zeros=calloc(padding,1); - if(fwrite(zeros,1,padding,of->handle) != padding) { - ioerr=errno; - grib_context_log(act->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR), - "Error writing to %s",filename); - return GRIB_IO_PROBLEM; - } - free(zeros); - } + if (a->padtomultiple) { + char* zeros; + size_t padding = a->padtomultiple - size % a->padtomultiple; + /* printf("XXX padding=%d size=%d padtomultiple=%d\n",padding,size,a->padtomultiple); */ + zeros = calloc(padding, 1); + if (fwrite(zeros, 1, padding, of->handle) != padding) { + ioerr = errno; + grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), + "Error writing to %s", filename); + return GRIB_IO_PROBLEM; + } + free(zeros); + } - if (h->gts_header) { - char gts_trailer[4]={'\x0D','\x0D','\x0A','\x03'}; + if (h->gts_header) { + char gts_trailer[4] = { '\x0D', '\x0D', '\x0A', '\x03' }; if (fwrite(gts_trailer, 1, 4, of->handle) != 4) { ioerr = errno; grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), "Error writing GTS trailer to %s", filename); return GRIB_IO_PROBLEM; - } + } } - grib_file_close(filename,&err); + grib_file_close(filename, &err); + if (err != GRIB_SUCCESS) { + grib_context_log(act->context, GRIB_LOG_ERROR,"unable to write message\n"); + return err; + } - if (err != GRIB_SUCCESS) { - grib_context_log(act->context,GRIB_LOG_ERROR,"unable to get message\n"); - return err; - } - - return err; + return err; } diff --git a/src/errors.pl b/src/errors.pl index 51e14e96c..40f59bb50 100755 --- a/src/errors.pl +++ b/src/errors.pl @@ -1,5 +1,12 @@ #!/usr/bin/perl - +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# use Data::Dumper; use strict; use warnings; diff --git a/src/functions.c b/src/functions.c index a673e2537..63d8fb231 100644 --- a/src/functions.c +++ b/src/functions.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api_internal.h" long grib_op_eq(long a, long b) {return a == b;} diff --git a/src/grib2c.pl b/src/grib2c.pl index f1f6eda0f..29fd2d1c8 100755 --- a/src/grib2c.pl +++ b/src/grib2c.pl @@ -1,4 +1,12 @@ #!/usr/bin/perl +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# use strict; use Data::Dumper; diff --git a/src/grib_accessor_class.c b/src/grib_accessor_class.c index 04079d9f2..07ade43e6 100644 --- a/src/grib_accessor_class.c +++ b/src/grib_accessor_class.c @@ -58,7 +58,7 @@ grib_section* grib_create_root_section(const grib_context *context, grib_handle GRIB_PTHREAD_ONCE(&once,&init); GRIB_MUTEX_LOCK(&mutex1); if(h->context->grib_reader == NULL) { - if ((fpath=grib_context_full_path(h->context,"boot.def"))==NULL) { + if ((fpath=grib_context_full_defs_path(h->context,"boot.def"))==NULL) { grib_context_log(h->context,GRIB_LOG_FATAL, "Unable to find boot.def "); } diff --git a/src/grib_accessor_class_bits.c b/src/grib_accessor_class_bits.c index 0986f66b2..8ae8dd473 100644 --- a/src/grib_accessor_class_bits.c +++ b/src/grib_accessor_class_bits.c @@ -12,6 +12,7 @@ * Enrico Fucile **************************************/ + #include "grib_api_internal.h" #include diff --git a/src/grib_accessor_class_box.c b/src/grib_accessor_class_box.c index bd26b544c..f0f3b2872 100644 --- a/src/grib_accessor_class_box.c +++ b/src/grib_accessor_class_box.c @@ -8,12 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - #include "grib_api_internal.h" /* diff --git a/src/grib_accessor_class_change_scanning_direction.c b/src/grib_accessor_class_change_scanning_direction.c index ca7dcb1fd..be5655cf9 100644 --- a/src/grib_accessor_class_change_scanning_direction.c +++ b/src/grib_accessor_class_change_scanning_direction.c @@ -162,7 +162,7 @@ static void init(grib_accessor* a, const long len , grib_arguments* args ) static int pack_long(grib_accessor* a, const long* val, size_t *len) { int ret=0; - long i,j,jr,end,Ni,Nj,k,kp; + long i,j,jr,theEnd,Ni,Nj,k,kp; double tmp; long iScansNegatively=0; long jScansPositively=0; @@ -210,10 +210,10 @@ static int pack_long(grib_accessor* a, const long* val, size_t *len) } if (self->axis[0] == 'x') { - end=(Ni+0.5)/2; + theEnd=(Ni+0.5)/2; for (j=0;jparent->h,NULL, self->tablename, fname,1); - if ((filename=grib_context_full_path(a->parent->h->context,fname))==NULL) { + if ((filename=grib_context_full_defs_path(a->parent->h->context,fname))==NULL) { grib_context_log(a->parent->h->context,GRIB_LOG_WARNING,"Cannot open flag table %s",filename); strcpy(codename, "Cannot open flag table"); return GRIB_FILE_NOT_FOUND; diff --git a/src/grib_accessor_class_codetable.c b/src/grib_accessor_class_codetable.c index f038fd557..421812e0c 100644 --- a/src/grib_accessor_class_codetable.c +++ b/src/grib_accessor_class_codetable.c @@ -199,75 +199,75 @@ static void init(grib_accessor* a, const long len, grib_arguments* params) { static grib_codetable* load_table(grib_accessor_codetable* self) { - size_t size = 0; - grib_handle* h = ((grib_accessor*)self)->parent->h; - grib_context* c = h->context; - grib_codetable* t = NULL; - grib_codetable* next=NULL ; - grib_accessor* a=(grib_accessor*)self; - char *filename=0; - char name[1024]={0,}; - char recomposed[1024]={0,}; - char localRecomposed[1024]={0,}; - char *localFilename=0; - char localName[1024]={0,}; - char masterDir[1024]={0,}; - char localDir[1024]={0,}; - size_t len=1024; + size_t size = 0; + grib_handle* h = ((grib_accessor*)self)->parent->h; + grib_context* c = h->context; + grib_codetable* t = NULL; + grib_codetable* next=NULL ; + grib_accessor* a=(grib_accessor*)self; + char *filename=0; + char name[1024]={0,}; + char recomposed[1024]={0,}; + char localRecomposed[1024]={0,}; + char *localFilename=0; + char localName[1024]={0,}; + char masterDir[1024]={0,}; + char localDir[1024]={0,}; + size_t len=1024; - if (self->masterDir != NULL) - grib_get_string(h,self->masterDir,masterDir,&len); + if (self->masterDir != NULL) + grib_get_string(h,self->masterDir,masterDir,&len); - len=1024; - if (self->localDir != NULL) - grib_get_string(h,self->localDir,localDir,&len); + len=1024; + if (self->localDir != NULL) + grib_get_string(h,self->localDir,localDir,&len); - if (*masterDir!=0) { - sprintf(name,"%s/%s",masterDir,self->tablename); - grib_recompose_name(h, NULL,name, recomposed,0); - filename=grib_context_full_path(c,recomposed); - } else { - grib_recompose_name(h, NULL,self->tablename, recomposed,0); - filename=grib_context_full_path(c,recomposed); - } + if (*masterDir!=0) { + sprintf(name,"%s/%s",masterDir,self->tablename); + grib_recompose_name(h, NULL,name, recomposed,0); + filename=grib_context_full_defs_path(c,recomposed); + } else { + grib_recompose_name(h, NULL,self->tablename, recomposed,0); + filename=grib_context_full_defs_path(c,recomposed); + } - if (*localDir!=0) { - sprintf(localName,"%s/%s",localDir,self->tablename); - grib_recompose_name(h, NULL,localName, localRecomposed,0); - localFilename=grib_context_full_path(c,localRecomposed); - } - - next=c->codetable; - while(next) { - if((filename && next->filename[0] && strcmp(filename,next->filename[0]) == 0) && - ((localFilename==0 && next->filename[1]==NULL) || - ((localFilename!=0 && next->filename[1]!=NULL) - && strcmp(localFilename,next->filename[1]) ==0)) ) - return next; - next = next->next; - } + if (*localDir!=0) { + sprintf(localName,"%s/%s",localDir,self->tablename); + grib_recompose_name(h, NULL,localName, localRecomposed,0); + localFilename=grib_context_full_defs_path(c,localRecomposed); + } - if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { - Assert(a->vvalue!=NULL); - size=a->vvalue->length*8; - } else { - size = grib_byte_count((grib_accessor*)self) * 8; - } - size = grib_power(size,2); + next=c->codetable; + while(next) { + if((filename && next->filename[0] && strcmp(filename,next->filename[0]) == 0) && + ((localFilename==0 && next->filename[1]==NULL) || + ((localFilename!=0 && next->filename[1]!=NULL) + && strcmp(localFilename,next->filename[1]) ==0)) ) + return next; + next = next->next; + } - t = (grib_codetable*)grib_context_malloc_clear_persistent(c,sizeof(grib_codetable) + - (size-1)*sizeof(code_table_entry)); + if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { + Assert(a->vvalue!=NULL); + size=a->vvalue->length*8; + } else { + size = grib_byte_count((grib_accessor*)self) * 8; + } + size = grib_power(size,2); - if (filename!=0) grib_load_codetable(c,filename,recomposed,size,t); + t = (grib_codetable*)grib_context_malloc_clear_persistent(c,sizeof(grib_codetable) + + (size-1)*sizeof(code_table_entry)); - if (localFilename!=0) grib_load_codetable(c,localFilename,localRecomposed,size,t); + if (filename!=0) grib_load_codetable(c,filename,recomposed,size,t); - if (t->filename[0]==NULL && t->filename[1]==NULL) { - grib_context_free_persistent(c,t); - return NULL; - } - - return t; + if (localFilename!=0) grib_load_codetable(c,localFilename,localRecomposed,size,t); + + if (t->filename[0]==NULL && t->filename[1]==NULL) { + grib_context_free_persistent(c,t); + return NULL; + } + + return t; } @@ -305,7 +305,7 @@ static int grib_load_codetable(grib_context* c,const char* filename, char* r = title; char* units=0; char unknown[]="unknown"; - ++lineNumber; + ++lineNumber; line[strlen(line)-1] = 0; @@ -318,11 +318,11 @@ static int grib_load_codetable(grib_context* c,const char* filename, if( *p =='\0' ) continue; - if (!isdigit(*p)) - { - grib_context_log(c,GRIB_LOG_ERROR, "Invalid entry in file %s: line %d", filename, lineNumber); - continue; /* skip this line */ - } + if (!isdigit(*p)) + { + grib_context_log(c,GRIB_LOG_ERROR, "Invalid entry in file %s: line %d", filename, lineNumber); + continue; /* skip this line */ + } Assert(isdigit(*p)); while(*p != '\0') @@ -533,71 +533,74 @@ static long value_count(grib_accessor* a) static int pack_string(grib_accessor* a, const char* buffer, size_t *len) { - grib_accessor_codetable* self = (grib_accessor_codetable*)a; - grib_codetable* table ; + grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_codetable* table ; - long i; - size_t size = 1; + long i; + size_t size = 1; - typedef int (*cmpproc)(const char*, const char*); + typedef int (*cmpproc)(const char*, const char*); +#ifndef _WIN32 + cmpproc cmp = a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE ? strcasecmp : strcmp; +#else + /* Microsoft Windows Visual Studio support */ + cmpproc cmp = a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE ? stricmp : strcmp; +#endif + if(!self->table) self->table = load_table(self); + table=self->table; - cmpproc cmp = a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE ? strcasecmp : strcmp; + if(!table) + return GRIB_ENCODING_ERROR; - if(!self->table) self->table = load_table(self); - table=self->table; + if (a->set) { + int err=grib_set_string(a->parent->h,a->set,buffer,len); + if (err!=0) return err; + } - if(!table) - return GRIB_ENCODING_ERROR; + for(i = 0 ; i < table->size; i++) + if(table->entries[i].abbreviation) + if(cmp(table->entries[i].abbreviation,buffer) == 0) + return grib_pack_long(a,&i,&size); - if (a->set) { - int err=grib_set_string(a->parent->h,a->set,buffer,len); - if (err!=0) return err; - } + if (a->flags & GRIB_ACCESSOR_FLAG_NO_FAIL) { + grib_action* act=(grib_action*)(a->creator); + if (act->default_value!=NULL) { + const char* p = 0; + size_t len = 1; + long l; + int ret=0; + double d; + char tmp[1024]; + grib_expression* expression=grib_arguments_get_expression(a->parent->h,act->default_value,0); + int type = grib_expression_native_type(a->parent->h,expression); + switch(type) { + case GRIB_TYPE_DOUBLE: + grib_expression_evaluate_double(a->parent->h,expression,&d); + grib_pack_double(a,&d,&len); + break; - for(i = 0 ; i < table->size; i++) - if(table->entries[i].abbreviation) - if(cmp(table->entries[i].abbreviation,buffer) == 0) - return grib_pack_long(a,&i,&size); + case GRIB_TYPE_LONG: + grib_expression_evaluate_long(a->parent->h,expression,&l); + grib_pack_long(a,&l,&len); + break; - if (a->flags & GRIB_ACCESSOR_FLAG_NO_FAIL) { - grib_action* act=(grib_action*)(a->creator); - if (act->default_value!=NULL) { - const char* p = 0; - size_t len = 1; - long l; - int ret=0; - double d; - char tmp[1024]; - grib_expression* expression=grib_arguments_get_expression(a->parent->h,act->default_value,0); - int type = grib_expression_native_type(a->parent->h,expression); - switch(type) { - case GRIB_TYPE_DOUBLE: - grib_expression_evaluate_double(a->parent->h,expression,&d); - grib_pack_double(a,&d,&len); - break; + default: + len = sizeof(tmp); + p = grib_expression_evaluate_string(a->parent->h,expression,tmp,&len,&ret); + if (ret != GRIB_SUCCESS) { + grib_context_log(a->parent->h->context,GRIB_LOG_FATAL, + "unable to evaluate %s as string",a->name); + return ret; + } + len = strlen(p)+1; + pack_string(a,p,&len); + break; + } + return GRIB_SUCCESS; + } - case GRIB_TYPE_LONG: - grib_expression_evaluate_long(a->parent->h,expression,&l); - grib_pack_long(a,&l,&len); - break; - - default: - len = sizeof(tmp); - p = grib_expression_evaluate_string(a->parent->h,expression,tmp,&len,&ret); - if (ret != GRIB_SUCCESS) { - grib_context_log(a->parent->h->context,GRIB_LOG_FATAL, - "unable to evaluate %s as string",a->name); - return ret; - } - len = strlen(p)+1; - pack_string(a,p,&len); - break; - } - return GRIB_SUCCESS; - } - - } - return GRIB_ENCODING_ERROR; + } + return GRIB_ENCODING_ERROR; } static int pack_expression(grib_accessor* a, grib_expression *e){ diff --git a/src/grib_accessor_class_data_2order_packing.c b/src/grib_accessor_class_data_2order_packing.c index bab7584c7..2c0c7def9 100644 --- a/src/grib_accessor_class_data_2order_packing.c +++ b/src/grib_accessor_class_data_2order_packing.c @@ -806,7 +806,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len) /* for(i=0;i < 10;i++) - printf("paking value [%d] %g %ld %ld bias %ld <<\n", i, val[i],sec_val[i],binary_scale_factor,bias ); + printf("packing value [%d] %g %ld %ld bias %ld <<\n", i, val[i],sec_val[i],binary_scale_factor,bias ); */ nv = n_vals-n_sp_diff; group_val = sec_val+n_sp_diff; @@ -870,7 +870,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len) grib_encode_unsigned_longb(buf_vals, sec_val[vcount+j]-sd->array_of_group_refs[i] ,&bitp , sd->array_of_group_width[i]); /* if(vcount+j < 10) - printf(">>paking value [%ld] %g %ld %ld nb %ld <<\n", vcount+j, val[vcount+j],sec_val[vcount+j],binary_scale_factor,sd->array_of_group_refs[i] );*/ + printf(">>packing value [%ld] %g %ld %ld nb %ld <<\n", vcount+j, val[vcount+j],sec_val[vcount+j],binary_scale_factor,sd->array_of_group_refs[i] );*/ } vcount+= sd->array_of_group_size[i]; } diff --git a/src/grib_accessor_class_data_png_packing.c b/src/grib_accessor_class_data_png_packing.c index 75659d9f5..20b3008e8 100644 --- a/src/grib_accessor_class_data_png_packing.c +++ b/src/grib_accessor_class_data_png_packing.c @@ -234,7 +234,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len) long bits8; png_structp png = 0; - png_infop info = 0,end = 0; + png_infop info = 0,theEnd = 0; png_bytepp rows = 0; int interlace = 0,colour = 0,compression = 0,filter = 0,depth = 0; @@ -295,8 +295,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len) goto cleanup; } - end = png_create_info_struct(png); - if (!end) + theEnd = png_create_info_struct(png); + if (!theEnd) { err = GRIB_DECODING_ERROR; goto cleanup; @@ -358,7 +358,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len) cleanup: if(png) - png_destroy_read_struct(&png, info?&info:NULL, end?&end:NULL); + png_destroy_read_struct(&png, info?&info:NULL, theEnd?&theEnd:NULL); return err; } diff --git a/src/grib_accessor_class_from_scale_factor_scaled_value.c b/src/grib_accessor_class_from_scale_factor_scaled_value.c index ac2fe77ab..521e7ca67 100644 --- a/src/grib_accessor_class_from_scale_factor_scaled_value.c +++ b/src/grib_accessor_class_from_scale_factor_scaled_value.c @@ -133,52 +133,56 @@ static void init_class(grib_accessor_class* c) static void init(grib_accessor* a,const long l, grib_arguments* c) { - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; - int n = 0; + grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; + int n = 0; - self->scaleFactor = grib_arguments_get_name(a->parent->h,c,n++); - self->scaledValue = grib_arguments_get_name(a->parent->h,c,n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + self->scaleFactor = grib_arguments_get_name(a->parent->h,c,n++); + self->scaledValue = grib_arguments_get_name(a->parent->h,c,n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; } -static int unpack_double (grib_accessor* a, double* val, size_t *len) { - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; - int ret = 0; - long scaleFactor=0; - long scaledValue=0; - - if((ret = grib_get_long_internal(a->parent->h, self->scaleFactor,&scaleFactor)) != GRIB_SUCCESS) - return ret; +static int unpack_double(grib_accessor* a, double* val, size_t *len) +{ + grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; + int ret = 0; + long scaleFactor=0; + long scaledValue=0; - if((ret = grib_get_long_internal(a->parent->h, self->scaledValue,&scaledValue)) != GRIB_SUCCESS) - return ret; + if((ret = grib_get_long_internal(a->parent->h, self->scaleFactor,&scaleFactor)) != GRIB_SUCCESS) + return ret; - *val=scaledValue; - while (scaleFactor <0) {*val*=10;scaleFactor++;} - while (scaleFactor >0) {*val/=10;scaleFactor--;} + if((ret = grib_get_long_internal(a->parent->h, self->scaledValue,&scaledValue)) != GRIB_SUCCESS) + return ret; - if (ret == GRIB_SUCCESS) *len = 1; + *val=scaledValue; - return ret; + /* The formula is: + * real_value = scaled_value / pow(10, scale_factor) + */ + while (scaleFactor <0) {*val*=10;scaleFactor++;} + while (scaleFactor >0) {*val/=10;scaleFactor--;} + + if (ret == GRIB_SUCCESS) *len = 1; + + return ret; } +static int is_missing(grib_accessor* a) +{ + grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; + int ret = 0; + long scaleFactor=0; + long scaledValue=0; -static int is_missing(grib_accessor* a){ - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; - int ret = 0; - long scaleFactor=0; - long scaledValue=0; - - if((ret = grib_get_long_internal(a->parent->h, self->scaleFactor,&scaleFactor)) - != GRIB_SUCCESS) - return ret; + if((ret = grib_get_long_internal(a->parent->h, self->scaleFactor,&scaleFactor)) + != GRIB_SUCCESS) + return ret; - if((ret = grib_get_long_internal(a->parent->h, self->scaledValue,&scaledValue)) - != GRIB_SUCCESS) - return ret; + if((ret = grib_get_long_internal(a->parent->h, self->scaledValue,&scaledValue)) + != GRIB_SUCCESS) + return ret; - return ((scaleFactor == GRIB_MISSING_LONG) | (scaledValue == GRIB_MISSING_LONG)); + return ((scaleFactor == GRIB_MISSING_LONG) | (scaledValue == GRIB_MISSING_LONG)); } diff --git a/src/grib_accessor_class_g1fcperiod.c b/src/grib_accessor_class_g1fcperiod.c index 53a1b11f8..0f9a16e50 100644 --- a/src/grib_accessor_class_g1fcperiod.c +++ b/src/grib_accessor_class_g1fcperiod.c @@ -134,15 +134,15 @@ static void init_class(grib_accessor_class* c) static int unpack_string(grib_accessor* a, char* val, size_t *len) { - long start = 0, end = 0; + long start = 0, theEnd = 0; char tmp[1024]; - int err = grib_g1_step_get_steps(a,&start,&end); + int err = grib_g1_step_get_steps(a,&start,&theEnd); size_t l = 0; if(err) return err; - sprintf(tmp,"%ld-%ld",start/24,end/24); + sprintf(tmp,"%ld-%ld",start/24,theEnd/24); /*printf("---- FCPERIOD %s [start:%g, end:%g]",tmp,start,end);*/ l = strlen(tmp) + 1; diff --git a/src/grib_accessor_class_g1step_range.c b/src/grib_accessor_class_g1step_range.c index cdb18aaf5..141de31e5 100644 --- a/src/grib_accessor_class_g1step_range.c +++ b/src/grib_accessor_class_g1step_range.c @@ -219,7 +219,7 @@ static int u2s[] = { }; -int grib_g1_step_get_steps(grib_accessor* a,long* start,long* end) { +int grib_g1_step_get_steps(grib_accessor* a,long* start,long* theEnd) { grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; int err = 0; long p1 = 0,p2 = 0,unit = 0,timeRangeIndicator=0,timeRangeIndicatorFromStepRange=0; @@ -258,23 +258,23 @@ int grib_g1_step_get_steps(grib_accessor* a,long* start,long* end) { } else sprintf(stepType,"unknown"); *start = p1; - *end = p2; + *theEnd = p2; - if (timeRangeIndicator==10) *start = *end = (p1<<8) | (p2<<0); - else if (!strcmp(stepType,"instant")) *start = *end = p1; - else if (!strcmp(stepType,"accum") && timeRangeIndicator==0 ) {*start =0; *end = p1;} + if (timeRangeIndicator==10) *start = *theEnd = (p1<<8) | (p2<<0); + else if (!strcmp(stepType,"instant")) *start = *theEnd = p1; + else if (!strcmp(stepType,"accum") && timeRangeIndicator==0 ) {*start =0; *theEnd = p1;} - if (u2s1[unit] == u2s[step_unit] || (*start==0 && *end==0) ) return 0; + if (u2s1[unit] == u2s[step_unit] || (*start==0 && *theEnd==0) ) return 0; newstart = (*start) * u2s1[unit]; - newend = (*end) * u2s1[unit]; + newend = (*theEnd) * u2s1[unit]; if (newstart<0 || newend<0) { factor=60; u2sf=u2s1[unit]/factor; if (u2s1[unit] % factor) return GRIB_DECODING_ERROR; newstart = (*start) * u2sf; - newend = (*end) * u2sf; + newend = (*theEnd) * u2sf; u2sf_step_unit=u2s[step_unit]/factor; if (u2s[step_unit] % factor) return GRIB_DECODING_ERROR; } else { @@ -285,7 +285,7 @@ int grib_g1_step_get_steps(grib_accessor* a,long* start,long* end) { return GRIB_DECODING_ERROR; } else { *start = newstart/u2sf_step_unit; - *end = newend/u2sf_step_unit; + *theEnd = newend/u2sf_step_unit; } return 0; @@ -295,14 +295,14 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) { grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; char buf[100]; size_t size=0; - long start=0,end=0; + long start=0,theEnd=0; long timeRangeIndicator=0; long unit; int err=0; char stepType[20]={0,}; size_t stepTypeLen=20; - if ((err=grib_g1_step_get_steps(a,&start,&end))!=GRIB_SUCCESS) { + if ((err=grib_g1_step_get_steps(a,&start,&theEnd))!=GRIB_SUCCESS) { size_t step_unit_string_len=10; char step_unit_string[10]; @@ -353,12 +353,12 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) { (strcmp(stepType,"diff") == 0) ) { - if(start == end) { - sprintf(buf,"%ld",end); + if(start == theEnd) { + sprintf(buf,"%ld",theEnd); } else { - sprintf(buf,"%ld-%ld",start, end); + sprintf(buf,"%ld-%ld",start, theEnd); } } else { @@ -377,7 +377,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) { return GRIB_SUCCESS; } -int grib_g1_step_apply_units(long *start,long *end,long* step_unit, +int grib_g1_step_apply_units(long *start,long *theEnd,long* step_unit, long *P1,long *P2,long* unit, const int max,const int instant) { int j=0; @@ -407,7 +407,7 @@ int grib_g1_step_apply_units(long *start,long *end,long* step_unit, } } else { - end_sec=*end*u2s[*step_unit]; + end_sec=*theEnd*u2s[*step_unit]; *unit=units_index[0]; for (j=index;jparent->h; long timeRangeIndicator=0,P1=0,P2=0; - long start=0,end=-1,unit=0,ounit=0,step_unit=1; + long start=0,theEnd=-1,unit=0,ounit=0,step_unit=1; int ret=0; long end_sec,start_sec; char *p=NULL,*q=NULL; @@ -465,16 +465,16 @@ static int pack_string(grib_accessor* a, const char* val, size_t *len){ ounit=unit; start=strtol(val, &p,10); - end=start; - if ( *p!=0 ) end=strtol(++p, &q,10); + theEnd=start; + if ( *p!=0 ) theEnd=strtol(++p, &q,10); - if (start==0 && end==0) { + if (start==0 && theEnd==0) { if((ret = grib_set_long_internal(h,self->p1,start)) != GRIB_SUCCESS) return ret; - ret = grib_set_long_internal(h,self->p2,end); + ret = grib_set_long_internal(h,self->p2,theEnd); return ret; } - end_sec=end*u2s[step_unit]; + end_sec=theEnd*u2s[step_unit]; start_sec=start*u2s[step_unit]; if ( ( end_sec > 918000 || start_sec > 918000 ) && @@ -490,15 +490,15 @@ static int pack_string(grib_accessor* a, const char* val, size_t *len){ if (timeRangeIndicator == 10) { long off=0; grib_accessor* p1_accessor=NULL; - if ( end != start && !h->context->gribex_mode_on) { + if ( theEnd != start && !h->context->gribex_mode_on) { if ( h->context->gribex_mode_on==0 ) { grib_context_log(h->context,GRIB_LOG_ERROR, "Unable to set %s: end must be equal to start when timeRangeIndicator=10", a->name); return GRIB_WRONG_STEP; - } else start = end; + } else start = theEnd; } - if ((ret=grib_g1_step_apply_units(&start,&end,&step_unit,&P1,&P2,&unit,65535,instant)) + if ((ret=grib_g1_step_apply_units(&start,&theEnd,&step_unit,&P1,&P2,&unit,65535,instant)) !=GRIB_SUCCESS) { grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find units to set %s=%s",a->name,val); return ret; @@ -519,7 +519,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t *len){ return ret; } - if ( (ret=grib_g1_step_apply_units(&start,&end,&step_unit,&P1,&P2,&unit,255,instant)) + if ( (ret=grib_g1_step_apply_units(&start,&theEnd,&step_unit,&P1,&P2,&unit,255,instant)) !=GRIB_SUCCESS ) { if (instant || h->context->gribex_mode_on) { @@ -530,14 +530,14 @@ static int pack_string(grib_accessor* a, const char* val, size_t *len){ /* TODO move to the def file*/ if((ret = grib_set_long_internal(h,"timeRangeIndicatorFromStepRange",10))) return ret; - if (end != start && !h->context->gribex_mode_on) { + if (theEnd != start && !h->context->gribex_mode_on) { grib_context_log(h->context,GRIB_LOG_ERROR, "Unable to set %s: end must be equal to start when timeRangeIndicator=10", a->name); return GRIB_WRONG_STEP; - } else start=end; + } else start=theEnd; - if ((ret=grib_g1_step_apply_units(&start,&end,&step_unit,&P1,&P2,&unit,65535,instant)) + if ((ret=grib_g1_step_apply_units(&start,&theEnd,&step_unit,&P1,&P2,&unit,65535,instant)) !=GRIB_SUCCESS) { grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find units to set %s=%s",a->name,val); return ret; @@ -569,7 +569,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t *len){ return ret; self->v[0]=start; - self->v[1]=end; + self->v[1]=theEnd; a->dirty=0; return 0; @@ -656,7 +656,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len) { grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; char buff[100]; size_t bufflen=100; - long start,end; + long start,theEnd; char* p=buff; char* q=NULL; int err=0; @@ -666,14 +666,14 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len) { return err; start=strtol(buff, &p,10); - end=start; - if ( *p!=0 ) end=strtol(++p, &q,10); + theEnd=start; + if ( *p!=0 ) theEnd=strtol(++p, &q,10); if (self->pack_index==1) *val=start; - else *val=end; + else *val=theEnd; self->v[0]=start; - self->v[1]=end; + self->v[1]=theEnd; a->dirty=0; return 0; diff --git a/src/grib_accessor_class_g2_mars_labeling.c b/src/grib_accessor_class_g2_mars_labeling.c index 91391ccce..ff24a664d 100644 --- a/src/grib_accessor_class_g2_mars_labeling.c +++ b/src/grib_accessor_class_g2_mars_labeling.c @@ -235,51 +235,51 @@ static int extra_set(grib_accessor* a,long val) { case 1: /* type */ switch (val) { - case 0: /* Unknown (0) */ + case 0: /* Unknown (0) */ typeOfProcessedData=255; typeOfGeneratingProcess=255; break; - case 1: /* First guess (fg) */ - case 3: /* Initialised analysis (ia) */ + case 1: /* First guess (fg) */ + case 3: /* Initialised analysis (ia) */ typeOfProcessedData=0; typeOfGeneratingProcess=1; break; - case 2: /* Analysis (an) */ - case 4: /* Oi analysis (oi) */ - case 5: /* 3d variational analysis (3v) */ - case 6: /* 4d variational analysis (4v) */ - case 7: /* 3d variational gradients (3g) */ - case 8: /* 4d variational gradients (4g) */ + case 2: /* Analysis (an) */ + case 4: /* Oi analysis (oi) */ + case 5: /* 3d variational analysis (3v) */ + case 6: /* 4d variational analysis (4v) */ + case 7: /* 3d variational gradients (3g) */ + case 8: /* 4d variational gradients (4g) */ typeOfProcessedData=0; typeOfGeneratingProcess=0; break; - case 9: /* Forecast (fc) */ + case 9: /* Forecast (fc) */ typeOfProcessedData=1; typeOfGeneratingProcess=2; break; - case 10: /* Control forecast (cf) */ + case 10: /* Control forecast (cf) */ typeOfProcessedData=3; typeOfGeneratingProcess=4; break; - case 11: /* Perturbed forecast (pf) */ + case 11: /* Perturbed forecast (pf) */ typeOfProcessedData=4; typeOfGeneratingProcess=4; break; - case 12: /* Errors in first guess (ef) */ + case 12: /* Errors in first guess (ef) */ case 13: /* Errors in analysis (ea) */ typeOfProcessedData=255; typeOfGeneratingProcess=7; break; - case 14: /* Cluster means (cm) */ + case 14: /* Cluster means (cm) */ case 15: /* Cluster std deviations (cs) */ typeOfProcessedData=255; typeOfGeneratingProcess=4; break; - case 16: /* Forecast probability (fp) */ + case 16: /* Forecast probability (fp) */ typeOfProcessedData=8; typeOfGeneratingProcess=5; break; - case 17: /* Ensemble mean (em) */ + case 17: /* Ensemble mean (em) */ derivedForecast=0; grib_get_string(a->parent->h,self->stepType,stepType,&stepTypelen); if (!strcmp(stepType,"instant")) { @@ -301,72 +301,74 @@ static int extra_set(grib_accessor* a,long val) { typeOfProcessedData=255; typeOfGeneratingProcess=4; break; - case 19: /* Forecast accumulation (fa) */ - case 20: /* Climatology (cl) */ - case 21: /* Climate simulation (si) */ - case 22: /* Climate 30 days simulation (s3) */ - case 23: /* Empirical distribution (ed) */ - case 24: /* Tubes (tu) */ - case 25: /* Flux forcing realtime (ff) */ - case 26: /* Ocean forward (of) */ - case 27: /* Extreme forecast index (efi) */ - case 28: /* Extreme forecast index control (efic) */ - case 29: /* Probability boundaries (pb) */ + case 19: /* Forecast accumulation (fa) */ + case 20: /* Climatology (cl) */ + case 21: /* Climate simulation (si) */ + case 22: /* Climate 30 days simulation (s3) */ + case 23: /* Empirical distribution (ed) */ + case 24: /* Tubes (tu) */ + case 25: /* Flux forcing realtime (ff) */ + case 26: /* Ocean forward (of) */ + case 27: /* Extreme forecast index (efi) */ + case 28: /* Extreme forecast index control (efic)*/ + case 29: /* Probability boundaries (pb) */ typeOfProcessedData=255; typeOfGeneratingProcess=255; break; - case 30: /* Event probability (ep) */ + case 30: /* Event probability (ep) */ typeOfProcessedData=8; typeOfGeneratingProcess=5; break; - case 31: /* Bias-corrected Forecast (bf) */ + case 31: /* Bias-corrected Forecast (bf) */ typeOfProcessedData=1; typeOfGeneratingProcess=3; break; - case 32: /* Climate distribution (cd) */ - case 33: /* 4D analysis increments (4i) */ - case 34: /* Gridded observations (go) */ - case 35: /* Model errors (me) */ - case 36: /* Probability distribution (pd) */ - case 37: /* Cluster information (ci) */ - case 38: /* Shift of Tail (sot) */ - case 40: /* Images (im) */ - case 42: /* Simulated images (sim) */ + case 32: /* Climate distribution (cd) */ + case 33: /* 4D analysis increments (4i) */ + case 34: /* Gridded observations (go) */ + case 35: /* Model errors (me) */ + case 36: /* Probability distribution (pd) */ + case 37: /* Cluster information (ci) */ + case 38: /* Shift of Tail (sot) */ + case 40: /* Images (im) */ + case 42: /* Simulated images (sim) */ typeOfProcessedData=255; typeOfGeneratingProcess=255; break; - case 43: /* Weighted ensemble mean (wem) */ - case 44: /* Weighted ensemble standard deviation (wes) */ - case 45: /* Cluster representative (cr) */ - case 46: /* Scaled ensemble standard deviation (ses) */ + case 43: /* Weighted ensemble mean (wem) */ + case 44: /* Weighted ensemble standard deviation (wes) */ + case 45: /* Cluster representative (cr) */ + case 46: /* Scaled ensemble standard deviation (ses) */ + case 47: /* Time average ensemble mean (taem) */ + case 48: /* Time average ensemble standard deviation (taes) */ typeOfProcessedData=255; typeOfGeneratingProcess=4; break; - case 50: /* Sensitivity gradient (sg) */ - case 52: /* Sensitivity forecast (sf) */ - case 60: /* Perturbed analysis (pa) */ - case 61: /* Initial condition perturbation (icp) */ - case 62: /* Singular vector (sv) */ - case 63: /* Adjoint singular vector (as) */ - case 64: /* Signal variance (svar) */ + case 50: /* Sensitivity gradient (sg) */ + case 52: /* Sensitivity forecast (sf) */ + case 60: /* Perturbed analysis (pa) */ + case 61: /* Initial condition perturbation (icp) */ + case 62: /* Singular vector (sv) */ + case 63: /* Adjoint singular vector (as) */ + case 64: /* Signal variance (svar) */ typeOfProcessedData=255; typeOfGeneratingProcess=255; break; - case 65: /* Calibration/Validation forecast (cv) */ + case 65: /* Calibration/Validation forecast (cv) */ typeOfProcessedData=5; typeOfGeneratingProcess=4; break; - case 70: /* Ocean reanalysis (or) */ - case 71: /* Flux forcing (fx) */ - case 80: /* Forecast mean (fcmean) */ - case 81: /* Forecast maximum (fcmax) */ - case 82: /* Forecast minimum (fcmin) */ - case 83: /* Forecast standard deviation (fcstdev) */ + case 70: /* Ocean reanalysis (or) */ + case 71: /* Flux forcing (fx) */ + case 80: /* Forecast mean (fcmean) */ + case 81: /* Forecast maximum (fcmax) */ + case 82: /* Forecast minimum (fcmin) */ + case 83: /* Forecast standard deviation (fcstdev) */ typeOfProcessedData=255; typeOfGeneratingProcess=255; break; - case 84: /* Ensemble mean of temporal mean (emtm) */ - case 85: /* Ensemble standard deviation of temporal mean (estdtm) */ + case 84: /* Ensemble mean of temporal mean (emtm) */ + case 85: /* Ensemble standard deviation of temporal mean (estdtm) */ typeOfProcessedData=255; typeOfGeneratingProcess=4; break; diff --git a/src/grib_accessor_class_g2step_range.c b/src/grib_accessor_class_g2step_range.c index fb57609fe..702b89bb8 100644 --- a/src/grib_accessor_class_g2step_range.c +++ b/src/grib_accessor_class_g2step_range.c @@ -155,7 +155,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) { char buf[100]; int ret=0; size_t size=0; - long start=0,end=0; + long start=0,theEnd=0; ret = grib_get_long_internal(h,self->startStep,&start); if (ret) return ret; @@ -163,16 +163,16 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) { if (self->endStep==NULL) { sprintf(buf,"%ld",start); } else { - ret = grib_get_long_internal(h,self->endStep,&end); + ret = grib_get_long_internal(h,self->endStep,&theEnd); if (ret) return ret; - if(start == end) + if(start == theEnd) { - sprintf(buf,"%ld",end); + sprintf(buf,"%ld",theEnd); } else { - sprintf(buf,"%ld-%ld",start,end); + sprintf(buf,"%ld-%ld",start,theEnd); } } @@ -191,19 +191,19 @@ static int pack_string(grib_accessor* a, const char* val, size_t *len){ grib_accessor_g2step_range* self = (grib_accessor_g2step_range*)a; grib_handle* h=a->parent->h; - long start=0,end=-1; + long start=0,theEnd=-1; int ret=0; char *p=NULL,*q=NULL; start=strtol(val, &p,10); - end=start; + theEnd=start; - if ( *p!=0 ) end=strtol(++p, &q,10); + if ( *p!=0 ) theEnd=strtol(++p, &q,10); ret=grib_set_long_internal(h,self->startStep,start); if (ret) return ret; if(self->endStep!=NULL) { - ret=grib_set_long_internal(h,self->endStep,end); + ret=grib_set_long_internal(h,self->endStep,theEnd); } return 0; @@ -231,7 +231,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t *len) static int unpack_long(grib_accessor* a, long* val, size_t *len) { char buff[100]; size_t bufflen=100; - long start,end; + long start,theEnd; char* p=buff; char* q=NULL; int err=0; @@ -241,10 +241,10 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len) { return err; start=strtol(buff, &p,10); - end=start; - if ( *p!=0 ) end=strtol(++p, &q,10); + theEnd=start; + if ( *p!=0 ) theEnd=strtol(++p, &q,10); - *val=end; + *val=theEnd; return 0; } diff --git a/src/grib_accessor_class_laplacian.c b/src/grib_accessor_class_laplacian.c index 5475c361f..8eab03b1d 100644 --- a/src/grib_accessor_class_laplacian.c +++ b/src/grib_accessor_class_laplacian.c @@ -188,7 +188,7 @@ static int unpack_double (grib_accessor* a, double* val, size_t *len) static int pack_long(grib_accessor* a, const long* val, size_t *len) { - double dval=(const double)*val; + const double dval=(double)*val; return pack_double(a, &dval,len); } diff --git a/src/grib_accessor_class_long.c b/src/grib_accessor_class_long.c index dbdaef3c4..af0aae786 100644 --- a/src/grib_accessor_class_long.c +++ b/src/grib_accessor_class_long.c @@ -265,9 +265,9 @@ static int compare(grib_accessor* a,grib_accessor* b) { static int pack_string(grib_accessor* a, const char* val, size_t *len) { - char* end=NULL; - long v=strtol(val,&end,10); - if (end) { + char* theEnd=NULL; + long v=strtol(val,&theEnd,10); + if (theEnd) { grib_context_log(a->parent->h->context,GRIB_LOG_ERROR,"trying to pack \"%s\" as long",val); return GRIB_WRONG_TYPE; } diff --git a/src/grib_accessor_class_mars_param.c b/src/grib_accessor_class_mars_param.c index 605fa54b0..3157a2fe6 100644 --- a/src/grib_accessor_class_mars_param.c +++ b/src/grib_accessor_class_mars_param.c @@ -16,7 +16,7 @@ CLASS = accessor SUPER = grib_accessor_class_ascii IMPLEMENTS = pack_string;unpack_string - IMPLEMENTS = init + IMPLEMENTS = init; string_length MEMBERS= const char* paramId MEMBERS= const char* table MEMBERS= const char* param @@ -36,6 +36,7 @@ or edit "accessor.class" and rerun ./make_class.pl static int pack_string(grib_accessor*, const char*, size_t *len); static int unpack_string (grib_accessor*, char*, size_t *len); +static size_t string_length(grib_accessor*); static void init(grib_accessor*,const long, grib_arguments* ); static void init_class(grib_accessor_class*); @@ -62,7 +63,7 @@ static grib_accessor_class _grib_accessor_class_mars_param = { 0, /* free mem */ 0, /* describes himself */ 0, /* get length of section */ - 0, /* get length of string */ + &string_length, /* get length of string */ 0, /* get number of values */ 0, /* get number of bytes */ 0, /* get offset to bytes */ @@ -99,7 +100,6 @@ static void init_class(grib_accessor_class* c) { c->dump = (*(c->super))->dump; c->next_offset = (*(c->super))->next_offset; - c->string_length = (*(c->super))->string_length; c->value_count = (*(c->super))->value_count; c->byte_count = (*(c->super))->byte_count; c->byte_offset = (*(c->super))->byte_offset; @@ -195,3 +195,8 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) return GRIB_SUCCESS; } +static size_t string_length(grib_accessor* a) +{ + return 7; +} + diff --git a/src/grib_accessor_class_md5.c b/src/grib_accessor_class_md5.c index 87997b98d..687c85c1e 100644 --- a/src/grib_accessor_class_md5.c +++ b/src/grib_accessor_class_md5.c @@ -188,7 +188,10 @@ static int unpack_string(grib_accessor*a , char* v, size_t *len){ while (blacklist && blacklist->value) { b=grib_find_accessor(a->parent->h,blacklist->value); - if (!b) return GRIB_NOT_FOUND; + if (!b) { + grib_context_free(a->parent->h->context,mess); + return GRIB_NOT_FOUND; + } p=mess+b->offset-offset; for (i=0;ilength;i++) *(p++)=0; @@ -199,6 +202,7 @@ static int unpack_string(grib_accessor*a , char* v, size_t *len){ grib_md5_init(&md5c); grib_md5_add(&md5c,mess,mess_len); grib_md5_end(&md5c,v); + grib_context_free(a->parent->h->context,mess); return ret; } diff --git a/src/grib_accessor_class_nearest.c b/src/grib_accessor_class_nearest.c index 868a22140..7e5d0cde6 100644 --- a/src/grib_accessor_class_nearest.c +++ b/src/grib_accessor_class_nearest.c @@ -8,13 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - - #include "grib_api_internal.h" /* This is used by make_class.pl diff --git a/src/grib_accessor_class_number_of_points.c b/src/grib_accessor_class_number_of_points.c index 42a2b5b5b..169ac4566 100644 --- a/src/grib_accessor_class_number_of_points.c +++ b/src/grib_accessor_class_number_of_points.c @@ -175,6 +175,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len) grib_get_long_array_internal(a->parent->h,self->pl,pl, &plsize); *val=0; for (i=0;iparent->h->context,sizeof(double)*size); if((ret = grib_get_double_array_internal(a->parent->h,self->bitmap,bitmap,&size)) - != GRIB_SUCCESS) return ret; + != GRIB_SUCCESS) { + grib_context_free(a->parent->h->context,bitmap); + return ret; + } *val=0; for (i=0;iparent->h,self->expression,&end); + grib_expression_evaluate_long(a->parent->h,self->expression,&theEnd); - length = end - a->offset; + length = theEnd - a->offset; /* printf("preferred_size: prefered: %ld current:%ld %s %s %ld\n", (long)length,(long)a->length,a->cclass->name,a->name,(long)a->offset); */ diff --git a/src/grib_accessor_class_scale.c b/src/grib_accessor_class_scale.c index f5c4e24a3..9ba78148d 100644 --- a/src/grib_accessor_class_scale.c +++ b/src/grib_accessor_class_scale.c @@ -185,7 +185,7 @@ static int unpack_double (grib_accessor* a, double* val, size_t *len) static int pack_long(grib_accessor* a, const long* val, size_t *len) { - double dval=(const double)*val; + const double dval=(double)*val ; return pack_double(a, &dval,len); } diff --git a/src/grib_accessor_class_sprintf.c b/src/grib_accessor_class_sprintf.c index 21feab7dd..ff22fd5cf 100644 --- a/src/grib_accessor_class_sprintf.c +++ b/src/grib_accessor_class_sprintf.c @@ -168,11 +168,11 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) int precision=999; i++; if (uname[i]=='.') { - char *end=NULL,*start; + char *theEnd=NULL,*start; start=(char*)&(uname[++i]); - precision=strtol(start,&end,10); - Assert(*end!=0); - while (uname[i] != *end) i++; + precision=strtol(start,&theEnd,10); + Assert(*theEnd!=0); + while (uname[i] != *theEnd) i++; } switch(uname[i]){ diff --git a/src/grib_accessor_classes_hash.c b/src/grib_accessor_classes_hash.c index e1e677ed3..180ecab91 100644 --- a/src/grib_accessor_classes_hash.c +++ b/src/grib_accessor_classes_hash.c @@ -2,6 +2,16 @@ /* Command-line: gperf -W classes -t -G -H grib_accessor_classes_get_id -N grib_accessor_classes_hash -m 1 -j 1 accessor_class_list.gperf */ /* Computed positions: -k'2-3,7,11' */ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ diff --git a/src/grib_api.h b/src/grib_api.h index 6c62ae994..e9e2c178b 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -26,7 +26,9 @@ extern "C" { #include #include #include +#ifndef _WIN32 #include +#endif #include #define GRIB_API_VERSION (GRIB_API_MAJOR_VERSION*10000+GRIB_API_MINOR_VERSION*100+GRIB_API_REVISION_VERSION) @@ -40,7 +42,7 @@ extern "C" { /* LOG MODES -Log mode for information for processiong information +Log mode for information for processing information */ /* Log mode for info */ #define GRIB_LOG_INFO 0 @@ -66,7 +68,7 @@ Log mode for information for processiong information #define GRIB_TYPE_BYTES 4 /* section */ #define GRIB_TYPE_SECTION 5 -/* labe */ +/* label */ #define GRIB_TYPE_LABEL 6 /* missing */ #define GRIB_TYPE_MISSING 7 @@ -274,7 +276,7 @@ int grib_index_get_size(grib_index* index,const char* key,size_t* size); * * @param index : an index created from a file. * The index must have been created with the key in argument. - * @param key : key for wich the values are returned + * @param key : key for which the values are returned * @param values : array of values. The array must be allocated before entering this function and its size must be enough to contain all the values. * @param size : size of the values array * @return 0 if OK, integer value on error @@ -287,7 +289,7 @@ int grib_index_get_long(grib_index* index,const char* key, * * @param index : an index created from a file. * The index must have been created with the key in argument. - * @param key : key for wich the values are returned + * @param key : key for which the values are returned * @param values : array of values. The array must be allocated before entering this function and its size must be enough to contain all the values. * @param size : size of the values array * @return 0 if OK, integer value on error @@ -300,7 +302,7 @@ int grib_index_get_double(grib_index* index,const char* key, * * @param index : an index created from a file. * The index must have been created with the key in argument. - * @param key : key for wich the values are returned + * @param key : key for which the values are returned * @param values : array of values. The array must be allocated before entering this function and its size must be enough to contain all the values. * @param size : size of the values array * @return 0 if OK, integer value on error @@ -369,7 +371,7 @@ The grib_handle is the structure giving access to parsed grib values by keys. /** * Counts the messages contained in a file resource. * -* @param c : the context from wich the handle will be created (NULL for default context) +* @param c : the context from which the handle will be created (NULL for default context) * @param f : the file resource * @param n : the number of messages in the file * @return 0 if OK, integer value on error @@ -382,7 +384,7 @@ int grib_count_in_file(grib_context* c, FILE* f,int* n); * Remember always to delete the handle when it is not needed any more to avoid * memory leaks. * -* @param c : the context from wich the handle will be created (NULL for default context) +* @param c : the context from which the handle will be created (NULL for default context) * @param f : the file resource * @param error : error code set if the returned handle is NULL and the end of file is not reached * @return the new handle, NULL if the resource is invalid or a problem is encountered @@ -396,7 +398,7 @@ grib_handle* grib_handle_headers_only_new_from_file (grib_context* c, FILE* * Remember always to delete the handle when it is not needed any more to avoid * memory leaks. * -* @param c : the context from wich the handle will be created (NULL for default context) +* @param c : the context from which the handle will be created (NULL for default context) * @param file : the file name * @param error : error code set if the returned handle is NULL and the end of file is not reached * @return the new handle, NULL if the resource is invalid or a problem is encountered @@ -451,7 +453,7 @@ grib_handle* grib_handle_new_from_multi_message(grib_context* c,void** data, /** * Create a handle from a user message. The message is copied and will be freed with the handle * -* @param c : the context from wich the handle will be created (NULL for default context) +* @param c : the context from which the handle will be created (NULL for default context) * @param data : the actual message * @param data_len : the length of the message in number of bytes * @return the new handle, NULL if the message is invalid or a problem is encountered @@ -463,7 +465,7 @@ grib_handle* grib_handle_new_from_message_copy(grib_context* c, const void* data * Create a handle from a read_only template resource. * The message is copied at the creation of the handle * -* @param c : the context from wich the handle will be created (NULL for default context) +* @param c : the context from which the handle will be created (NULL for default context) * @param res_name : the resource name * @return the new handle, NULL if the resource is invalid or a problem is encountered */ @@ -473,7 +475,7 @@ grib_handle* grib_handle_new_from_template (grib_context* c, const char* res_nam * Create a handle from a message contained in a samples directory. * The message is copied at the creation of the handle * - * @param c : the context from wich the handle will be created (NULL for default context) + * @param c : the context from which the handle will be created (NULL for default context) * @param res_name : the resource name * @return the new handle, NULL if the resource is invalid or a problem is encountered */ @@ -503,7 +505,7 @@ int grib_handle_delete (grib_handle* h); * Remember always to delete the multi handle when it is not needed any more to avoid * memory leaks. * - * @param c : the context from wich the handle will be created (NULL for default context) + * @param c : the context from which the handle will be created (NULL for default context) */ grib_multi_handle* grib_multi_handle_new (grib_context* c); @@ -546,7 +548,7 @@ int grib_multi_handle_write(grib_multi_handle* mh,FILE* f); /** * getting the message attached to a handle * -* @param h : the grib handle to wich the buffer should be gathered +* @param h : the grib handle to which the buffer should be gathered * @param message : the pointer to be set to the handle's data * @param message_length : at exist, the message size in number of bytes * @return 0 if OK, integer value on error @@ -557,7 +559,7 @@ int grib_get_message(grib_handle* h ,const void** message, size_t *message_lengt /** * getting a copy of the message attached to a handle * -* @param h : the grib handle to wich the buffer should be returned +* @param h : the grib handle to which the buffer should be returned * @param message : the pointer to the data buffer to be filled * @param message_length : at entry, the size in number of bytes of the allocated empty message. * At exist, the actual message length in number of bytes @@ -639,7 +641,7 @@ grib_nearest* grib_nearest_new (grib_handle* h, int* error); * The flags are provided to speed up the process of searching. If you are * sure that the point you are asking for is not changing from a call * to another you can use GRIB_NEAREST_SAME_POINT. The same is valid for -* the grid. Flags can be used together duing an or. +* the grid. Flags can be used together doing an or. * * @param nearest : nearest structure * @param h : handle from which geography and data values are taken @@ -735,7 +737,7 @@ int grib_get_length(grib_handle* h, const char* key,size_t *length); * * @param h : the handle to get the data from * @param key : the key to be searched -* @param value : the address of a long where the data will be retreived +* @param value : the address of a long where the data will be retrieved * @return 0 if OK, integer value on error */ int grib_get_long (grib_handle* h, const char* key, long* value ); @@ -746,7 +748,7 @@ int grib_get_long (grib_handle* h, const char* key, long* val * * @param h : the handle to get the data from * @param key : the key to be searched -* @param value : the address of a double where the data will be retreived +* @param value : the address of a double where the data will be retrieved * @return 0 if OK, integer value on error */ int grib_get_double (grib_handle* h, const char* key, double* value ); @@ -757,7 +759,7 @@ int grib_get_double (grib_handle* h, const char* key, double* value * @param h : the handle to get the data from * @param key : the key to be searched * @param i : zero based index -* @param value : the address of a double where the data will be retreived +* @param value : the address of a double where the data will be retrieved * @return 0 if OK, integer value on error */ int grib_get_double_element(grib_handle* h, const char* key, int i, double* value ); @@ -769,7 +771,7 @@ int grib_get_double_element(grib_handle* h, const char* key, int i, double* valu * @param key : the key to be searched * @param i : zero based array of indexes * @param size : size of the i and value arrays -* @param value : the address of a double where the data will be retreived +* @param value : the address of a double where the data will be retrieved * @return 0 if OK, integer value on error */ int grib_get_double_elements(grib_handle* h, const char* key, int* i, long size,double* value); @@ -780,7 +782,7 @@ int grib_get_double_elements(grib_handle* h, const char* key, int* i, long size, * * @param h : the handle to get the data from * @param key : the key to be searched -* @param mesg : the address of a string where the data will be retreived +* @param mesg : the address of a string where the data will be retrieved * @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output * @return 0 if OK, integer value on error */ @@ -792,7 +794,7 @@ int grib_get_string (grib_handle* h, const char* key, char* mesg, * * @param h : the handle to get the data from * @param key : the key to be searched -* @param bytes : the address of a byte array where the data will be retreived +* @param bytes : the address of a byte array where the data will be retrieved * @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output * @return 0 if OK, integer value on error */ @@ -803,7 +805,7 @@ int grib_get_bytes (grib_handle* h, const char* key, unsigned char* byte * * @param h : the handle to get the data from * @param key : the key to be searched -* @param vals : the address of a double array where the data will be retreived +* @param vals : the address of a double array where the data will be retrieved * @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output * @return 0 if OK, integer value on error */ @@ -815,7 +817,7 @@ int grib_get_double_array (grib_handle* h, const char* key, double* vals, * * @param h : the handle to get the data from * @param key : the key to be searched -* @param vals : the address of a long array where the data will be retreived +* @param vals : the address of a long array where the data will be retrieved * @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output * @return 0 if OK, integer value on error */int grib_get_long_array (grib_handle* h, const char* key, long* vals, size_t *length ); @@ -929,7 +931,7 @@ void grib_get_all_names(grib_handle* h,char* names); * Print all keys from the parsed definition files available in a context * * @param f : the File used to print the keys on -* @param c : the context that containd the cached definition files to be printed +* @param c : the context that contains the cached definition files to be printed */ void grib_dump_action_tree(grib_context* c, FILE* f) ; @@ -952,7 +954,7 @@ typedef void (*grib_free_proc) (const grib_context* c, void* data); * Grib malloc procedure, format of a procedure referenced in the context that is used to allocate memory * @param c : the context where the memory allocation will apply * @param length : length to be allocated in number of bytes -* @return a pointer to the alocated memory, NULL if no memory can be allocated +* @return a pointer to the allocated memory, NULL if no memory can be allocated * must match @see grib_free_proc */ typedef void* (*grib_malloc_proc) (const grib_context* c, size_t length); @@ -962,7 +964,7 @@ typedef void* (*grib_malloc_proc) (const grib_context* c, size_t length); * @param c : the context where the memory allocation will apply * @param data : pointer to the data to be reallocated * @param length : length to be allocated in number of bytes -* @return a pointer to the alocated memory +* @return a pointer to the allocated memory */ typedef void* (*grib_realloc_proc) (const grib_context* c, void* data, size_t length); @@ -1061,7 +1063,7 @@ grib_context* grib_context_new (grib_context* c); void grib_context_delete (grib_context* c); /** -* Set the gts header mode on. +* Set the GTS header mode on. * The GTS headers will be preserved. * * @param c : the context @@ -1069,7 +1071,7 @@ void grib_context_delete (grib_context* c); void grib_gts_header_on(grib_context* c) ; /** -* Set the gts header mode off. +* Set the GTS header mode off. * The GTS headers will be deleted. * * @param c : the context @@ -1077,23 +1079,23 @@ void grib_gts_header_on(grib_context* c) ; void grib_gts_header_off(grib_context* c); /** -* Set the gribex mode on. -* Grib files will be compatible with gribex. +* Set the GRIBEX mode on. +* Grib files will be compatible with GRIBEX. * * @param c : the context */ void grib_gribex_mode_on(grib_context* c); /** -* Get the gribex mode. +* Get the GRIBEX mode. * * @param c : the context */ int grib_get_gribex_mode ( grib_context* c); /** -* Set the gribex mode off. -* Grib files won't be always compatible with gribex. +* Set the GRIBEX mode off. +* GRIB files won't be always compatible with GRIBEX. * * @param c : the context */ @@ -1111,7 +1113,7 @@ void grib_context_set_user_data (grib_context* c, void* /** * get userData from a context * -* @param c : the context from which the user data will be retreived +* @param c : the context from which the user data will be retrieved * @return the user data referenced in the context */ void* grib_context_get_user_data (grib_context* c); @@ -1177,17 +1179,25 @@ void grib_multi_support_on(grib_context* c); * @param c : the context to be modified */ void grib_multi_support_off(grib_context* c); + +/** +* Reset file handle in multiple field support mode +* +* @param c : the context to be modified +* @param f : the file pointer +*/ +void grib_multi_support_reset_file(grib_context* c, FILE* f); /*! @} */ /** -* Get the api version +* Get the API version * -* @return api version +* @return API version */ long grib_get_api_version(void); /** -* Prints the api version +* Prints the API version * * */ @@ -1199,11 +1209,11 @@ Key names on which the iteration is carried out can be filtered through their attributes or by the namespace they belong to. */ /*! @{ */ -/*! Create a new iterator from a valid and initialized handle. +/*! Create a new iterator from a valid and initialised handle. * @param h : the handle whose keys you want to iterate * @param filter_flags : flags to filter out some of the keys through their attributes * @param name_space : if not null the iteration is carried out only on -* keys belongin to the namespace passed. (NULL for all the keys) +* keys belonging to the namespace passed. (NULL for all the keys) * @return keys iterator ready to iterate through keys according to filter_flags * and namespace */ @@ -1211,7 +1221,7 @@ grib_keys_iterator* grib_keys_iterator_new(grib_handle* h,unsigned long filter_f /*! Step to the next iterator. * @param kiter : valid grib_keys_iterator -* @return 1 if next iterator exitsts, 0 if no more elements to iterate on +* @return 1 if next iterator exists, 0 if no more elements to iterate on */ int grib_keys_iterator_next(grib_keys_iterator *kiter); @@ -1278,11 +1288,14 @@ int wmo_read_grib_from_file(FILE* f,void* buffer,size_t* len); int wmo_read_bufr_from_file(FILE* f,void* buffer,size_t* len); int wmo_read_gts_from_file(FILE* f,void* buffer,size_t* len); int wmo_read_any_from_stream(void *stream_data, long (*stream_proc )(void *, void *buffer, long len ), void *buffer, size_t *len); -void *wmo_read_any_from_file_malloc(FILE *f,size_t *size,int *err); -void *wmo_read_gts_from_file_malloc(FILE* f,size_t *size,int* err); -void *wmo_read_bufr_from_file_malloc(FILE* f,size_t *size,int* err); -grib_handle* grib_gts_handle_new_from_file ( grib_context* c, FILE* f,int *error ); -grib_handle* grib_bufr_handle_new_from_file ( grib_context* c, FILE* f,int *error ); +void *wmo_read_any_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err); +void *wmo_read_gts_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err); +void *wmo_read_bufr_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err); +grib_handle* eccode_gts_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ); +grib_handle* eccode_bufr_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ); +grib_handle* eccode_grib_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ); +int grib_get_message_offset ( grib_handle* h,off_t* offset ); +int grib_get_message_size ( grib_handle* h,size_t* size ); struct grib_points { grib_context* context; diff --git a/src/grib_api_internal.h b/src/grib_api_internal.h index cf8dae1bb..95dc735eb 100644 --- a/src/grib_api_internal.h +++ b/src/grib_api_internal.h @@ -59,13 +59,58 @@ extern "C" { #include #include #include -#include -#include + +#ifndef _WIN32 +# include +# include +# include +#else +/* Microsoft Windows Visual Studio support */ +# include +# include + +/* Replace Unix rint() for Windows */ +double rint(double x); + +/* define version numbers here on Windows */ +#define GRIB_API_MAJOR_VERSION 2 +#define GRIB_API_MINOR_VERSION 0 +#define GRIB_API_REVISION_VERSION 0 + +#ifndef S_ISREG + #define S_ISREG(mode) (mode & S_IFREG) +#endif + +#ifndef S_ISDIR + #define S_ISDIR(mode) (mode & S_IFDIR) +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#define R_OK 04 /* Needed for Windows */ + +# ifndef F_OK +# define F_OK 0 +# endif + +# define mkdir(dirname,mode) _mkdir(dirname) + +# ifdef _MSC_VER +# define access(path,mode) _access(path,mode) +# define chmod(path,mode) _chmod(path,mode) +# define strdup(str) _strdup(str) +# endif + +#endif + + #include #include #include #include -#include + #ifdef HAVE_STRING_H #include @@ -73,7 +118,6 @@ extern "C" { #include #endif - #if GRIB_LINUX_PTHREADS extern int pthread_mutexattr_settype(pthread_mutexattr_t* attr,int type); #endif diff --git a/src/grib_api_prototypes.h b/src/grib_api_prototypes.h index 441334fd8..cc878ba55 100644 --- a/src/grib_api_prototypes.h +++ b/src/grib_api_prototypes.h @@ -1,4 +1,12 @@ - +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ /* action.c */ void grib_dump(grib_action *a, FILE *f, int l); void grib_xref(grib_action *a, FILE *f, const char *path); @@ -674,7 +682,7 @@ long grib_get_api_version(void); void grib_print_api_version(FILE *out); grib_context *grib_context_get_default(void); grib_context *grib_context_new(grib_context *parent); -char *grib_context_full_path(grib_context *c, const char *basename); +char *grib_context_full_defs_path(grib_context *c, const char *basename); void grib_context_free(const grib_context *c, void *p); void grib_context_free_persistent(const grib_context *c, void *p); void grib_context_reset(grib_context *c); @@ -735,7 +743,7 @@ int grib_get_gaussian_latitudes(long trunc, double *lats); /* grib_handle.c */ grib_section *grib_section_create(grib_handle *h, grib_accessor *owner); -void grib_swap_sections(grib_section *old, grib_section *new); +void grib_swap_sections(grib_section *the_old, grib_section *the_new); void grib_empty_section(grib_context *c, grib_section *b); void grib_section_delete(grib_context *c, grib_section *b); int grib_handle_delete(grib_handle *h); @@ -750,10 +758,9 @@ grib_handle *grib_handle_new_from_partial_message(grib_context *c, void *data, s grib_handle *grib_handle_new_from_message(grib_context *c, void *data, size_t buflen); grib_handle *grib_handle_new_from_multi_message(grib_context *c, void **data, size_t *buflen, int *error); grib_handle *grib_handle_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *grib_handle_new_from_nc_file(grib_context *c, const char *file, int *error); -grib_handle *grib_handle_headers_only_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *grib_gts_handle_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *grib_bufr_handle_new_from_file(grib_context *c, FILE *f, int *error); +grib_handle *eccode_grib_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); +grib_handle *eccode_gts_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); +grib_handle *eccode_bufr_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); grib_multi_handle *grib_multi_handle_new(grib_context *c); int grib_multi_handle_delete(grib_multi_handle *h); int grib_multi_handle_append(grib_handle *h, int start_section, grib_multi_handle *mh); @@ -761,6 +768,8 @@ int grib_multi_handle_write(grib_multi_handle *h, FILE *f); int grib_get_partial_message(grib_handle *h, const void **msg, size_t *len, int start_section); int grib_get_partial_message_copy(grib_handle *h, void *message, size_t *len, int start_section); int grib_get_message_copy(grib_handle *h, void *message, size_t *len); +int grib_get_message_offset(grib_handle *h, off_t *offset); +int grib_get_message_size(grib_handle *h, size_t *size); int grib_get_message(grib_handle *h, const void **msg, size_t *size); int grib_get_message_headers(grib_handle *h, const void **msg, size_t *size); grib_handle *grib_handle_new(grib_context *c); @@ -769,6 +778,7 @@ int grib_handle_apply_action(grib_handle *h, grib_action *a); int grib_handle_prepare_action(grib_handle *h, grib_action *a); void grib_multi_support_on(grib_context *c); void grib_multi_support_off(grib_context *c); +void grib_multi_support_reset_file(grib_context* c, FILE* f); void grib_gts_header_on(grib_context *c); void grib_gts_header_off(grib_context *c); int grib_get_gribex_mode(grib_context *c); @@ -799,12 +809,10 @@ int wmo_read_grib_from_file(FILE *f, void *buffer, size_t *len); int wmo_read_bufr_from_file(FILE *f, void *buffer, size_t *len); int wmo_read_gts_from_file(FILE *f, void *buffer, size_t *len); int wmo_read_any_from_stream(void *stream_data, long (*stream_proc )(void *, void *buffer, long len ), void *buffer, size_t *len); -void *wmo_read_gts_from_file_malloc(FILE *f, size_t *size, int *err); -void *wmo_read_any_from_file_malloc(FILE *f, size_t *size, int *err); -void *wmo_read_grib_from_file_malloc(FILE *f, size_t *size, int *err); -void *wmo_read_bufr_from_file_malloc(FILE *f, size_t *size, int *err); -int grib_read_any_headers_only_from_file_alloc(grib_context *ctx, FILE *f, void **buffer, size_t *length, off_t *offset); -int grib_read_any_from_file_alloc(grib_context *ctx, FILE *f, void **buffer, size_t *length); +void *wmo_read_gts_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); +void *wmo_read_any_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); +void *wmo_read_grib_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); +void *wmo_read_bufr_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); int grib_read_any_headers_only_from_file(grib_context *ctx, FILE *f, void *buffer, size_t *len); int grib_read_any_from_file(grib_context *ctx, FILE *f, void *buffer, size_t *len); int grib_read_any_from_memory_alloc(grib_context *ctx, unsigned char **data, size_t *data_length, void **buffer, size_t *length); diff --git a/src/grib_box_class.c b/src/grib_box_class.c index 46d974a2c..72ac01822 100644 --- a/src/grib_box_class.c +++ b/src/grib_box_class.c @@ -8,11 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - */ - - #include "grib_api_internal.h" #define NUMBER(x) (sizeof(x)/sizeof(x[0])) diff --git a/src/grib_box_class_gen.c b/src/grib_box_class_gen.c index 2e4df7b3d..ef5a9f5c8 100644 --- a/src/grib_box_class_gen.c +++ b/src/grib_box_class_gen.c @@ -8,12 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - #include "grib_api_internal.h" diff --git a/src/grib_box_class_reduced_gaussian.c b/src/grib_box_class_reduced_gaussian.c index 9b78399ce..b588c75b6 100644 --- a/src/grib_box_class_reduced_gaussian.c +++ b/src/grib_box_class_reduced_gaussian.c @@ -8,13 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - - #include "grib_api_internal.h" /* diff --git a/src/grib_box_class_regular_gaussian.c b/src/grib_box_class_regular_gaussian.c index 73a56980a..29326e41a 100644 --- a/src/grib_box_class_regular_gaussian.c +++ b/src/grib_box_class_regular_gaussian.c @@ -8,13 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - - #include "grib_api_internal.h" /* diff --git a/src/grib_buffer.c b/src/grib_buffer.c index ec904c0e1..e7cec753e 100644 --- a/src/grib_buffer.c +++ b/src/grib_buffer.c @@ -134,6 +134,8 @@ static void update_offsets_after(grib_accessor* a,long len) } } +#if 0 +/* new GCC compiler v4.5.0 complains function is defined but not used*/ void grib_recompute_sections_lengths(grib_section* s) { if(s) @@ -169,6 +171,8 @@ void grib_recompute_sections_lengths(grib_section* s) } } } +#endif + #if 0 /* new GCC compiler v4.5.0 complains function is defined but not used*/ @@ -179,6 +183,7 @@ static void update_sections_lengths(grib_section* s) if(!s) return; + if(s->aclength) { int ret; @@ -206,9 +211,11 @@ static void update_sections_lengths(grib_section* s) if(s->owner) update_sections_lengths(s->owner->parent); + } #endif + void grib_buffer_replace( grib_accessor *a, const unsigned char* data, size_t newsize,int update_lengths,int update_paddings) { @@ -249,15 +256,11 @@ void grib_buffer_replace( grib_accessor *a, const unsigned char* data, if(update_paddings) grib_update_paddings(a->parent->h->root); } - } - } - - void grib_update_sections_lengths(grib_handle* h) { grib_section_adjust_sizes(h->root,2,0); grib_update_paddings(h->root); diff --git a/src/grib_concept_index.c b/src/grib_concept_index.c index 4747883ed..d99e5e493 100644 --- a/src/grib_concept_index.c +++ b/src/grib_concept_index.c @@ -9,11 +9,8 @@ */ /* - * * Description: concept index * - * - * */ #include "grib_api_internal.h" diff --git a/src/grib_context.c b/src/grib_context.c index 35c0e7439..fa8a1e30b 100644 --- a/src/grib_context.c +++ b/src/grib_context.c @@ -11,7 +11,11 @@ #include "grib_api_internal.h" #include #include +#ifndef _WIN32 #include +#else +#include /* Windows: for _O_BINARY */ +#endif grib_string_list grib_file_not_found; @@ -200,79 +204,79 @@ void grib_print_api_version(FILE* out) { } static grib_context default_grib_context = { - 0, /* inited */ - 0, /* debug */ - 0, /* write_on_fail */ - 0, /* no_abort */ - 0, /* io_buffer_size */ - 0, /* no_big_group_split */ - 0, /* no_spd */ - 0, /* keep_matrix */ - 0, /* grib_definition_files_path */ - 0, /* grib_samples_path */ - 0, /* grib_concept_path */ - 0, /* grib_reader */ - 0, /* user data */ - GRIB_REAL_MODE8, /* real mode for fortran */ + 0, /* inited */ + 0, /* debug */ + 0, /* write_on_fail */ + 0, /* no_abort */ + 0, /* io_buffer_size */ + 0, /* no_big_group_split */ + 0, /* no_spd */ + 0, /* keep_matrix */ + 0, /* grib_definition_files_path */ + 0, /* grib_samples_path */ + 0, /* grib_concept_path */ + 0, /* grib_reader */ + 0, /* user data */ + GRIB_REAL_MODE8, /* real mode for fortran */ #if MANAGE_MEM - &grib_transient_free, /* free_mem */ - &grib_transient_malloc, /* alloc_mem */ - &grib_transient_realloc, /* realloc_mem */ + &grib_transient_free, /* free_mem */ + &grib_transient_malloc, /* alloc_mem */ + &grib_transient_realloc, /* realloc_mem */ - &grib_permanent_free, /* free_persistant_mem */ - &grib_permanent_malloc, /* alloc_persistant_mem */ + &grib_permanent_free, /* free_persistant_mem */ + &grib_permanent_malloc, /* alloc_persistant_mem */ - &grib_buffer_free, /* buffer_free_mem */ - &grib_buffer_malloc, /* buffer_alloc_mem */ - &grib_buffer_realloc, /* buffer_realloc_mem */ + &grib_buffer_free, /* buffer_free_mem */ + &grib_buffer_malloc, /* buffer_alloc_mem */ + &grib_buffer_realloc, /* buffer_realloc_mem */ #else - &default_free, /* free_mem */ - &default_malloc, /* alloc_mem */ - &default_realloc, /* realloc_mem */ + &default_free, /* free_mem */ + &default_malloc, /* alloc_mem */ + &default_realloc, /* realloc_mem */ - &default_long_lasting_free, /* free_persistant_mem */ - &default_long_lasting_malloc, /* alloc_persistant_mem */ + &default_long_lasting_free, /* free_persistant_mem */ + &default_long_lasting_malloc, /* alloc_persistant_mem */ - &default_buffer_free, /* free_buffer_mem */ - &default_buffer_malloc, /* alloc_buffer_mem */ - &default_buffer_realloc, /* realloc_buffer_mem */ + &default_buffer_free, /* free_buffer_mem */ + &default_buffer_malloc, /* alloc_buffer_mem */ + &default_buffer_realloc, /* realloc_buffer_mem */ #endif - &default_read, /* file read procedure */ - &default_write, /* file write procedure */ - &default_tell, /* lfile tell procedure */ - &default_seek, /* lfile seek procedure */ - &default_feof, /* file feof procedure */ + &default_read, /* file read procedure */ + &default_write, /* file write procedure */ + &default_tell, /* lfile tell procedure */ + &default_seek, /* lfile seek procedure */ + &default_feof, /* file feof procedure */ - &default_log, /* logging_procedure */ - &default_print, /* print procedure */ - 0, /* code tables */ - 0, /* files */ - 0, /* multigrib support on */ - 0, /* multigrib support */ - 0, /* grib_definition_files_dir */ - 0, /* handle_file_count */ - 0, /* handle_total_count */ - 0, /* message_file_offset */ - 0, /* no_fail_on_wrong_length */ - 0, /* gts_header_on */ - 0, /* gribex_mode_on */ - 0, /* large_constant_fields */ - 0, /* keys (grib_trie*) */ - 0, /* keys_count */ - 0, /* concepts_index */ - 0, /* concepts_count */ - {0,}, /* concepts */ - 0, /* def_files */ - 0, /* ieee_packing */ - 0, /* blacklist */ - 0, /* log_stream */ - 0 /* classes */ + &default_log, /* logging_procedure */ + &default_print, /* print procedure */ + 0, /* code tables */ + 0, /* files */ + 0, /* multigrib support on */ + 0, /* multigrib support */ + 0, /* grib_definition_files_dir */ + 0, /* handle_file_count */ + 0, /* handle_total_count */ + 0, /* message_file_offset */ + 0, /* no_fail_on_wrong_length */ + 0, /* gts_header_on */ + 0, /* gribex_mode_on */ + 0, /* large_constant_fields */ + 0, /* keys (grib_trie*) */ + 0, /* keys_count */ + 0, /* concepts_index */ + 0, /* concepts_count */ + {0,}, /* concepts */ + 0, /* def_files */ + 0, /* ieee_packing */ + 0, /* blacklist */ + 0, /* log_stream */ + 0 /* classes */ #if GRIB_PTHREADS - ,PTHREAD_MUTEX_INITIALIZER /* mutex */ + ,PTHREAD_MUTEX_INITIALIZER /*mutex*/ #endif }; @@ -307,6 +311,14 @@ grib_context* grib_context_get_default(){ no_big_group_split=getenv("GRIB_API_NO_BIG_GROUP_SPLIT"); no_spd=getenv("GRIB_API_NO_SPD"); keep_matrix=getenv("GRIB_API_KEEP_MATRIX"); + + /* On UNIX, when we read from a file we get exactly what is in the file on disk. + * But on Windows a file can be opened in binary or text mode. In binary mode the system behaves exactly as in UNIX. + */ +#ifdef _MSC_VER + _set_fmode(_O_BINARY); +#endif + default_grib_context.inited = 1; default_grib_context.io_buffer_size = io_buffer_size ? atoi(io_buffer_size) : 0; default_grib_context.no_big_group_split = no_big_group_split ? atoi(no_big_group_split) : 0; @@ -408,15 +420,29 @@ grib_context* grib_context_new(grib_context* parent) static char* resolve_path(grib_context* c, char* path) { char* result = NULL; +#ifdef _WIN32 + result = grib_context_strdup(c, path); +#else char resolved[DEF_PATH_MAXLEN+1]; if (!realpath(path, resolved)) { result = grib_context_strdup(c, path); /* Failed to resolve. Use original path */ } else { result = grib_context_strdup(c, resolved); } +#endif return result; } +/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */ +/* in order to have multiple definitions directories */ +#ifdef _WIN32 +# define DEFS_PATH_DELIMITER_CHAR ';' +# define DEFS_PATH_DELIMITER_STR ";" +#else +# define DEFS_PATH_DELIMITER_CHAR ':' +# define DEFS_PATH_DELIMITER_STR ":" +#endif + static int init_definition_files_dir(grib_context* c) { int err=0; char path[DEF_PATH_MAXLEN]; @@ -436,15 +462,16 @@ static int init_definition_files_dir(grib_context* c) { GRIB_MUTEX_LOCK(&mutex_c); p=path; - while(*p!=':' && *p!='\0') p++; - if (*p != ':') { - /* No colon found so use it as is */ + while(*p!=DEFS_PATH_DELIMITER_CHAR && *p!='\0') p++; + + if (*p != DEFS_PATH_DELIMITER_CHAR) { + /* No delimiter found so this is a single directory */ c->grib_definition_files_dir=(grib_string_list*)grib_context_malloc_clear_persistent(c,sizeof(grib_string_list)); c->grib_definition_files_dir->value = resolve_path(c, path); } else { - /* definitions path contains at least one colon so must consist of several paths */ - dir=strtok(path,":"); + /* Definitions path contains multiple directories */ + dir=strtok(path, DEFS_PATH_DELIMITER_STR); while (dir != NULL) { if (next) { @@ -455,7 +482,7 @@ static int init_definition_files_dir(grib_context* c) { next=c->grib_definition_files_dir; } next->value = resolve_path(c, dir); - dir=strtok(NULL,":"); + dir=strtok(NULL, DEFS_PATH_DELIMITER_STR); } } @@ -464,7 +491,7 @@ static int init_definition_files_dir(grib_context* c) { return err; } -char *grib_context_full_path(grib_context* c,const char* basename) +char *grib_context_full_defs_path(grib_context* c,const char* basename) { int err=0; char full[1024]={0,}; diff --git a/src/grib_db.c b/src/grib_db.c index 811588f5c..b7e0a0e13 100644 --- a/src/grib_db.c +++ b/src/grib_db.c @@ -12,8 +12,6 @@ * * Description: grib database routines * - * - * */ #include "grib_api_internal.h" #define GRIB_START_ARRAY_SIZE 5000 @@ -38,7 +36,7 @@ static grib_db* grib_db_create_from_keys(grib_context* c,char** keys,int nkeys,i static grib_db* grib_db_create_from_keys(grib_context* c,char** keys,int nkeys,int* err); static void grib_fieldset* grib_db_fieldset_create(grib_db* db, int* err); static int grib_fieldset_compare(grib_fieldset* set,int* i,int* j); -static void grib_db_sort(grib_set* set, int beg, int end); +static void grib_db_sort(grib_set* set, int beg, int theEnd); static grib_order_by* grib_db_new_order_by(grib_context* c,char* obstr); static void grib_db_delete_order_by(grib_context* c,grib_order_by* order_by); static int grib_db_resize(grib_db* db,size_t newsize); @@ -496,12 +494,12 @@ static int grib_fieldset_compare(grib_fieldset* set,int* i,int* j) { return ret; } -static void grib_db_sort(grib_set* set, int beg, int end) { +static void grib_db_sort(grib_set* set, int beg, int theEnd) { double temp; int l=0,r=0; - if (end > beg) { + if (theEnd > beg) { l = beg + 1; - r = end; + r = theEnd; while (l < r) { if ( grib_db_compare(set,&l,&beg) <= 0 ) { l++; @@ -521,7 +519,7 @@ static void grib_db_sort(grib_set* set, int beg, int end) { } grib_db_sort(set, beg, l); - grib_db_sort(set, r, end); + grib_db_sort(set, r, theEnd); } } diff --git a/src/grib_dumper_class_debug.c b/src/grib_dumper_class_debug.c index 105227877..2a4e2ead8 100644 --- a/src/grib_dumper_class_debug.c +++ b/src/grib_dumper_class_debug.c @@ -22,7 +22,7 @@ IMPLEMENTS = init;destroy MEMBERS = long section_offset MEMBERS = long begin - MEMBERS = long end + MEMBERS = long theEnd END_CLASS_DEF */ @@ -55,7 +55,7 @@ typedef struct grib_dumper_debug { /* Members defined in debug */ long section_offset; long begin; - long end; + long theEnd; } grib_dumper_debug; @@ -144,9 +144,9 @@ static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment) for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); if( ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) - fprintf(self->dumper.out,"%ld-%ld %s %s = MISSING",self->begin,self->end,a->creator->op, a->name); + fprintf(self->dumper.out,"%ld-%ld %s %s = MISSING",self->begin,self->theEnd,a->creator->op, a->name); else - fprintf(self->dumper.out,"%ld-%ld %s %s = %ld",self->begin,self->end,a->creator->op, a->name,value); + fprintf(self->dumper.out,"%ld-%ld %s %s = %ld",self->begin,self->theEnd,a->creator->op, a->name,value); if(comment) fprintf(self->dumper.out," [%s]",comment); if(err) fprintf(self->dumper.out," *** ERR=%d (%s)",err,grib_get_error_message(err)); @@ -173,7 +173,7 @@ static void dump_bits(grib_dumper* d,grib_accessor* a,const char* comment) set_begin_end(d,a); for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); - fprintf(self->dumper.out,"%ld-%ld %s %s = %ld [",self->begin,self->end, a->creator->op,a->name,value); + fprintf(self->dumper.out,"%ld-%ld %s %s = %ld [",self->begin,self->theEnd, a->creator->op,a->name,value); for(i=0;i<(a->length*8);i++) { if(test_bit(value,a->length*8-i-1)) @@ -210,9 +210,9 @@ static void dump_double(grib_dumper* d,grib_accessor* a,const char* comment) for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); if( ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) - fprintf(self->dumper.out,"%ld-%ld %s %s = MISSING",self->begin,self->end,a->creator->op, a->name); + fprintf(self->dumper.out,"%ld-%ld %s %s = MISSING",self->begin,self->theEnd,a->creator->op, a->name); else - fprintf(self->dumper.out,"%ld-%ld %s %s = %g",self->begin,self->end,a->creator->op, a->name,value); + fprintf(self->dumper.out,"%ld-%ld %s %s = %g",self->begin,self->theEnd,a->creator->op, a->name,value); if(comment) fprintf(self->dumper.out," [%s]",comment); if(err) fprintf(self->dumper.out," *** ERR=%d (%s)",err,grib_get_error_message(err)); @@ -251,7 +251,7 @@ static void dump_string(grib_dumper* d,grib_accessor* a,const char* comment) while(*p) { if(!isprint(*p)) *p = '.'; p++; } for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); - fprintf(self->dumper.out,"%ld-%ld %s %s = %s",self->begin,self->end,a->creator->op, a->name,value); + fprintf(self->dumper.out,"%ld-%ld %s %s = %s",self->begin,self->theEnd,a->creator->op, a->name,value); if(comment) fprintf(self->dumper.out," [%s]",comment); if(err) @@ -277,7 +277,7 @@ static void dump_bytes(grib_dumper* d,grib_accessor* a,const char* comment) set_begin_end(d,a); for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); - fprintf(self->dumper.out,"%ld-%ld %s %s = %ld",self->begin,self->end,a->creator->op, a->name,a->length); + fprintf(self->dumper.out,"%ld-%ld %s %s = %ld",self->begin,self->theEnd,a->creator->op, a->name,a->length); aliases(d,a); fprintf(self->dumper.out," {"); @@ -352,7 +352,7 @@ static void dump_values(grib_dumper* d,grib_accessor* a) set_begin_end(d,a); for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); - fprintf(self->dumper.out,"%ld-%ld %s %s = (%ld,%ld)",self->begin,self->end,a->creator->op, a->name,(long)size,a->length); + fprintf(self->dumper.out,"%ld-%ld %s %s = (%ld,%ld)",self->begin,self->theEnd,a->creator->op, a->name,(long)size,a->length); aliases(d,a); fprintf(self->dumper.out," {"); @@ -452,9 +452,9 @@ static void set_begin_end(grib_dumper* d,grib_accessor* a) { if ((d->option_flags & GRIB_DUMP_FLAG_OCTECT) != 0) { self->begin=a->offset-self->section_offset+1; - self->end=grib_get_next_position_offset(a)-self->section_offset; + self->theEnd=grib_get_next_position_offset(a)-self->section_offset; } else { self->begin=a->offset; - self->end=grib_get_next_position_offset(a); + self->theEnd=grib_get_next_position_offset(a); } } diff --git a/src/grib_dumper_class_default.c b/src/grib_dumper_class_default.c index 6c33811a8..d186f958d 100644 --- a/src/grib_dumper_class_default.c +++ b/src/grib_dumper_class_default.c @@ -27,7 +27,7 @@ IMPLEMENTS = init;destroy MEMBERS = long section_offset MEMBERS = long begin - MEMBERS = long end + MEMBERS = long theEnd END_CLASS_DEF */ @@ -60,7 +60,7 @@ typedef struct grib_dumper_default { /* Members defined in default */ long section_offset; long begin; - long end; + long theEnd; } grib_dumper_default; @@ -376,7 +376,7 @@ static void dump_bytes(grib_dumper* d,grib_accessor* a,const char* comment) fprintf(self->dumper.out,"-READ ONLY- "); /*for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," ");*/ - /*print_offset(self->dumper.out,self->begin,self->end);*/ + /*print_offset(self->dumper.out,self->begin,self->theEnd);*/ if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); @@ -574,23 +574,23 @@ static void dump_section(grib_dumper* d,grib_accessor* a,grib_block_of_accessors static void print_offset(FILE* out,grib_dumper* d,grib_accessor* a) { int i,k; long offset; - long begin=0,end=0; + long theBegin=0,theEnd=0; size_t size=0,more=0; grib_dumper_default *self = (grib_dumper_default*)d; - begin=a->offset-self->section_offset+1;; - end =grib_get_next_position_offset(a)-self->section_offset; + theBegin=a->offset-self->section_offset+1;; + theEnd =grib_get_next_position_offset(a)-self->section_offset; if ((d->option_flags & GRIB_DUMP_FLAG_HEXADECIMAL) != 0 && a->length != 0) { - if (begin == end) { + if (theBegin == theEnd) { fprintf(self->dumper.out," "); fprintf(out,"# Octet: "); - fprintf(out,"%ld" ,begin); + fprintf(out,"%ld" ,theBegin); } else { fprintf(self->dumper.out," "); fprintf(out,"# Octets: "); - fprintf(out,"%ld-%ld" ,begin,end); + fprintf(out,"%ld-%ld" ,theBegin,theEnd); } fprintf(out," = "); size=a->length; diff --git a/src/grib_dumper_class_keys.c b/src/grib_dumper_class_keys.c index 0e9e7fdbe..5ebdee110 100644 --- a/src/grib_dumper_class_keys.c +++ b/src/grib_dumper_class_keys.c @@ -27,7 +27,7 @@ IMPLEMENTS = init;destroy MEMBERS = long section_offset MEMBERS = long begin - MEMBERS = long end + MEMBERS = long theEnd END_CLASS_DEF */ @@ -60,7 +60,7 @@ typedef struct grib_dumper_keys { /* Members defined in keys */ long section_offset; long begin; - long end; + long theEnd; } grib_dumper_keys; @@ -202,7 +202,7 @@ static void dump_bytes(grib_dumper* d,grib_accessor* a,const char* comment) fprintf(self->dumper.out,"-READ ONLY- "); /*for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," ");*/ - /*print_offset(self->dumper.out,self->begin,self->end);*/ + /*print_offset(self->dumper.out,self->begin,self->theEnd);*/ if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); diff --git a/src/grib_dumper_class_wmo.c b/src/grib_dumper_class_wmo.c index 44c4365f2..5aba3209b 100644 --- a/src/grib_dumper_class_wmo.c +++ b/src/grib_dumper_class_wmo.c @@ -27,7 +27,7 @@ IMPLEMENTS = init;destroy MEMBERS = long section_offset MEMBERS = long begin - MEMBERS = long end + MEMBERS = long theEnd END_CLASS_DEF */ @@ -60,7 +60,7 @@ typedef struct grib_dumper_wmo { /* Members defined in wmo */ long section_offset; long begin; - long end; + long theEnd; } grib_dumper_wmo; @@ -88,7 +88,7 @@ grib_dumper_class* grib_dumper_class_wmo = &_grib_dumper_class_wmo; /* END_CLASS_IMP */ static void set_begin_end(grib_dumper* d,grib_accessor* a); -static void print_offset(FILE* out,long begin,long end); +static void print_offset(FILE* out,long begin,long theEnd); static void print_hexadecimal(FILE* out,unsigned long flags,grib_accessor* a); static void init_class (grib_dumper_class* c){} @@ -163,7 +163,7 @@ static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment) set_begin_end(d,a); - print_offset(self->dumper.out,self->begin,self->end); + print_offset(self->dumper.out,self->begin,self->theEnd); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); @@ -214,7 +214,7 @@ static void dump_bits(grib_dumper* d,grib_accessor* a,const char* comment) set_begin_end(d,a); /*for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," ");*/ - print_offset(self->dumper.out,self->begin,self->end); + print_offset(self->dumper.out,self->begin,self->theEnd); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); @@ -257,7 +257,7 @@ static void dump_double(grib_dumper* d,grib_accessor* a,const char* comment) /*for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," ");*/ - print_offset(self->dumper.out,self->begin,self->end); + print_offset(self->dumper.out,self->begin,self->theEnd); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); @@ -292,15 +292,17 @@ static void dump_string(grib_dumper* d,grib_accessor* a,const char* comment) p=value; if( a->length == 0 && - (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) + (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) { + grib_context_free(a->parent->h->context,value); return; + } set_begin_end(d,a); while(*p) { if(!isprint(*p)) *p = '.'; p++; } /*for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," ");*/ - print_offset(self->dumper.out,self->begin,self->end); + print_offset(self->dumper.out,self->begin,self->theEnd); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); @@ -331,7 +333,7 @@ static void dump_bytes(grib_dumper* d,grib_accessor* a,const char* comment) set_begin_end(d,a); /*for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," ");*/ - print_offset(self->dumper.out,self->begin,self->end); + print_offset(self->dumper.out,self->begin,self->theEnd); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); @@ -413,7 +415,7 @@ static void dump_values(grib_dumper* d,grib_accessor* a) set_begin_end(d,a); /*for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," ");*/ - print_offset(self->dumper.out,self->begin,self->end); + print_offset(self->dumper.out,self->begin,self->theEnd); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out,"%s ",a->creator->op); @@ -528,19 +530,19 @@ static void set_begin_end(grib_dumper* d,grib_accessor* a) { if ((d->option_flags & GRIB_DUMP_FLAG_OCTECT) != 0) { self->begin=a->offset-self->section_offset+1; - self->end=grib_get_next_position_offset(a)-self->section_offset; + self->theEnd=grib_get_next_position_offset(a)-self->section_offset; } else { self->begin=a->offset; - self->end=grib_get_next_position_offset(a); + self->theEnd=grib_get_next_position_offset(a); } } -static void print_offset(FILE* out,long begin,long end) { +static void print_offset(FILE* out,long begin,long theEnd) { char tmp[50]; - if (begin == end) + if (begin == theEnd) fprintf(out,"%-10ld" ,begin); else { - sprintf(tmp,"%ld-%ld" ,begin,end); + sprintf(tmp,"%ld-%ld" ,begin,theEnd); fprintf(out,"%-10s",tmp); } } diff --git a/src/grib_emoslib.h b/src/grib_emoslib.h index 2775127d0..5780d1bca 100644 --- a/src/grib_emoslib.h +++ b/src/grib_emoslib.h @@ -8,14 +8,7 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/*************************************************************************** - * Copyright (C) 2005 by ECMWF * - * maf@agnoman * - * * - ***************************************************************************/ - - - int igglat_(long* KLAT, float *PGAUSS, long* KPR, long* KERR); - void gribex_(long* KSEC0, long* KSEC1, long* KSEC2, double *PSEC2,long* KSEC3, double *PSEC3, long* KSEC4, +int igglat_(long* KLAT, float *PGAUSS, long* KPR, long* KERR); +void gribex_(long* KSEC0, long* KSEC1, long* KSEC2, double *PSEC2,long* KSEC3, double *PSEC3, long* KSEC4, double *PSEC4, long* KLENP, void* KGRIB, long* KLENG,long* KWORD, char* HOPER, long* KRET); diff --git a/src/grib_errors.c b/src/grib_errors.c index ce0bc1944..17090c614 100644 --- a/src/grib_errors.c +++ b/src/grib_errors.c @@ -1,5 +1,15 @@ /* This file is automatically generated by ./errors.pl, do not edit */ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api_internal.h" static const char *errors[] = { diff --git a/src/grib_expression_class.h b/src/grib_expression_class.h new file mode 100644 index 000000000..95ea0183e --- /dev/null +++ b/src/grib_expression_class.h @@ -0,0 +1,12 @@ +/* This file is automatically generated by ./make_class.pl, do not edit */ +extern grib_expression_class* grib_expression_class_accessor; +extern grib_expression_class* grib_expression_class_binop; +extern grib_expression_class* grib_expression_class_column; +extern grib_expression_class* grib_expression_class_constant; +extern grib_expression_class* grib_expression_class_double; +extern grib_expression_class* grib_expression_class_functor; +extern grib_expression_class* grib_expression_class_long; +extern grib_expression_class* grib_expression_class_string; +extern grib_expression_class* grib_expression_class_string_compare; +extern grib_expression_class* grib_expression_class_true; +extern grib_expression_class* grib_expression_class_unop; diff --git a/src/grib_expression_factory.h b/src/grib_expression_factory.h new file mode 100644 index 000000000..d7ae0c603 --- /dev/null +++ b/src/grib_expression_factory.h @@ -0,0 +1,12 @@ +/* This file is automatically generated by ./make_class.pl, do not edit */ +{ "accessor", &grib_expression_class_accessor, }, +{ "binop", &grib_expression_class_binop, }, +{ "column", &grib_expression_class_column, }, +{ "constant", &grib_expression_class_constant, }, +{ "double", &grib_expression_class_double, }, +{ "functor", &grib_expression_class_functor, }, +{ "long", &grib_expression_class_long, }, +{ "string", &grib_expression_class_string, }, +{ "string_compare", &grib_expression_class_string_compare, }, +{ "true", &grib_expression_class_true, }, +{ "unop", &grib_expression_class_unop, }, diff --git a/src/grib_fieldset.c b/src/grib_fieldset.c index 023190e66..8627ead6a 100644 --- a/src/grib_fieldset.c +++ b/src/grib_fieldset.c @@ -12,8 +12,6 @@ * * Description: routines for grib indexing form a set of files * - * - * */ #include "grib_api_internal.h" #define GRIB_START_ARRAY_SIZE 5000 @@ -37,7 +35,7 @@ static int grib_fieldset_resize(grib_fieldset* set,size_t newsize); static void grib_trim(char** x); static grib_order_by* grib_fieldset_new_order_by(grib_context* c,char* z); static int grib_fieldset_compare(grib_fieldset* set,int* i,int* j); -static void grib_fieldset_sort(grib_fieldset* set, int beg, int end); +static void grib_fieldset_sort(grib_fieldset* set, int beg, int theEnd); static int grib_fieldset_columns_resize(grib_fieldset* set,size_t newsize); static grib_int_array* grib_fieldset_create_int_array(grib_context* c,size_t size); static int grib_fieldset_resize_int_array(grib_int_array* a,size_t newsize); @@ -458,12 +456,12 @@ static int grib_fieldset_compare(grib_fieldset* set,int* i,int* j) { return ret; } -static void grib_fieldset_sort(grib_fieldset* set, int beg, int end) { +static void grib_fieldset_sort(grib_fieldset* set, int beg, int theEnd) { double temp; int l=0,r=0; - if (end > beg) { + if (theEnd > beg) { l = beg + 1; - r = end; + r = theEnd; while (l < r) { if ( grib_fieldset_compare(set,&l,&beg) <= 0 ) { l++; @@ -483,7 +481,7 @@ static void grib_fieldset_sort(grib_fieldset* set, int beg, int end) { } grib_fieldset_sort(set, beg, l); - grib_fieldset_sort(set, r, end); + grib_fieldset_sort(set, r, theEnd); } } diff --git a/src/grib_filepool.c b/src/grib_filepool.c index b7f57c72d..79c26b77d 100644 --- a/src/grib_filepool.c +++ b/src/grib_filepool.c @@ -12,8 +12,6 @@ * * Description: file pool * - * - * */ #include "grib_api_internal.h" @@ -42,15 +40,16 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a,const char* b) { } static grib_file_pool file_pool= { - 0, /* grib_context* context;*/ - 0, /* grib_file* first;*/ - 0, /* grib_file* current; */ - 0, /* size_t size;*/ - 0, /* int number_of_opened_files;*/ - GRIB_MAX_OPENED_FILES /* int max_opened_files; */ + 0, /* grib_context* context;*/ + 0, /* grib_file* first;*/ + 0, /* grib_file* current; */ + 0, /* size_t size;*/ + 0, /* int number_of_opened_files;*/ + GRIB_MAX_OPENED_FILES /* int max_opened_files; */ }; -void grib_file_pool_clean() { +void grib_file_pool_clean() +{ grib_file *file,*next; if (!file_pool.first) return; @@ -63,7 +62,8 @@ void grib_file_pool_clean() { } } -static void grib_file_pool_change_id() { +static void grib_file_pool_change_id() +{ grib_file *file; if (!file_pool.first) return; @@ -75,7 +75,8 @@ static void grib_file_pool_change_id() { } } -static grib_file* grib_read_file(grib_context *c,FILE* fh,int *err) { +static grib_file* grib_read_file(grib_context *c,FILE* fh,int *err) +{ short marker=0; short id=0; grib_file* file; @@ -97,7 +98,8 @@ static grib_file* grib_read_file(grib_context *c,FILE* fh,int *err) { return file; } -static int grib_write_file(FILE *fh,grib_file* file) { +static int grib_write_file(FILE *fh,grib_file* file) +{ int err=0; if (!file) @@ -115,11 +117,13 @@ static int grib_write_file(FILE *fh,grib_file* file) { return grib_write_file(fh,file->next); } -grib_file* grib_file_pool_get_files() { +grib_file* grib_file_pool_get_files() +{ return file_pool.first; } -int grib_file_pool_read(grib_context* c,FILE* fh) { +int grib_file_pool_read(grib_context* c,FILE* fh) +{ int err=0; short marker=0; grib_file* file; @@ -145,7 +149,8 @@ int grib_file_pool_read(grib_context* c,FILE* fh) { return GRIB_SUCCESS; } -int grib_file_pool_write(FILE* fh) { +int grib_file_pool_write(FILE* fh) +{ int err=0; if (!file_pool.first) return grib_write_null_marker(fh); @@ -156,7 +161,8 @@ int grib_file_pool_write(FILE* fh) { return grib_write_file(fh,file_pool.first); } -grib_file* grib_file_open(const char* filename, const char* mode,int* err) { +grib_file* grib_file_open(const char* filename, const char* mode,int* err) +{ grib_file *file=0,*prev=0; int same_mode=0; int is_new=0; @@ -232,12 +238,13 @@ grib_file* grib_file_open(const char* filename, const char* mode,int* err) { return file; } -void grib_file_close(const char* filename,int* err) { +void grib_file_close(const char* filename,int* err) +{ grib_file* file=NULL; /* Performance: keep the files open to avoid opening and closing files when writing the output. */ /* So only call fclose() when too many files are open */ - if (file_pool.number_of_opened_files > GRIB_MAX_OPENED_FILES) { + if ( file_pool.number_of_opened_files > GRIB_MAX_OPENED_FILES ) { /*printf("++ closing file %s\n",filename);*/ GRIB_PTHREAD_ONCE(&once,&init); GRIB_MUTEX_LOCK(&mutex1); @@ -297,7 +304,8 @@ grib_file* grib_get_file(const char* filename,int* err) return file; } -grib_file* grib_find_file(short id) { +grib_file* grib_find_file(short id) +{ grib_file* file=NULL; if (file_pool.current->name && id==file_pool.current->id) { @@ -313,7 +321,8 @@ grib_file* grib_find_file(short id) { return file; } -grib_file* grib_file_new(grib_context* c, const char* name, int* err) { +grib_file* grib_file_new(grib_context* c, const char* name, int* err) +{ grib_file* file; if (!c) c=grib_context_get_default( ); @@ -343,7 +352,8 @@ grib_file* grib_file_new(grib_context* c, const char* name, int* err) { return file; } -void grib_file_delete(grib_file* file) { +void grib_file_delete(grib_file* file) +{ GRIB_PTHREAD_ONCE(&once,&init); GRIB_MUTEX_LOCK(&mutex1); if (!file) return; diff --git a/src/grib_gaussian_reduced.c b/src/grib_gaussian_reduced.c index 9b85daab0..82557f058 100644 --- a/src/grib_gaussian_reduced.c +++ b/src/grib_gaussian_reduced.c @@ -19,9 +19,6 @@ * ilon_first,ilon_last of the first and last point * given the number of points along a parallel (pl) * - * - * - * */ #define EFDEBUG 0 diff --git a/src/grib_handle.c b/src/grib_handle.c index 04adad896..245564d97 100644 --- a/src/grib_handle.c +++ b/src/grib_handle.c @@ -26,18 +26,18 @@ static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; static void init() { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&mutex1,&attr); - pthread_mutex_init(&mutex2,&attr); - pthread_mutexattr_destroy(&attr); + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mutex1,&attr); + pthread_mutex_init(&mutex2,&attr); + pthread_mutexattr_destroy(&attr); } #endif -static grib_handle* grib_handle_new_from_file_no_multi ( grib_context* c, FILE* f,int *error ); +static grib_handle* grib_handle_new_from_file_no_multi ( grib_context* c, FILE* f,int headers_only,int *error ); static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,int *error ); static int grib2_get_next_section ( unsigned char* msgbegin,size_t msglen,unsigned char** secbegin,size_t* seclen,int* secnum,int* err ); static int grib2_has_next_section ( unsigned char* msgbegin,size_t msglen,unsigned char* secbegin,size_t seclen,int* err ); @@ -45,7 +45,7 @@ static void grib2_build_message ( grib_context* context,unsigned char* sections[ static grib_multi_support* grib_get_multi_support ( grib_context* c, FILE* f ); static grib_multi_support* grib_multi_support_new ( grib_context* c ); static grib_handle* grib_handle_new_multi ( grib_context* c,unsigned char** idata, - size_t *buflen,int* error ); + size_t *buflen,int* error ); grib_section* grib_section_create ( grib_handle* h,grib_accessor* owner ) { @@ -70,28 +70,27 @@ static void update_sections ( grib_section *s,grib_handle* h,long offset ) } } -void grib_swap_sections ( grib_section* old,grib_section *new ) +void grib_swap_sections ( grib_section* the_old, grib_section *the_new ) { grib_accessor* a; - grib_block_of_accessors* b = old->block; + grib_block_of_accessors* b = the_old->block; /* printf("SWAPPING -----\n"); grib_dump_section_content(new,stdout); */ + the_old->block = the_new->block; + the_new->block = b; - old->block = new->block; - new->block = b; + a = the_old->aclength; + the_old->aclength = the_new->aclength; + the_new->aclength = a; - a = old->aclength; - old->aclength = new->aclength; - new->aclength = a; - - a = old->block->first; + a = the_old->block->first; while ( a ) { - a->parent = old; + a->parent = the_old; a = a->next; } - update_sections ( old,old->h,old->owner->offset ); + update_sections ( the_old, the_old->h, the_old->owner->offset ); /* update_sections(new,new->h,new->owner->offset); */ /* printf("SWAPPING -----\n"); grib_dump_section_content(old,stdout); */ @@ -267,7 +266,8 @@ grib_handle* grib_handle_new_from_samples ( grib_context* c, const char* name ) g=grib_external_template ( c,name ); if ( !g ) - grib_context_log (c,GRIB_LOG_ERROR,"Unable to locate sample file %s.tmpl\n in %s",name,c->grib_samples_path); + grib_context_log ( c,GRIB_LOG_ERROR,"Unable to locate sample file %s.tmpl\n in %s", + name, c->grib_samples_path ); return g; } @@ -346,13 +346,13 @@ grib_handle* grib_handle_new_from_partial_message_copy ( grib_context* c, const grib_handle* grib_handle_new_from_partial_message ( grib_context* c,void* data, size_t buflen ) { - grib_handle *gl = NULL; - if ( c == NULL ) c = grib_context_get_default(); - c->handle_file_count=0; - c->handle_total_count=0; - gl = grib_new_handle ( c ); - gl->partial = 1; - return grib_handle_create ( gl, c, data, buflen ); + grib_handle *gl = NULL; + if ( c == NULL ) c = grib_context_get_default(); + c->handle_file_count=0; + c->handle_total_count=0; + gl = grib_new_handle ( c ); + gl->partial = 1; + return grib_handle_create ( gl, c, data, buflen ); } @@ -370,7 +370,7 @@ grib_handle* grib_handle_new_from_message ( grib_context* c,void* data, size_t b grib_handle* grib_handle_new_from_multi_message ( grib_context* c,void** data, - size_t *buflen,int* error ) + size_t *buflen,int* error ) { grib_handle *h = NULL; unsigned char** d= ( unsigned char** ) data; @@ -394,36 +394,11 @@ grib_handle* grib_handle_new_from_multi_message ( grib_context* c,void** data, grib_handle* grib_handle_new_from_file ( grib_context* c, FILE* f,int *error ) { - off_t offset=0; - grib_handle* h=0; - if (!f) {*error=GRIB_IO_PROBLEM; return NULL;} - - if ( c == NULL ) c = grib_context_get_default(); - - if ( ( offset=grib_context_tell ( c,f ) ) < 0 ) - { - /*grib_context_log ( c, GRIB_LOG_ERROR, "grib_handle_new_from_file: cannot get offset" );*/ - *error=GRIB_IO_PROBLEM; - return NULL; - } - - if ( offset == 0 ) c->handle_file_count=0; - - if ( c->multi_support_on ) h=grib_handle_new_from_file_multi ( c,f,error ); - else h=grib_handle_new_from_file_no_multi ( c,f,error ); - - if ( !c->no_fail_on_wrong_length && *error == GRIB_WRONG_LENGTH ) - { - grib_handle_delete ( h ); - h=NULL; - } - - return h; + return eccode_grib_new_from_file(c,f,0,error); } - static grib_handle* grib_handle_new_multi ( grib_context* c,unsigned char** data, - size_t *buflen,int* error ) + size_t *buflen,int* error ) { void * message=NULL; size_t olen = 0,len=0; @@ -485,7 +460,7 @@ static grib_handle* grib_handle_new_multi ( grib_context* c,unsigned char** data if ( !gm->bitmap_section ) { grib_context_log ( gl->context, GRIB_LOG_ERROR, - "grib_handle_new_from_file : cannot create handle, missing bitmap\n" ); + "grib_handle_new_from_file : cannot create handle, missing bitmap\n" ); return NULL; } gm->sections[secnum]= gm->bitmap_section; @@ -552,36 +527,6 @@ static grib_handle* grib_handle_new_multi ( grib_context* c,unsigned char** data return gl; } -grib_handle* grib_handle_new_from_nc_file(grib_context* c,const char* file,int *error) { - FILE* fh=NULL; - char msg[4]; - grib_handle* h=NULL; - size_t len=4; - - fh=fopen(file,"r"); - if (!fh) { - grib_context_log(c,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR),"unable to open %s",file); - perror(file); - return NULL; - } - if (fread(msg,1,3,fh)!=3) { - perror(file); - fclose(fh); - return NULL; - } - fclose(fh); - msg[3]='X'; - - h = grib_handle_new_from_message_copy ( c, msg, len ); - - if ( !h ) { - *error = GRIB_DECODING_ERROR; - grib_context_log ( c, GRIB_LOG_ERROR, "grib_handle_new_nc_from_file : cannot create handle \n" ); - return NULL; - } - return h; -} - static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,int *error ) { void* data = NULL,*old_data=NULL; @@ -594,7 +539,7 @@ static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,i int err=0,i=0; grib_multi_support* gm=NULL; off_t gts_header_offset=0; - off_t end_msg_offset=0,start_msg_offset=0; + off_t end_msg_offset=0,offset=0; char *gts_header=0,*save_gts_header=0; int gtslen=0; @@ -605,12 +550,12 @@ static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,i if ( !gm->message ) { gts_header_offset=grib_context_tell( c,f); - data = wmo_read_grib_from_file_malloc ( f, &olen,error ); - end_msg_offset=grib_context_tell ( c,f ); - start_msg_offset=end_msg_offset-olen; + data = wmo_read_grib_from_file_malloc ( f,0, &olen,&offset,error ); + end_msg_offset=grib_context_tell ( c,f ); + gm->message_length=olen; gm->message=data; - gm->offset=start_msg_offset; + gm->offset=offset; if ( *error != GRIB_SUCCESS || !data ) { if ( data ) grib_context_free ( c,data ); @@ -624,12 +569,12 @@ static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,i { int g=0; grib_context_seek ( c,gts_header_offset,SEEK_SET,f ); - gtslen=start_msg_offset-gts_header_offset; + gtslen=offset-gts_header_offset; gts_header=grib_context_malloc_clear ( c,sizeof ( unsigned char ) *gtslen ); save_gts_header=gts_header; grib_context_read ( c,gts_header,gtslen,f ); g=gtslen; - while ( gts_header!=NULL && g != 0 && *gts_header != '\03' ) + while ( gts_header!=NULL && g != 0 && *gts_header != '\03' ) { /*printf("--------%d %X \n",gtslen,*gts_header);*/ gts_header++; @@ -644,7 +589,6 @@ static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,i else data=gm->message; - /*TODO general multimessage handling*/ edition=grib_decode_unsigned_byte_long ( data,7,1 ); if ( edition == 2 ) @@ -726,7 +670,7 @@ static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,i } gl = grib_handle_new_from_message ( c, data, olen ); - if ( !gl ) + if ( !gl ) { *error = GRIB_DECODING_ERROR; grib_context_log ( gl->context, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" ); @@ -734,7 +678,7 @@ static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,i return NULL; } - gl->offset=gm->offset; + gl->offset=gm->offset; gl->buffer->property = GRIB_MY_BUFFER; c->handle_file_count++; c->handle_total_count++; @@ -751,54 +695,38 @@ static grib_handle* grib_handle_new_from_file_multi ( grib_context* c, FILE* f,i return gl; } -grib_handle* grib_handle_headers_only_new_from_file ( grib_context* c, FILE* f,int *error ) +grib_handle* eccode_grib_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) { - void *data = NULL; - size_t olen = 0; - grib_handle *gl = NULL; - off_t start_msg_offset=0; + grib_handle* h=0; + if (!f) {*error=GRIB_IO_PROBLEM; return NULL;} if ( c == NULL ) c = grib_context_get_default(); - *error = grib_read_any_headers_only_from_file_alloc ( c, f, &data, &olen ,&start_msg_offset); + if ( c->multi_support_on ) h=grib_handle_new_from_file_multi ( c,f,error ); + else h=grib_handle_new_from_file_no_multi ( c,f,headers_only,error ); - if ( *error != GRIB_SUCCESS ) + if ( h && h->offset == 0 ) c->handle_file_count=1; + + if ( !c->no_fail_on_wrong_length && *error == GRIB_WRONG_LENGTH ) { - if ( data ) grib_context_free ( c,data ); - if ( *error == GRIB_END_OF_FILE ) *error = GRIB_SUCCESS; - return NULL; + grib_handle_delete ( h ); + h=NULL; } - gl = grib_handle_new_from_partial_message ( c, data, olen ); - - if ( !gl ) - { - *error = GRIB_DECODING_ERROR; - grib_context_log ( gl->context, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" ); - grib_context_free ( c,data ); - return NULL; - } - - gl->offset=start_msg_offset; - gl->buffer->property = GRIB_MY_BUFFER; - c->handle_file_count++; - c->handle_total_count++; - - return gl; + return h; } -grib_handle* grib_gts_handle_new_from_file ( grib_context* c, FILE* f,int *error ) + +grib_handle* eccode_gts_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) { void *data = NULL; size_t olen = 0; grib_handle *gl = NULL; - off_t end_msg_offset=0,start_msg_offset=0; + off_t offset=0; if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_gts_from_file_malloc ( f, &olen,error ); - end_msg_offset=grib_context_tell ( c,f ); - start_msg_offset=end_msg_offset-olen; + data = wmo_read_gts_from_file_malloc ( f, headers_only,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -808,8 +736,12 @@ grib_handle* grib_gts_handle_new_from_file ( grib_context* c, FILE* f,int *error return NULL; } - gl = grib_handle_new_from_message ( c, data, olen ); - + if (headers_only) { + gl = grib_handle_new_from_partial_message ( c, data, olen ); + } else { + gl = grib_handle_new_from_message ( c, data, olen ); + } + if ( !gl ) { *error = GRIB_DECODING_ERROR; @@ -818,7 +750,7 @@ grib_handle* grib_gts_handle_new_from_file ( grib_context* c, FILE* f,int *error return NULL; } - gl->offset=start_msg_offset; + gl->offset=offset; gl->buffer->property = GRIB_MY_BUFFER; c->handle_file_count++; c->handle_total_count++; @@ -826,18 +758,16 @@ grib_handle* grib_gts_handle_new_from_file ( grib_context* c, FILE* f,int *error return gl; } -grib_handle* grib_bufr_handle_new_from_file ( grib_context* c, FILE* f,int *error ) +grib_handle* eccode_bufr_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) { void *data = NULL; size_t olen = 0; grib_handle *gl = NULL; - off_t end_msg_offset=0,start_msg_offset=0; + off_t offset=0; if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_bufr_from_file_malloc ( f, &olen,error ); - end_msg_offset=grib_context_tell ( c,f ); - start_msg_offset=end_msg_offset-olen; + data = wmo_read_bufr_from_file_malloc ( f, headers_only,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -847,8 +777,12 @@ grib_handle* grib_bufr_handle_new_from_file ( grib_context* c, FILE* f,int *erro return NULL; } - gl = grib_handle_new_from_message ( c, data, olen ); - + if (headers_only) { + gl = grib_handle_new_from_partial_message ( c, data, olen ); + } else { + gl = grib_handle_new_from_message ( c, data, olen ); + } + if ( !gl ) { *error = GRIB_DECODING_ERROR; @@ -857,7 +791,7 @@ grib_handle* grib_bufr_handle_new_from_file ( grib_context* c, FILE* f,int *erro return NULL; } - gl->offset=start_msg_offset; + gl->offset=offset; gl->buffer->property = GRIB_MY_BUFFER; c->handle_file_count++; c->handle_total_count++; @@ -865,20 +799,19 @@ grib_handle* grib_bufr_handle_new_from_file ( grib_context* c, FILE* f,int *erro return gl; } -static grib_handle* grib_handle_new_from_file_no_multi ( grib_context* c, FILE* f,int *error ) +static grib_handle* grib_handle_new_from_file_no_multi ( grib_context* c,FILE* f,int headers_only,int *error ) { void *data = NULL; size_t olen = 0; grib_handle *gl = NULL; off_t gts_header_offset=0; - off_t end_msg_offset=0,start_msg_offset=0; + off_t offset=0,end_msg_offset=0; char *gts_header=0,*save_gts_header=0; int gtslen=0; if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_grib_from_file_malloc ( f, &olen, error ); - end_msg_offset=grib_context_tell ( c,f ); - start_msg_offset=end_msg_offset-olen; + data = wmo_read_grib_from_file_malloc ( f, headers_only,&olen,&offset,error ); + end_msg_offset=offset+olen; if ( *error != GRIB_SUCCESS ) { @@ -892,7 +825,7 @@ static grib_handle* grib_handle_new_from_file_no_multi ( grib_context* c, FILE* { int g=0; grib_context_seek ( c,gts_header_offset,SEEK_SET,f ); - gtslen=start_msg_offset-gts_header_offset; + gtslen=offset-gts_header_offset; gts_header=grib_context_malloc ( c,sizeof ( unsigned char ) *gtslen ); save_gts_header=gts_header; grib_context_read ( c,gts_header,gtslen,f ); @@ -908,8 +841,12 @@ static grib_handle* grib_handle_new_from_file_no_multi ( grib_context* c, FILE* grib_context_seek ( c,end_msg_offset,SEEK_SET,f ); } - gl = grib_handle_new_from_message ( c, data, olen ); - + if (headers_only) { + gl = grib_handle_new_from_partial_message ( c, data, olen ); + } else { + gl = grib_handle_new_from_message ( c, data, olen ); + } + if ( !gl ) { *error = GRIB_DECODING_ERROR; @@ -918,7 +855,7 @@ static grib_handle* grib_handle_new_from_file_no_multi ( grib_context* c, FILE* return NULL; } - gl->offset=start_msg_offset; + gl->offset=offset; gl->buffer->property = GRIB_MY_BUFFER; c->handle_file_count++; @@ -946,8 +883,8 @@ grib_multi_handle* grib_multi_handle_new ( grib_context* c ) if ( h==NULL ) { grib_context_log ( c,GRIB_LOG_ERROR, - "grib_multi_handle_new: unable to allocate memory. %s", - grib_get_error_message ( GRIB_OUT_OF_MEMORY ) ); + "grib_multi_handle_new: unable to allocate memory. %s", + grib_get_error_message ( GRIB_OUT_OF_MEMORY ) ); return NULL; } h->buffer = grib_create_growable_buffer ( c ); @@ -1048,7 +985,7 @@ int grib_get_partial_message ( grib_handle* h,const void** msg,size_t* len,int s } int grib_get_partial_message_copy ( grib_handle* h , void* message,size_t *len, - int start_section ) + int start_section ) { size_t partial_len=0; long section_offset=0; @@ -1082,6 +1019,23 @@ int grib_get_message_copy ( grib_handle* h , void* message,size_t *len ) return GRIB_SUCCESS; } +int grib_get_message_offset ( grib_handle* h,off_t* offset ) { + + if (h) *offset=h->offset; + else return GRIB_INTERNAL_ERROR; + + return 0; +} + +int grib_get_message_size ( grib_handle* h,size_t* size ) { + long totalLength=0; + int ret=0; + *size = h->buffer->ulength; + ret=grib_get_long(h,"totalLength",&totalLength); + if (!ret) *size=totalLength; + return ret; +} + int grib_get_message ( grib_handle* h,const void** msg,size_t* size ) { long totalLength=0; @@ -1103,20 +1057,20 @@ int grib_get_message ( grib_handle* h,const void** msg,size_t* size ) int grib_get_message_headers ( grib_handle* h,const void** msg,size_t* size ) { - int ret=0; - size_t endOfHeadersMaker; - *msg = h->buffer->data; - *size = h->buffer->ulength; + int ret=0; + size_t endOfHeadersMaker; + *msg = h->buffer->data; + *size = h->buffer->ulength; - if ((ret=grib_get_offset(h,"endOfHeadersMaker",&endOfHeadersMaker))!=GRIB_SUCCESS) { - grib_context_log(h->context,GRIB_LOG_FATAL, - "grib_get_message_headers unable to get offset of endOfHeadersMaker"); - return ret; - } + if ((ret=grib_get_offset(h,"endOfHeadersMaker",&endOfHeadersMaker))!=GRIB_SUCCESS) { + grib_context_log(h->context,GRIB_LOG_FATAL, + "grib_get_message_headers unable to get offset of endOfHeadersMaker"); + return ret; + } - *size=endOfHeadersMaker; - - return ret; + *size=endOfHeadersMaker; + + return ret; } grib_handle *grib_handle_new ( grib_context* c ) @@ -1293,6 +1247,20 @@ void grib_multi_support_off ( grib_context* c ) c->multi_support_on=0; } +/* For multi support mode: Reset all file handles equal to f. See GRIB-249 */ +void grib_multi_support_reset_file(grib_context* c, FILE* f) +{ + grib_multi_support* gm = NULL; + if ( !c ) c = grib_context_get_default(); + gm = c->multi_support; + while ( gm ) { + if ( gm->file == f ) { + gm->file = NULL; + } + gm=gm->next; + } +} + void grib_gts_header_on ( grib_context* c ) { if ( !c ) c=grib_context_get_default(); @@ -1381,7 +1349,7 @@ static grib_multi_support* grib_multi_support_new ( grib_context* c ) { int i=0; grib_multi_support* gm= - ( grib_multi_support* ) grib_context_malloc_clear ( c,sizeof ( grib_multi_support ) ); + ( grib_multi_support* ) grib_context_malloc_clear ( c,sizeof ( grib_multi_support ) ); gm->file=NULL; gm->message=NULL; gm->message_length=0; diff --git a/src/grib_ibmfloat.c b/src/grib_ibmfloat.c index 28c90cc0c..7c4f86c83 100644 --- a/src/grib_ibmfloat.c +++ b/src/grib_ibmfloat.c @@ -125,8 +125,8 @@ double grib_ibmfloat_error(double x) { /* Overflow */ if (x > ibm_table.vmax) { fprintf(stderr, "grib_ibmfloat_error: Number is too large: x=%.20e > xmax=%.20e\n", x, ibm_table.vmax); - Assert(0); - return 0; + Assert(0); + return 0; } binary_search(ibm_table.v, 127, x, &e); diff --git a/src/grib_ieeefloat.c b/src/grib_ieeefloat.c index 0f54e997e..b6ea14579 100644 --- a/src/grib_ieeefloat.c +++ b/src/grib_ieeefloat.c @@ -335,7 +335,7 @@ unsigned long grib_ieee_to_long(double x) { #ifdef IEEE unsigned long grib_ieee64_to_long(double x) { - unsigned long lval; + unsigned long lval = 0; #if IEEE_LE unsigned char s[8]={0,}; unsigned char* buf=(unsigned char*)&x; @@ -350,7 +350,7 @@ unsigned long grib_ieee64_to_long(double x) { } double grib_long_to_ieee64(unsigned long x){ - double dval; + double dval = 0.0; #if IEEE_LE unsigned char s[8]={0,}; unsigned char* buf=(unsigned char*)&x; @@ -360,6 +360,8 @@ double grib_long_to_ieee64(unsigned long x){ memcpy(&dval,s,8); #elif IEEE_BE memcpy(&dval,&x,8); +#else + Assert(!"Neither IEEE_LE nor IEEE_BE defined."); #endif return dval; diff --git a/src/grib_index.c b/src/grib_index.c index 4852e810a..f8bd02260 100644 --- a/src/grib_index.c +++ b/src/grib_index.c @@ -12,8 +12,6 @@ * * Description: index * - * - * */ #include "grib_api_internal.h" diff --git a/src/grib_io.c b/src/grib_io.c index dcd3c97a1..28c4e851c 100644 --- a/src/grib_io.c +++ b/src/grib_io.c @@ -45,7 +45,6 @@ typedef struct reader { } reader; - static int read_the_rest(reader* r,size_t message_length,unsigned char* tmp, int already_read) { int err = 0; @@ -60,32 +59,17 @@ static int read_the_rest(reader* r,size_t message_length,unsigned char* tmp, int buffer = (unsigned char*)r->alloc(r->alloc_data,&buffer_size,&err); if(err) return err; - if(buffer_size < message_length) - { - if(buffer_size < already_read) - { - memcpy(buffer,tmp,buffer_size); - return GRIB_BUFFER_TOO_SMALL; - } - - memcpy(buffer,tmp,already_read); - if((r->read(r->read_data,buffer+already_read,buffer_size-already_read,&err) != buffer_size-already_read) || err) - return err; - - return GRIB_BUFFER_TOO_SMALL; - } - memcpy(buffer,tmp,already_read); if((r->read(r->read_data,buffer+already_read,rest,&err) != rest) || err) return err; if(!r->headers_only && (buffer[message_length-4] != '7' || - buffer[message_length-3] != '7' || - buffer[message_length-2] != '7' || - buffer[message_length-1] != '7')) { + buffer[message_length-3] != '7' || + buffer[message_length-2] != '7' || + buffer[message_length-1] != '7')) { - return GRIB_WRONG_LENGTH; + return GRIB_WRONG_LENGTH; } @@ -94,7 +78,7 @@ static int read_the_rest(reader* r,size_t message_length,unsigned char* tmp, int #define CHECK_TMP_SIZE(a) if(sizeof(tmp)<(a)) { fprintf(stderr,"%s:%d sizeof(tmp)<%s %d<%d\n", __FILE__,__LINE__,#a,(int)sizeof(tmp),(int)(a)); return GRIB_INTERNAL_ARRAY_TOO_SMALL; } -#define GROW_BUF_IF_REQUIRED(desired_length) if (buf->length<(desired_length)) { grib_grow_buffer(c, buf, desired_length); tmp=buf->data; } +#define GROW_BUF_IF_REQUIRED(desired_length) if(buf->length<(desired_length)) { grib_grow_buffer(c, buf, desired_length);tmp=buf->data; } #define UINT3(a,b,c) (size_t)((a<<16) + (b<<8) + c); @@ -117,7 +101,7 @@ static int read_GRIB(reader* r) /*TODO proper context*/ c=grib_context_get_default(); - tmp=grib_context_malloc_clear(c,buflen); + tmp=malloc(buflen); buf=grib_new_buffer(c,tmp,buflen); buf->property = GRIB_MY_BUFFER; @@ -157,7 +141,7 @@ static int read_GRIB(reader* r) i += sec1len-3; - GROW_BUF_IF_REQUIRED(8+ sec1len + 4 + 3); + GROW_BUF_IF_REQUIRED(i+3); if(flags & (1<<7)) { /* Section 2 */ @@ -165,6 +149,7 @@ static int read_GRIB(reader* r) return err; sec2len=UINT3(tmp[i],tmp[i+1],tmp[i+2]); + GROW_BUF_IF_REQUIRED(i+sec2len); i+=3; /* Read section 2 */ if((r->read(r->read_data,tmp+i,sec2len-3,&err) != sec2len-3) || err) @@ -172,10 +157,51 @@ static int read_GRIB(reader* r) i += sec2len-3; } - GROW_BUF_IF_REQUIRED(8+sec1len + sec2len + 4 + 3); + + if(flags & (1<<6)) { + + /* Section 3 */ + GROW_BUF_IF_REQUIRED(i+3); + for(j=0;j<3;j++) + { + if(r->read(r->read_data,&tmp[i],1,&err) != 1 || err) + return err; + + sec3len <<= 8; + sec3len |= tmp[i]; + i++; + } + + /* Read section 3 */ + GROW_BUF_IF_REQUIRED(i + sec3len); + if((r->read(r->read_data,tmp+i,sec3len-3,&err) != sec3len-3) || err) + return err; + i += sec3len-3; + } + + GROW_BUF_IF_REQUIRED(i + 11); + + /* Section 4 */ + for(j=0;j<3;j++) + { + if(r->read(r->read_data,&tmp[i],1,&err) != 1 || err) + return err; + + sec4len <<= 8; + sec4len |= tmp[i]; + i++; + } + + /* we don't read the data, only headers */ + if((r->read(r->read_data,tmp+i,8,&err) != 8) || err) + return err; + + i+=8; total_length=length; - length=8+sec1len + sec2len; + /* length=8+sec1len + sec2len+sec3len+11; */ + length=i; + err=r->seek(r->read_data,total_length-length-1); } else if(length & 0x800000) @@ -334,11 +360,8 @@ static int read_GRIB(reader* r) break; } - Assert(i <= buf->length); + /* Assert(i <= buf->length); */ err=read_the_rest(r,length,tmp,i); - if (r->headers_only && edition==1) { - err=r->seek(r->read_data,total_length-length); - } grib_buffer_delete(c,buf); @@ -401,11 +424,23 @@ static int read_TIDE(reader *r,const char* type) static int read_BUFR(reader *r) { - unsigned char tmp[65536]; /* Should be enough */ + /* unsigned char tmp[65536];*/ /* Should be enough */ size_t length = 0; long edition = 0; + size_t sec1len = 0; + size_t sec2len = 0; int err = 0; int i = 0 ,j; + size_t buflen=2048; + unsigned char *tmp=NULL; + grib_context *c=NULL; + grib_buffer* buf=NULL; + + /*TODO proper context*/ + c=grib_context_get_default(); + tmp=malloc(buflen); + buf=grib_new_buffer(c,tmp,buflen); + buf->property = GRIB_MY_BUFFER; tmp[i++] = 'B'; tmp[i++] = 'U'; @@ -452,7 +487,7 @@ static int read_BUFR(reader *r) flags = tmp[i++]; - CHECK_TMP_SIZE(sec1len + 4 + 3 ); + GROW_BUF_IF_REQUIRED(sec1len + 4 + 3); /* Read section 1. 3 = length, 5 = table,center,process,flags */ @@ -474,14 +509,14 @@ static int read_BUFR(reader *r) i++; } + GROW_BUF_IF_REQUIRED(sec1len + sec2len + 4 + 3); + /* Read section 2 */ if((r->read(r->read_data,tmp+i,sec2len-3,&err) != sec2len-3) || err) return err; i += sec2len-3; } - CHECK_TMP_SIZE(sec1len + sec2len + 4 + 3 ); - /* Section 3 */ for(j=0;j<3;j++) @@ -494,15 +529,13 @@ static int read_BUFR(reader *r) i++; } + GROW_BUF_IF_REQUIRED(sec1len + sec2len + sec3len + 4 + 3); + /* Read section 3 */ if((r->read(r->read_data,tmp+i,sec3len-3,&err) != sec3len-3) || err) return err; i += sec3len-3; - - CHECK_TMP_SIZE( sec1len + sec2len + sec3len + 4 + 3 ); - - for(j=0;j<3;j++) { if(r->read(r->read_data,&tmp[i],1,&err) != 1 || err) @@ -516,10 +549,50 @@ static int read_BUFR(reader *r) /* fprintf(stderr," sec1len=%d sec2len=%d sec3len=%d sec4len=%d\n",sec1len, sec2len,sec3len,sec4len); */ length = 4 + sec1len + sec2len + sec3len + sec4len + 4; /* fprintf(stderr,"length = %d i = %d\n",length,i); */ + } else if (r->headers_only) { + /* Section 1 */ + for(j=0;j<3;j++) + { + if(r->read(r->read_data,&tmp[i],1,&err) != 1 || err) + return err; + + sec1len <<= 8; + sec1len |= tmp[i]; + i++; + } + GROW_BUF_IF_REQUIRED(sec1len + 8 + 3); + if((r->read(r->read_data,tmp+i,sec1len-3,&err) != sec1len-3) || err) + return err; + i += sec1len-3; + + if (( edition==3 && (tmp[15] & (1<<7))) || + ( edition==4 && (tmp[17] & (1<<7))) ) { + /* Section 2 */ + for(j=0;j<3;j++) + { + if(r->read(r->read_data,&tmp[i],1,&err) != 1 || err) + return err; + + sec2len <<= 8; + sec2len |= tmp[i]; + i++; + } + GROW_BUF_IF_REQUIRED(sec1len + sec2len + 8 + 3); + if((r->read(r->read_data,tmp+i,sec2len-3,&err) != sec2len-3) || err) + return err; + i += sec2len-3; + + } + err=r->seek(r->read_data,length-i-1); + length=i; } - Assert(i <= sizeof(tmp)); - return read_the_rest(r,length,tmp,i); + /* Assert(i <= sizeof(tmp)); */ + err=read_the_rest(r,length,tmp,i); + + grib_buffer_delete(c,buf); + + return err; } @@ -537,30 +610,30 @@ static int read_any(reader *r,int grib_ok,int bufr_ok) switch(magic & 0xffffffff) { - case GRIB: - if(grib_ok) - { - err = read_GRIB(r); - return err == GRIB_END_OF_FILE ? GRIB_PREMATURE_END_OF_FILE : err; /* Premature EOF */ - } - break; + case GRIB: + if(grib_ok) + { + err = read_GRIB(r); + return err == GRIB_END_OF_FILE ? GRIB_PREMATURE_END_OF_FILE : err; /* Premature EOF */ + } + break; - case BUFR: - if(bufr_ok) - { - err = read_BUFR(r); - return err == GRIB_END_OF_FILE ? GRIB_PREMATURE_END_OF_FILE : err; /* Premature EOF */ - } - break; + case BUFR: + if(bufr_ok) + { + err = read_BUFR(r); + return err == GRIB_END_OF_FILE ? GRIB_PREMATURE_END_OF_FILE : err; /* Premature EOF */ + } + break; - case BUDG: - case TIDE: - if(grib_ok) - { - err = read_TIDE(r,magic == TIDE ? "TIDE" : "BUDG"); - return err == GRIB_END_OF_FILE ? GRIB_PREMATURE_END_OF_FILE : err; /* Premature EOF */ - } - break; + case BUDG: + case TIDE: + if(grib_ok) + { + err = read_TIDE(r,magic == TIDE ? "TIDE" : "BUDG"); + return err == GRIB_END_OF_FILE ? GRIB_PREMATURE_END_OF_FILE : err; /* Premature EOF */ + } + break; } } @@ -576,7 +649,7 @@ static int read_any_gts(reader *r) unsigned char* buffer=NULL; unsigned long magic = 0; unsigned long start = 0x010d0d0a; - unsigned long end = 0x0d0d0a03; + unsigned long theEnd = 0x0d0d0a03; unsigned char tmp[32]={0,}; /* Should be enough */ size_t message_size=0; size_t already_read=0; @@ -611,7 +684,7 @@ static int read_any_gts(reader *r) magic <<= 8; magic |= c; magic &= 0xffffffff; - if (magic == end) { + if (magic == theEnd) { r->seek(r->read_data,already_read-message_size); buffer = (unsigned char*)r->alloc(r->alloc_data,&message_size,&err); if (!buffer) return GRIB_OUT_OF_MEMORY; @@ -684,6 +757,7 @@ int _wmo_read_any_from_file(FILE* f,void* buffer,size_t* len,int grib_ok,int buf u.user_buffer = buffer; u.buffer_size = *len; + r.message_size = 0; r.read_data = f; r.read = &stdio_read; r.seek = &stdio_seek; @@ -692,7 +766,6 @@ int _wmo_read_any_from_file(FILE* f,void* buffer,size_t* len,int grib_ok,int buf r.alloc = &user_provider_buffer; r.headers_only = 0; - err = read_any(&r,grib_ok,bufr_ok); *len = r.message_size; @@ -723,6 +796,7 @@ int wmo_read_gts_from_file(FILE* f,void* buffer,size_t* len) u.user_buffer = buffer; u.buffer_size = *len; + r.message_size = 0; r.read_data = f; r.read = &stdio_read; r.seek = &stdio_seek; @@ -762,10 +836,10 @@ static size_t stream_read(void* data,void* buffer,size_t len,int* err) if(n != len) { /* size_t cannot be coded into long */ - *err = GRIB_INTERNAL_ERROR; - return -1; + *err = GRIB_INTERNAL_ERROR; + return -1; } - + n = s->stream_proc(s->stream_data,buffer,len); if(n != len) { *err = GRIB_IO_PROBLEM; @@ -788,6 +862,7 @@ int wmo_read_any_from_stream(void* stream_data,long (*stream_proc)(void*,void* b u.user_buffer = buffer; u.buffer_size = *len; + r.message_size = 0; r.read_data = &s; r.read = &stream_read; r.seek = &stream_seek; @@ -814,61 +889,67 @@ static void* allocate_buffer(void *data,size_t* length,int *err) return u->buffer; } -void *wmo_read_gts_from_file_malloc(FILE* f,size_t *size,int* err) +void *wmo_read_gts_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err) { alloc_buffer u; reader r; u.buffer = NULL; + r.message_size = 0; r.read_data = f; r.read = &stdio_read; r.seek = &stdio_seek; r.tell = &stdio_tell; r.alloc_data = &u; r.alloc = &allocate_buffer; - r.headers_only = 0; - + r.headers_only = headers_only; + *err = read_any_gts(&r); - *size=r.message_size; + *size = r.message_size; + *offset = r.offset; return u.buffer; } -static void *_wmo_read_any_from_file_malloc(FILE* f,int* err,size_t *size,int grib_ok,int bufr_ok) +static void *_wmo_read_any_from_file_malloc(FILE* f,int* err,size_t *size,off_t *offset, + int grib_ok,int bufr_ok,int headers_only) { alloc_buffer u; reader r; u.buffer = NULL; + r.message_size = 0; r.read_data = f; r.read = &stdio_read; r.seek = &stdio_seek; r.tell = &stdio_tell; r.alloc_data = &u; r.alloc = &allocate_buffer; - r.headers_only = 0; - + r.headers_only = headers_only; + *err = read_any(&r,grib_ok,bufr_ok); - *size=r.message_size; + *size = r.message_size; + *offset = r.offset; return u.buffer; } -void *wmo_read_any_from_file_malloc(FILE* f,size_t *size,int* err) +void *wmo_read_any_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err) { - return _wmo_read_any_from_file_malloc(f,err,size,1,1); + return _wmo_read_any_from_file_malloc(f,err,size,offset,1,1,headers_only); } -void *wmo_read_grib_from_file_malloc(FILE* f,size_t *size,int* err) +void *wmo_read_grib_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err) { - return _wmo_read_any_from_file_malloc(f,err,size,1,0); + return _wmo_read_any_from_file_malloc(f,err,size,offset,1,0,headers_only); } -void *wmo_read_bufr_from_file_malloc(FILE* f,size_t *size,int* err) +void *wmo_read_bufr_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err) { - return _wmo_read_any_from_file_malloc(f,err,size,0,1); + return _wmo_read_any_from_file_malloc(f,err,size,offset,0,1,headers_only); } + /* ======================================= */ typedef struct context_alloc_buffer { @@ -890,6 +971,7 @@ static void* context_allocate_buffer(void *data,size_t* length,int *err) +/* int grib_read_any_headers_only_from_file_alloc(grib_context* ctx,FILE* f,void **buffer,size_t* length,off_t* offset) { int err; @@ -910,9 +992,9 @@ int grib_read_any_headers_only_from_file_alloc(grib_context* ctx,FILE* f,void ** err = read_any(&r,1,GRIB_API_READS_BUFR); - *buffer = u.buffer; - *length = u.length; - *offset = r.offset; + *buffer = u.buffer; + *length = u.length; + *offset = r.offset; return err; } @@ -937,11 +1019,12 @@ int grib_read_any_from_file_alloc(grib_context* ctx,FILE* f,void **buffer,size_t err = read_any(&r,1,GRIB_API_READS_BUFR); - *buffer = u.buffer; - *length = u.length; + *buffer = u.buffer; + *length = u.length; return err; } + */ int grib_read_any_headers_only_from_file(grib_context* ctx,FILE* f,void* buffer,size_t* len) @@ -953,6 +1036,7 @@ int grib_read_any_headers_only_from_file(grib_context* ctx,FILE* f,void* buffer, u.user_buffer = buffer; u.buffer_size = *len; + r.message_size = 0; r.read_data = f; r.read = &stdio_read; r.seek = &stdio_seek; @@ -973,11 +1057,12 @@ int grib_read_any_from_file(grib_context* ctx,FILE* f,void* buffer,size_t* len) int err; user_buffer u; reader r; - off_t offset; + off_t offset; u.user_buffer = buffer; u.buffer_size = *len; + r.message_size = 0; r.read_data = f; r.read = &stdio_read; r.seek = &stdio_seek; @@ -986,14 +1071,13 @@ int grib_read_any_from_file(grib_context* ctx,FILE* f,void* buffer,size_t* len) r.alloc = &user_provider_buffer; r.headers_only = 0; - offset=ftello(f); err = read_any(&r,1,GRIB_API_READS_BUFR); if (err==GRIB_BUFFER_TOO_SMALL) { - if (fseeko(f,offset,SEEK_SET)) - err=GRIB_IO_PROBLEM; + if (fseeko(f,offset,SEEK_SET)) + err=GRIB_IO_PROBLEM; } *len = r.message_size; @@ -1051,6 +1135,7 @@ int grib_read_any_from_memory_alloc(grib_context* ctx,unsigned char** data,size_ u.length = 0; u.ctx = ctx ? ctx : grib_context_get_default(); + r.message_size = 0; r.read_data = &m; r.read = &memory_read; r.seek = &memory_seek; @@ -1080,10 +1165,10 @@ int grib_read_any_from_memory(grib_context* ctx,unsigned char** data,size_t* dat m.data = *data; m.data_len = *data_length; - u.user_buffer = buffer; u.buffer_size = *len; + r.message_size = 0; r.read_data = &m; r.read = &memory_read; r.seek = &memory_seek; @@ -1106,12 +1191,13 @@ int grib_count_in_file(grib_context* c, FILE* f,int* n) { int err=0; void* mesg=NULL; size_t size=0; + off_t offset=0; *n=0; if (!c) c=grib_context_get_default(); - while ( (err=grib_read_any_from_file_alloc (c, f, &mesg , &size))==GRIB_SUCCESS) { - grib_context_free(c,mesg); - (*n)++; + while ( (mesg=wmo_read_any_from_file_malloc ( f,0, &size,&offset,&err))!=NULL && err==GRIB_SUCCESS) { + grib_context_free(c,mesg); + (*n)++; } rewind(f); @@ -1120,5 +1206,3 @@ int grib_count_in_file(grib_context* c, FILE* f,int* n) { } - - diff --git a/src/grib_jasper_encoding.c b/src/grib_jasper_encoding.c index 6da8e3374..7fee68191 100644 --- a/src/grib_jasper_encoding.c +++ b/src/grib_jasper_encoding.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api_internal.h" #if HAVE_LIBJASPER @@ -143,7 +153,12 @@ int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper) { if( helper->compression != 0) { /* Lossy */ - snprintf(opts,MAXOPTSSIZE,"mode=real\nrate=%f",1.0/helper->compression); +#ifndef _WIN32 + snprintf (opts, MAXOPTSSIZE, "mode=real\nrate=%f", 1.0/helper->compression); +#else + /* Microsoft Windows Visual Studio support */ + _snprintf(opts, MAXOPTSSIZE, "mode=real\nrate=%f", 1.0/helper->compression); +#endif } Assert(cmpt.width_ * cmpt.height_ * cmpt.cps_ == buflen); diff --git a/src/grib_keys_iterator.c b/src/grib_keys_iterator.c index c62664eef..c07febca0 100644 --- a/src/grib_keys_iterator.c +++ b/src/grib_keys_iterator.c @@ -13,9 +13,6 @@ * * Description: * - * - * - * */ #include "grib_api_internal.h" @@ -70,7 +67,7 @@ int grib_keys_iterator_set_flags(grib_keys_iterator* ki,unsigned long flags) { h=ki->handle; - if(flags & GRIB_KEYS_ITERATOR_SKIP_DUPLICATES && ki->seen!=NULL ) + if((flags & GRIB_KEYS_ITERATOR_SKIP_DUPLICATES) && ki->seen!=NULL ) ki->seen = grib_trie_new(h->context); if(flags & GRIB_KEYS_ITERATOR_SKIP_FUNCTION) diff --git a/src/grib_lex.c b/src/grib_lex.c index a52b4ec0e..7def92ebf 100644 --- a/src/grib_lex.c +++ b/src/grib_lex.c @@ -359,8 +359,8 @@ static void grib_yy_fatal_error (grib_yyconst char msg[] ); *grib_yy_cp = '\0'; \ (grib_yy_c_buf_p) = grib_yy_cp; -#define YY_NUM_RULES 101 -#define YY_END_OF_BUFFER 102 +#define YY_NUM_RULES 99 +#define YY_END_OF_BUFFER 100 /* This struct is not used in this scanner, but its presence is necessary. */ struct grib_yy_trans_info @@ -368,65 +368,64 @@ struct grib_yy_trans_info flex_int32_t grib_yy_verify; flex_int32_t grib_yy_nxt; }; -static grib_yyconst flex_int16_t grib_yy_accept[514] = +static grib_yyconst flex_int16_t grib_yy_accept[502] = { 0, - 98, 98, 102, 100, 98, 99, 10, 90, 97, 100, - 100, 100, 93, 100, 100, 100, 92, 92, 92, 91, + 96, 96, 100, 98, 96, 97, 10, 90, 95, 98, + 98, 93, 98, 98, 98, 92, 92, 92, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 98, + 16, 96, 4, 12, 0, 0, 93, 3, 5, 1, + 2, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 100, 16, 98, 4, 12, 96, 95, 0, 94, 93, - 0, 3, 5, 1, 2, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 18, 92, 8, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 13, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 18, - 92, 8, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 13, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 14, - 0, 94, 0, 0, 96, 92, 19, 92, 11, 92, - 92, 92, 6, 54, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 30, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 14, 94, 92, 19, 92, + 11, 92, 92, 92, 6, 54, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 30, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 9, 92, 92, 42, - 92, 92, 92, 92, 92, 77, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 0, 95, - 0, 0, 94, 92, 92, 92, 92, 92, 23, 92, - 80, 92, 92, 92, 92, 92, 92, 69, 92, 20, - + 92, 92, 92, 92, 92, 92, 92, 92, 9, 92, + 92, 42, 92, 92, 92, 92, 92, 77, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 55, 92, 92, 25, 92, 92, 92, 92, 38, 92, - 92, 92, 92, 92, 15, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 88, 92, 92, 92, 92, 92, - 92, 92, 79, 92, 92, 0, 94, 92, 45, 92, - 22, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 36, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 24, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 40, 92, 87, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 26, + 0, 92, 92, 92, 92, 92, 23, 92, 80, 92, + 92, 92, 92, 92, 92, 69, 92, 20, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 55, 92, - 85, 92, 86, 65, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 62, 92, 92, 92, 92, 71, 92, - 92, 92, 92, 92, 64, 92, 37, 92, 92, 58, - 92, 92, 92, 7, 92, 92, 92, 92, 92, 63, - 92, 92, 33, 92, 81, 92, 92, 92, 92, 92, - 73, 92, 92, 92, 83, 92, 92, 76, 82, 92, - 56, 92, 92, 92, 92, 92, 89, 92, 92, 92, - 92, 44, 53, 67, 70, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 29, 46, 92, 92, 92, - 92, 92, 48, 92, 92, 92, 92, 92, 31, 92, + 92, 25, 92, 92, 92, 92, 38, 92, 92, 92, + 92, 92, 15, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 88, 92, 92, 92, 92, 92, 92, 92, + 79, 92, 92, 0, 94, 92, 45, 92, 22, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 36, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 24, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 40, 92, 87, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 26, 85, 92, + 86, 65, 92, 92, 92, 92, 92, 92, 92, 92, - 52, 92, 92, 92, 75, 92, 92, 47, 92, 92, - 92, 92, 27, 92, 21, 92, 34, 92, 92, 92, - 92, 92, 92, 92, 32, 92, 51, 17, 39, 92, - 66, 92, 92, 92, 92, 49, 92, 92, 92, 74, - 92, 92, 92, 92, 92, 92, 92, 78, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 57, 92, 92, - 50, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 41, - 92, 92, 72, 92, 84, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 43, 28, 92, 68, + 92, 62, 92, 92, 92, 92, 71, 92, 92, 92, + 92, 92, 64, 92, 37, 92, 92, 58, 92, 92, + 92, 7, 92, 92, 92, 92, 92, 63, 92, 92, + 33, 92, 81, 92, 92, 92, 92, 92, 73, 92, + 92, 92, 83, 92, 92, 76, 82, 92, 56, 92, + 92, 92, 92, 92, 89, 92, 92, 92, 92, 44, + 53, 67, 70, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 29, 46, 92, 92, 92, 92, 92, + 48, 92, 92, 92, 92, 92, 31, 92, 52, 92, + 92, 92, 75, 92, 92, 47, 92, 92, 92, 92, - 92, 92, 92, 35, 92, 60, 92, 92, 61, 92, - 92, 59, 0 + 27, 92, 21, 92, 34, 92, 92, 92, 92, 92, + 92, 92, 32, 92, 51, 17, 39, 92, 66, 92, + 92, 92, 92, 49, 92, 92, 92, 74, 92, 92, + 92, 92, 92, 92, 92, 78, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 57, 92, 92, 50, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 41, 92, 92, + 72, 92, 84, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 43, 28, 92, 68, 92, 92, + 92, 35, 92, 60, 92, 92, 61, 92, 92, 59, + + 0 } ; static grib_yyconst flex_int32_t grib_yy_ec[256] = @@ -470,606 +469,588 @@ static grib_yyconst flex_int32_t grib_yy_meta[51] = 2, 2, 2, 2, 2, 2, 2, 2, 1, 1 } ; -static grib_yyconst flex_int16_t grib_yy_base[516] = +static grib_yyconst flex_int16_t grib_yy_base[504] = { 0, - 0, 0, 364, 2099, 357, 2099, 342, 2099, 2099, 349, - 40, 43, 48, 47, 339, 320, 56, 59, 62, 2099, - 69, 74, 77, 80, 83, 59, 115, 120, 128, 62, - 123, 111, 112, 161, 149, 113, 150, 169, 200, 203, - 284, 2099, 330, 2099, 2099, 209, 212, 220, 234, 244, - 254, 2099, 2099, 2099, 2099, 0, 237, 247, 260, 264, - 267, 270, 273, 276, 281, 291, 125, 271, 305, 309, - 313, 318, 326, 329, 332, 303, 337, 340, 350, 359, - 362, 370, 373, 376, 380, 383, 386, 397, 389, 400, - 404, 413, 427, 407, 434, 437, 440, 446, 449, 456, + 0, 0, 423, 2023, 416, 2023, 395, 2023, 2023, 401, + 40, 44, 43, 392, 368, 49, 52, 55, 2023, 58, + 63, 66, 69, 72, 48, 104, 109, 117, 87, 124, + 100, 112, 120, 136, 142, 148, 154, 185, 188, 333, + 2023, 377, 2023, 2023, 192, 195, 199, 2023, 2023, 2023, + 2023, 0, 202, 205, 213, 219, 222, 225, 228, 234, + 237, 246, 131, 226, 260, 263, 267, 270, 274, 281, + 284, 350, 293, 296, 302, 305, 312, 315, 318, 323, + 330, 326, 333, 338, 343, 349, 354, 357, 360, 376, + 379, 382, 386, 390, 393, 401, 404, 409, 414, 420, - 459, 466, 476, 481, 484, 152, 472, 479, 486, 2099, - 515, 518, 526, 521, 529, 532, 538, 541, 545, 548, - 551, 557, 560, 563, 568, 571, 577, 580, 588, 591, - 600, 603, 609, 612, 623, 619, 626, 629, 167, 633, - 639, 645, 655, 660, 665, 668, 671, 674, 677, 683, - 693, 699, 702, 708, 713, 718, 721, 724, 727, 732, - 739, 744, 750, 753, 758, 765, 772, 775, 782, 785, - 791, 794, 801, 806, 809, 812, 823, 826, 833, 836, - 842, 845, 849, 852, 855, 862, 865, 868, 871, 874, - 877, 880, 883, 891, 894, 900, 903, 914, 917, 920, + 426, 419, 422, 436, 439, 2023, 429, 468, 471, 474, + 477, 481, 484, 490, 493, 496, 501, 504, 510, 513, + 521, 524, 533, 536, 542, 545, 556, 552, 559, 562, + 434, 566, 572, 578, 588, 593, 598, 601, 604, 607, + 610, 616, 626, 632, 635, 641, 646, 651, 654, 657, + 660, 665, 672, 677, 683, 686, 691, 698, 705, 708, + 715, 718, 724, 727, 734, 739, 742, 745, 756, 759, + 768, 773, 776, 783, 786, 792, 795, 798, 801, 804, + 815, 811, 818, 824, 827, 831, 841, 844, 847, 851, + 337, 329, 328, 854, 861, 868, 857, 874, 878, 883, - 923, 927, 297, 284, 282, 930, 937, 944, 933, 950, - 954, 959, 967, 970, 973, 976, 980, 987, 990, 993, - 996, 1003, 1006, 1016, 1022, 1025, 1028, 1032, 1035, 1040, - 1043, 1046, 1049, 1059, 1070, 1073, 1079, 1082, 1085, 1088, - 1091, 1097, 1101, 1104, 1110, 1119, 1124, 1130, 1133, 1136, - 1142, 1145, 1148, 1151, 1155, 1158, 1161, 1168, 1178, 1171, - 1181, 1184, 1188, 270, 263, 271, 1192, 1200, 1204, 1208, - 1214, 267, 1220, 1223, 1230, 1234, 1237, 1240, 1247, 1250, - 1256, 1264, 1267, 1270, 1275, 1288, 1278, 1295, 1302, 1305, - 1308, 1312, 1316, 1324, 1327, 1338, 1343, 1348, 1351, 1354, + 891, 894, 897, 900, 904, 911, 914, 917, 920, 927, + 930, 940, 946, 949, 952, 956, 959, 964, 967, 970, + 973, 983, 994, 997, 1003, 1006, 1009, 1012, 1015, 1021, + 1025, 1028, 1034, 1043, 1048, 1054, 1057, 1060, 1066, 1069, + 1072, 1075, 1079, 1082, 1085, 1092, 1102, 1095, 1105, 1108, + 1112, 316, 305, 292, 1116, 1124, 1128, 1132, 1138, 289, + 1144, 1147, 1154, 1158, 1161, 1164, 1171, 1174, 1180, 1188, + 1191, 1194, 1199, 1212, 1202, 1219, 1226, 1229, 1232, 1236, + 1240, 1248, 1251, 1262, 1267, 1272, 1275, 1278, 1281, 1288, + 1291, 1297, 1303, 1306, 1309, 1312, 1319, 1323, 1326, 1329, - 1357, 1364, 1367, 1373, 1379, 1382, 1385, 1388, 1395, 1399, - 1402, 1405, 1408, 1411, 1415, 264, 248, 226, 1423, 1427, - 1430, 1438, 1443, 221, 1448, 1451, 1454, 1459, 1462, 1465, - 1468, 1475, 1478, 1482, 1489, 1485, 1492, 1495, 1504, 1508, - 1513, 1516, 1520, 1526, 1532, 1541, 1544, 1547, 1550, 1553, - 1556, 1559, 1564, 1567, 1574, 1582, 1590, 1593, 1596, 1599, - 1602, 237, 225, 209, 1605, 1608, 1615, 1618, 201, 1624, - 1627, 1630, 1633, 1638, 1641, 1644, 1649, 1654, 1659, 1664, - 1669, 1672, 1675, 1683, 1690, 1693, 1696, 1703, 1699, 1708, - 1711, 1714, 1718, 1723, 1729, 213, 205, 196, 1732, 1735, + 1332, 1335, 1339, 280, 260, 256, 1347, 1351, 1354, 1362, + 1367, 251, 1372, 1375, 1378, 1383, 1386, 1389, 1392, 1399, + 1402, 1406, 1413, 1409, 1416, 1419, 1428, 1432, 1437, 1440, + 1444, 1450, 1456, 1465, 1468, 1471, 1474, 1477, 1480, 1483, + 1488, 1491, 1498, 1506, 1514, 1517, 1520, 1523, 1526, 266, + 262, 235, 1529, 1532, 1539, 1542, 227, 1548, 1551, 1554, + 1557, 1562, 1565, 1568, 1573, 1578, 1583, 1588, 1593, 1596, + 1599, 1607, 1614, 1617, 1620, 1627, 1623, 1632, 1635, 1638, + 1642, 1647, 1653, 234, 228, 215, 1656, 1659, 1662, 207, + 1666, 1669, 1675, 1678, 1681, 1692, 1695, 1698, 1701, 1706, - 1738, 189, 1742, 1745, 1751, 1754, 1757, 1768, 1771, 1774, - 1777, 1782, 1785, 1790, 1793, 1804, 1809, 1812, 1815, 1823, - 1827, 181, 198, 188, 1830, 187, 1836, 1844, 1847, 1850, - 1857, 1860, 1863, 1866, 1869, 1876, 1879, 1882, 1885, 1889, - 1892, 164, 181, 188, 157, 1897, 1901, 1906, 1912, 1915, - 1921, 1927, 1932, 1935, 167, 158, 168, 0, 1938, 1948, - 1953, 1956, 1959, 1967, 1970, 1973, 163, 151, 141, 1978, - 1981, 1987, 1990, 2005, 2008, 2012, 141, 122, 118, 2015, - 2021, 2024, 2027, 2034, 2037, 2040, 105, 108, 91, 2043, - 2051, 2054, 2057, 91, 75, 85, 2060, 2065, 2068, 2071, + 1709, 1714, 1717, 1728, 1733, 1736, 1739, 1747, 1751, 195, + 212, 189, 1754, 192, 1760, 1768, 1771, 1774, 1781, 1784, + 1787, 1790, 1793, 1800, 1803, 1806, 1809, 1813, 1816, 177, + 195, 179, 149, 1821, 1825, 1830, 1836, 1839, 1845, 1851, + 1856, 1859, 159, 150, 161, 0, 1862, 1872, 1877, 1880, + 1883, 1891, 1894, 1897, 155, 134, 116, 1902, 1905, 1911, + 1914, 1929, 1932, 1936, 121, 107, 111, 1939, 1945, 1948, + 1951, 1958, 1961, 1964, 101, 96, 86, 1967, 1975, 1978, + 1981, 89, 66, 75, 1984, 1989, 1992, 1995, 76, 71, + 60, 2004, 64, 0, 60, 55, 0, 61, 53, 0, - 85, 81, 63, 2080, 63, 0, 51, 47, 0, 51, - 44, 0, 2099, 63, 62 + 2023, 81, 71 } ; -static grib_yyconst flex_int16_t grib_yy_def[516] = +static grib_yyconst flex_int16_t grib_yy_def[504] = { 0, - 513, 1, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 514, 514, 514, 513, - 514, 514, 514, 514, 21, 21, 514, 514, 21, 21, - 514, 31, 31, 514, 31, 31, 31, 31, 514, 514, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 515, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 21, 21, 514, 514, - 514, 514, 514, 514, 514, 515, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, + 501, 1, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 502, 502, 502, 501, 502, + 502, 502, 502, 20, 20, 502, 502, 20, 20, 502, + 30, 30, 502, 30, 30, 30, 30, 502, 502, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 503, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 20, 20, 502, 502, 502, 502, 502, 502, + 502, 503, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, - 514, 514, 514, 514, 514, 31, 31, 31, 31, 513, - 513, 513, 513, 513, 513, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 515, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 513, 513, - 513, 513, 513, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, + 502, 30, 30, 30, 30, 501, 501, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 503, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 501, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 503, 503, 503, 502, 502, 502, 502, 502, 502, 502, - 514, 514, 515, 515, 515, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 513, 513, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 515, 515, 515, 514, 514, 514, 514, - 514, 515, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 501, 501, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 503, 503, 503, 502, 502, 502, 502, 502, 503, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 515, 515, 515, 514, 514, - 514, 514, 514, 515, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 515, 515, 515, 514, 514, 514, 514, 515, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 515, 515, 515, 514, 514, + 502, 502, 502, 503, 503, 503, 502, 502, 502, 502, + 502, 503, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 503, + 503, 503, 502, 502, 502, 502, 503, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 503, 503, 503, 502, 502, 502, 503, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, - 514, 515, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 515, 515, 515, 514, 515, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 515, 515, 515, 515, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 515, 515, 515, 515, 514, 514, - 514, 514, 514, 514, 514, 514, 515, 515, 515, 514, - 514, 514, 514, 514, 514, 514, 515, 515, 515, 514, - 514, 514, 514, 514, 514, 514, 515, 515, 515, 514, - 514, 514, 514, 515, 515, 515, 514, 514, 514, 514, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 503, + 503, 503, 502, 503, 502, 502, 502, 502, 502, 502, + 502, 502, 502, 502, 502, 502, 502, 502, 502, 503, + 503, 503, 503, 502, 502, 502, 502, 502, 502, 502, + 502, 502, 503, 503, 503, 503, 502, 502, 502, 502, + 502, 502, 502, 502, 503, 503, 503, 502, 502, 502, + 502, 502, 502, 502, 503, 503, 503, 502, 502, 502, + 502, 502, 502, 502, 503, 503, 503, 502, 502, 502, + 502, 503, 503, 503, 502, 502, 502, 502, 503, 503, + 503, 502, 503, 503, 503, 503, 503, 503, 503, 503, - 515, 515, 515, 514, 515, 515, 515, 515, 515, 515, - 515, 515, 0, 513, 513 + 0, 501, 501 } ; -static grib_yyconst flex_int16_t grib_yy_nxt[2150] = +static grib_yyconst flex_int16_t grib_yy_nxt[2074] = { 0, - 4, 5, 6, 7, 8, 9, 10, 8, 11, 12, - 13, 13, 13, 14, 15, 16, 17, 17, 17, 17, - 18, 17, 17, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 17, 40, 17, 17, 41, 42, - 46, 46, 46, 47, 47, 47, 48, 49, 50, 50, - 50, 52, 53, 56, 57, 51, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 512, 511, 51, 58, 56, - 56, 56, 510, 509, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 508, 75, 59, 57, 57, 57, 57, + 4, 5, 6, 7, 8, 9, 10, 8, 11, 4, + 12, 12, 12, 13, 14, 15, 16, 16, 16, 16, + 17, 16, 16, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 16, 39, 16, 16, 40, 41, + 45, 45, 45, 46, 47, 47, 47, 48, 49, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 54, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 53, 71, 500, 53, 499, 53, 55, 53, + 498, 63, 497, 56, 496, 57, 60, 58, 65, 59, - 57, 57, 67, 84, 60, 507, 61, 64, 62, 69, - 63, 71, 65, 506, 505, 68, 503, 502, 72, 501, - 73, 66, 57, 70, 57, 56, 76, 56, 496, 74, - 56, 56, 56, 56, 56, 56, 57, 57, 57, 495, - 89, 91, 99, 494, 57, 57, 57, 489, 85, 90, - 92, 57, 86, 77, 78, 93, 87, 79, 80, 488, - 57, 88, 126, 57, 57, 81, 127, 57, 487, 82, - 83, 56, 56, 56, 96, 57, 479, 172, 57, 100, - 478, 57, 57, 101, 102, 173, 477, 97, 57, 98, - 57, 469, 103, 468, 57, 104, 467, 458, 105, 203, + 67, 61, 495, 494, 64, 493, 491, 68, 490, 69, + 62, 53, 66, 53, 52, 72, 52, 489, 70, 52, + 52, 52, 53, 484, 53, 53, 53, 483, 80, 85, + 52, 52, 52, 53, 52, 52, 52, 53, 86, 482, + 477, 87, 73, 74, 476, 53, 75, 76, 475, 81, + 88, 467, 53, 82, 77, 89, 53, 83, 78, 79, + 90, 92, 84, 466, 91, 53, 53, 53, 118, 53, + 53, 95, 119, 53, 93, 53, 94, 96, 465, 53, + 53, 97, 98, 101, 457, 456, 53, 53, 455, 446, + 99, 445, 53, 100, 102, 52, 52, 52, 52, 52, - 457, 94, 57, 204, 456, 95, 455, 57, 205, 106, - 56, 56, 56, 56, 56, 56, 445, 48, 49, 46, - 46, 46, 47, 47, 47, 444, 51, 443, 442, 111, - 46, 46, 46, 426, 424, 108, 423, 107, 51, 422, - 402, 111, 398, 109, 112, 112, 112, 56, 56, 56, - 397, 113, 48, 49, 50, 50, 50, 56, 56, 56, - 396, 51, 114, 113, 115, 115, 115, 369, 364, 116, - 56, 56, 56, 51, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 363, - 117, 56, 56, 56, 362, 119, 324, 118, 318, 128, + 52, 46, 45, 45, 45, 107, 107, 107, 46, 47, + 47, 47, 52, 52, 52, 52, 52, 52, 444, 443, + 104, 433, 103, 52, 52, 52, 432, 108, 105, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 431, 430, 109, 52, 52, 52, 52, 52, 52, + 111, 414, 110, 412, 120, 113, 52, 52, 52, 411, + 410, 53, 121, 122, 112, 123, 390, 53, 386, 114, + 52, 52, 52, 52, 52, 52, 115, 52, 52, 52, + 52, 52, 52, 116, 52, 52, 52, 385, 117, 384, + 124, 52, 52, 52, 52, 52, 52, 357, 352, 125, - 121, 56, 56, 56, 317, 316, 57, 129, 130, 120, - 131, 266, 57, 265, 122, 56, 56, 56, 123, 56, - 56, 56, 264, 56, 56, 56, 139, 124, 56, 56, - 56, 43, 110, 125, 55, 132, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 133, 134, 56, 56, 56, - 56, 56, 56, 54, 136, 45, 44, 138, 43, 135, - 56, 56, 56, 513, 513, 140, 513, 513, 137, 56, - 56, 56, 56, 56, 56, 513, 141, 513, 513, 142, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 143, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 126, 351, 128, 52, 52, 52, 52, 52, 52, 130, + 350, 127, 52, 52, 52, 52, 52, 52, 312, 306, + 129, 132, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 134, 133, 52, 52, 52, 52, 52, 52, 135, + 52, 52, 52, 52, 52, 52, 305, 136, 52, 52, + 52, 304, 137, 52, 52, 52, 138, 254, 253, 52, + 52, 52, 252, 139, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 131, 140, 141, 142, 146, 42, 147, + 148, 106, 51, 143, 144, 145, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 150, 52, 52, 52, 149, - 56, 56, 144, 513, 513, 145, 146, 56, 56, 56, - 56, 56, 56, 513, 56, 56, 56, 56, 56, 56, - 147, 513, 513, 56, 56, 56, 513, 148, 154, 155, - 152, 153, 513, 513, 149, 150, 156, 56, 56, 56, - 513, 513, 151, 513, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 513, 513, 157, 56, 56, 56, 56, - 56, 56, 158, 159, 513, 160, 56, 56, 56, 56, - 56, 56, 513, 513, 163, 513, 56, 56, 56, 162, - 513, 161, 513, 165, 513, 164, 56, 56, 56, 513, - 167, 56, 56, 56, 56, 56, 56, 174, 166, 168, + 52, 52, 52, 52, 52, 52, 50, 44, 151, 43, + 152, 52, 52, 52, 52, 52, 52, 42, 155, 52, + 52, 52, 501, 154, 52, 52, 52, 153, 157, 156, + 52, 52, 52, 501, 501, 159, 52, 52, 52, 107, + 107, 107, 160, 158, 164, 501, 171, 166, 53, 501, + 501, 53, 165, 162, 161, 53, 501, 53, 171, 501, + 53, 53, 163, 167, 53, 168, 191, 501, 53, 169, + 192, 501, 170, 501, 53, 193, 501, 53, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 172, 52, 52, 52, 52, 52, 52, 501, 501, 173, - 513, 57, 513, 513, 57, 57, 513, 513, 176, 513, - 57, 57, 177, 175, 170, 57, 169, 57, 513, 178, - 171, 513, 513, 179, 57, 180, 180, 180, 112, 112, - 112, 115, 115, 115, 182, 181, 183, 183, 183, 115, - 115, 115, 56, 56, 56, 513, 513, 181, 56, 56, - 56, 56, 56, 56, 184, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 513, 513, 185, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 513, 186, 56, 56, - 56, 56, 56, 56, 187, 513, 188, 56, 56, 56, - 56, 56, 56, 513, 190, 513, 513, 189, 56, 56, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 501, + 174, 52, 52, 52, 52, 52, 52, 175, 501, 176, + 52, 52, 52, 52, 52, 52, 501, 178, 501, 501, + 177, 52, 52, 52, 52, 52, 52, 501, 501, 179, + 501, 501, 180, 52, 52, 52, 52, 52, 52, 501, + 501, 182, 52, 52, 52, 52, 52, 52, 501, 501, + 181, 185, 52, 52, 52, 183, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 501, 52, 52, 52, 501, + 184, 186, 52, 52, 52, 188, 501, 187, 52, 52, + 52, 501, 501, 190, 194, 501, 501, 189, 52, 52, - 56, 56, 56, 56, 513, 513, 191, 513, 513, 192, - 56, 56, 56, 56, 56, 56, 513, 513, 194, 56, - 56, 56, 56, 56, 56, 513, 513, 193, 197, 56, - 56, 56, 195, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 513, 56, 56, 56, 513, 196, 198, 56, - 56, 56, 200, 513, 199, 56, 56, 56, 513, 513, - 202, 206, 513, 513, 201, 56, 56, 56, 513, 207, - 56, 56, 56, 513, 208, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 209, 513, 211, 56, 56, 56, 513, 212, 513, 513, + 52, 501, 195, 52, 52, 52, 501, 196, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 197, 501, 199, 52, 52, 52, 501, + 200, 501, 501, 198, 501, 201, 52, 52, 52, 501, + 501, 203, 52, 52, 52, 52, 52, 52, 501, 202, + 204, 52, 52, 52, 501, 205, 52, 52, 52, 501, + 207, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 206, 208, 52, 52, 52, 210, 501, + 212, 211, 52, 52, 52, 501, 209, 52, 52, 52, + 501, 501, 213, 52, 52, 52, 52, 52, 52, 501, - 210, 513, 213, 56, 56, 56, 513, 513, 215, 56, - 56, 56, 56, 56, 56, 513, 214, 216, 56, 56, - 56, 513, 217, 56, 56, 56, 513, 219, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 218, 220, 56, 56, 56, 222, 513, 224, 223, 56, - 56, 56, 513, 221, 56, 56, 56, 513, 513, 225, - 56, 56, 56, 56, 56, 56, 513, 226, 56, 56, - 56, 513, 228, 513, 227, 56, 56, 56, 230, 513, - 513, 229, 56, 56, 56, 56, 56, 56, 233, 513, - 513, 231, 56, 56, 56, 56, 56, 56, 513, 513, + 214, 52, 52, 52, 501, 216, 501, 215, 52, 52, + 52, 218, 501, 501, 217, 52, 52, 52, 52, 52, + 52, 221, 501, 501, 219, 52, 52, 52, 52, 52, + 52, 501, 501, 220, 52, 52, 52, 52, 52, 52, + 501, 501, 222, 501, 52, 52, 52, 223, 224, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 501, 501, + 225, 501, 501, 226, 227, 228, 52, 52, 52, 52, + 52, 52, 501, 501, 229, 230, 234, 501, 235, 235, + 235, 501, 231, 52, 52, 52, 52, 52, 52, 501, + 501, 232, 236, 52, 52, 52, 52, 52, 52, 501, - 232, 56, 56, 56, 56, 56, 56, 513, 513, 234, - 513, 56, 56, 56, 235, 236, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 513, 513, 237, 513, 513, - 238, 239, 240, 56, 56, 56, 56, 56, 56, 513, - 513, 241, 242, 180, 180, 180, 180, 180, 180, 243, - 246, 513, 247, 247, 247, 183, 183, 183, 244, 183, - 183, 183, 56, 56, 56, 56, 56, 56, 245, 513, - 513, 248, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 249, 513, 251, 250, + 501, 233, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 237, 501, 239, + 238, 52, 52, 52, 241, 52, 52, 52, 52, 52, + 52, 501, 240, 501, 52, 52, 52, 52, 52, 52, + 244, 52, 52, 52, 501, 501, 242, 246, 501, 501, + 243, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 245, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 247, 52, 52, 52, 248, 501, 501, 250, 52, 52, + 52, 501, 501, 255, 52, 52, 52, 249, 52, 260, + 52, 501, 251, 52, 52, 52, 256, 501, 257, 259, - 253, 56, 56, 56, 56, 56, 56, 513, 252, 513, - 56, 56, 56, 56, 56, 56, 513, 513, 255, 513, - 256, 513, 254, 258, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 257, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 259, 56, 56, 56, - 260, 513, 513, 262, 56, 56, 56, 513, 513, 267, - 56, 56, 56, 261, 56, 272, 56, 513, 263, 56, - 56, 56, 268, 513, 269, 271, 270, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 513, - 56, 56, 56, 513, 273, 513, 275, 56, 56, 56, + 258, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 501, 52, 52, 52, 501, 261, 501, + 263, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 262, 501, 501, 266, 52, 52, 52, + 52, 52, 52, 264, 265, 501, 501, 267, 501, 268, + 52, 52, 52, 501, 501, 270, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 269, 52, 52, 52, 52, + 52, 52, 501, 271, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 501, 276, 501, 272, + 273, 501, 501, 52, 52, 52, 501, 501, 274, 501, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 274, - 513, 513, 278, 56, 56, 56, 56, 56, 56, 276, - 277, 513, 513, 279, 513, 280, 56, 56, 56, 513, - 513, 282, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 281, 56, 56, 56, 56, 56, 56, 513, 283, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 513, 288, 513, 284, 285, 513, 513, 56, - 56, 56, 513, 513, 286, 513, 513, 287, 513, 290, - 56, 56, 56, 56, 56, 56, 291, 289, 292, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 501, 275, 501, 278, 52, 52, 52, 52, 52, 52, + 279, 277, 280, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 501, 501, + 282, 52, 52, 52, 281, 52, 52, 52, 52, 52, + 52, 283, 501, 285, 52, 52, 52, 501, 286, 501, + 284, 501, 287, 235, 235, 235, 501, 288, 235, 235, + 235, 501, 501, 289, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 501, 501, 290, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 291, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 501, 501, - 56, 56, 56, 56, 513, 513, 294, 56, 56, 56, - 293, 56, 56, 56, 56, 56, 56, 295, 513, 297, - 56, 56, 56, 513, 298, 513, 296, 513, 299, 247, - 247, 247, 513, 300, 247, 247, 247, 513, 513, 301, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 513, - 513, 302, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 303, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 513, 513, 306, 305, 56, 56, - 56, 56, 56, 56, 307, 513, 309, 304, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 308, 56, 56, + 294, 293, 52, 52, 52, 52, 52, 52, 295, 501, + 297, 292, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 296, 52, 52, 52, 298, 52, 52, 52, 501, + 299, 501, 501, 301, 52, 52, 52, 300, 52, 52, + 52, 303, 52, 52, 52, 501, 501, 302, 52, 52, + 52, 501, 501, 307, 52, 52, 52, 52, 52, 52, + 310, 501, 308, 309, 52, 52, 52, 501, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 501, 501, 313, + 311, 52, 52, 52, 52, 52, 52, 501, 316, 501, + 52, 52, 52, 501, 501, 317, 314, 315, 52, 52, - 56, 310, 56, 56, 56, 513, 311, 513, 513, 313, - 56, 56, 56, 312, 56, 56, 56, 315, 56, 56, - 56, 513, 513, 314, 56, 56, 56, 513, 513, 319, - 56, 56, 56, 56, 56, 56, 322, 513, 320, 321, - 56, 56, 56, 513, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 513, 513, 325, 323, 56, 56, 56, - 56, 56, 56, 513, 328, 513, 56, 56, 56, 513, - 513, 329, 326, 327, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 513, 513, 56, 56, 56, 56, 56, - 56, 331, 513, 513, 330, 332, 513, 333, 56, 56, + 52, 52, 52, 52, 52, 52, 52, 501, 501, 52, + 52, 52, 52, 52, 52, 319, 501, 501, 318, 320, + 501, 321, 52, 52, 52, 501, 501, 323, 324, 52, + 52, 52, 501, 322, 501, 325, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 326, 52, 52, 52, 501, + 52, 52, 52, 501, 501, 328, 501, 327, 52, 52, + 52, 52, 52, 52, 331, 501, 501, 329, 501, 501, + 330, 332, 52, 52, 52, 501, 334, 52, 52, 52, + 333, 501, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 501, 335, 336, 337, 52, 52, - 56, 513, 513, 335, 336, 56, 56, 56, 513, 334, - 513, 337, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 338, 56, 56, 56, 513, 56, 56, 56, 513, - 513, 340, 513, 339, 56, 56, 56, 56, 56, 56, - 343, 513, 513, 341, 513, 513, 342, 344, 56, 56, - 56, 513, 346, 56, 56, 56, 345, 513, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 513, 347, 348, 349, 56, 56, 56, 56, 56, 56, - 513, 513, 351, 56, 56, 56, 513, 513, 350, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 52, 52, 52, 52, 501, 501, 339, 52, 52, 52, + 501, 501, 338, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 501, 340, 501, 501, 52, + 52, 52, 341, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 345, 52, + 52, 52, 501, 501, 343, 342, 344, 52, 52, 52, + 346, 52, 52, 52, 52, 52, 52, 501, 501, 348, + 501, 347, 52, 52, 52, 501, 353, 52, 52, 52, + 501, 349, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 355, 354, 52, 52, 52, 52, 52, 52, 52, - 56, 513, 352, 513, 513, 56, 56, 56, 353, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 357, 56, 56, 56, 513, 513, - 355, 354, 356, 56, 56, 56, 358, 56, 56, 56, - 56, 56, 56, 513, 513, 360, 513, 359, 56, 56, - 56, 513, 365, 56, 56, 56, 513, 361, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 367, 366, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 368, 513, 513, 371, 56, 56, 56, 56, 56, - 56, 372, 56, 56, 56, 56, 56, 56, 370, 56, + 52, 52, 52, 52, 52, 356, 501, 501, 359, 52, + 52, 52, 52, 52, 52, 360, 52, 52, 52, 52, + 52, 52, 358, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 501, 501, 361, 501, 501, 363, 52, 52, + 52, 364, 52, 52, 52, 501, 362, 52, 52, 52, + 52, 52, 52, 365, 52, 52, 52, 367, 501, 366, + 52, 52, 52, 501, 501, 368, 52, 52, 52, 501, + 370, 501, 501, 371, 369, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 501, 373, 52, 52, - 56, 56, 56, 56, 56, 56, 56, 56, 513, 513, - 373, 513, 513, 375, 56, 56, 56, 376, 56, 56, - 56, 513, 374, 56, 56, 56, 56, 56, 56, 377, - 56, 56, 56, 379, 513, 378, 56, 56, 56, 513, - 513, 380, 56, 56, 56, 513, 382, 513, 513, 383, - 381, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 513, 385, 56, 56, 56, 56, 56, 56, - 513, 513, 388, 384, 56, 56, 56, 386, 513, 513, - 391, 387, 56, 56, 56, 389, 513, 392, 513, 390, + 52, 52, 52, 52, 501, 501, 376, 372, 52, 52, + 52, 374, 501, 501, 379, 375, 52, 52, 52, 377, + 501, 380, 501, 378, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 501, 383, 382, 381, 52, + 52, 52, 52, 52, 52, 501, 501, 388, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 501, 387, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 501, 389, 52, 52, 52, 501, 391, 52, 52, + 52, 501, 392, 52, 52, 52, 501, 393, 52, 52, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 513, 395, 394, 393, 56, 56, 56, 56, 56, - 56, 513, 513, 400, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 513, 399, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 513, 401, 56, - 56, 56, 513, 403, 56, 56, 56, 513, 404, 56, - 56, 56, 513, 405, 56, 56, 56, 513, 406, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 513, 407, - 513, 513, 410, 56, 56, 56, 408, 411, 513, 409, + 52, 501, 394, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 501, 395, 501, 501, 398, 52, 52, 52, + 396, 399, 501, 397, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 401, 52, 52, 52, + 501, 400, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 402, 52, 52, 52, 403, 404, 52, 52, 52, + 501, 405, 406, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 407, 52, 52, 52, 52, + 52, 52, 501, 501, 408, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 409, 415, 501, 501, 416, 501, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 413, 56, 56, 56, 513, 412, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 414, 56, 56, - 56, 415, 416, 56, 56, 56, 513, 417, 418, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 419, 56, 56, 56, 56, 56, 56, 513, 513, - 420, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 421, 427, 513, 513, 428, 513, 513, 425, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 513, 429, 56, 56, 56, 56, 56, 56, 513, 430, + 501, 413, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 501, 417, 52, 52, 52, 52, + 52, 52, 501, 418, 52, 52, 52, 52, 52, 52, + 501, 501, 423, 501, 421, 501, 501, 420, 52, 52, + 52, 501, 419, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 501, 422, 501, 501, 424, 52, 52, 52, + 501, 52, 52, 52, 52, 52, 52, 501, 501, 425, + 52, 52, 52, 501, 426, 501, 501, 427, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 501, 501, 428, + 429, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 56, 56, 56, 56, 56, 56, 513, 513, 435, 513, - 433, 513, 513, 432, 56, 56, 56, 513, 431, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 513, 434, - 513, 513, 436, 56, 56, 56, 513, 56, 56, 56, - 56, 56, 56, 513, 513, 437, 56, 56, 56, 513, - 438, 513, 513, 439, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 513, 513, 440, 441, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 513, 446, 513, 447, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 448, 56, + 52, 52, 52, 52, 52, 52, 501, 434, 501, 435, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 436, 52, 52, 52, 52, 52, 52, 437, + 438, 52, 52, 52, 440, 52, 52, 52, 501, 441, + 52, 52, 52, 501, 439, 442, 52, 52, 52, 52, + 52, 52, 501, 448, 501, 52, 52, 52, 501, 501, + 447, 52, 52, 52, 501, 449, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 501, 501, 450, 451, 501, + 452, 453, 52, 52, 52, 501, 454, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 501, 458, 501, 501, - 56, 56, 56, 56, 56, 449, 450, 56, 56, 56, - 452, 56, 56, 56, 513, 453, 56, 56, 56, 513, - 451, 454, 56, 56, 56, 56, 56, 56, 513, 460, - 513, 56, 56, 56, 513, 513, 459, 56, 56, 56, - 513, 461, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 513, 513, 462, 463, 513, 464, 465, 56, 56, - 56, 513, 466, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 513, 470, 513, 513, 471, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 472, 513, 56, 56, - 56, 56, 56, 56, 513, 513, 473, 56, 56, 56, + 459, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 460, 501, 52, 52, 52, 52, 52, 52, 501, 501, + 461, 52, 52, 52, 52, 52, 52, 463, 501, 501, + 464, 468, 501, 462, 501, 501, 470, 501, 469, 52, + 52, 52, 52, 52, 52, 471, 52, 52, 52, 52, + 52, 52, 501, 501, 472, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 501, 501, 474, 473, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 501, 479, 478, 501, 480, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 481, 485, 52, - 56, 56, 56, 475, 513, 513, 476, 480, 513, 474, - 513, 513, 482, 513, 481, 56, 56, 56, 56, 56, - 56, 483, 56, 56, 56, 56, 56, 56, 513, 513, - 484, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 513, 513, 486, 485, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 513, 491, 490, 513, - 492, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 493, 497, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 500, 513, 498, 513, 513, 499, - 56, 56, 56, 513, 513, 513, 513, 504, 3, 513, - - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513 + 52, 52, 52, 52, 52, 52, 52, 52, 488, 501, + 486, 501, 501, 487, 52, 52, 52, 501, 501, 501, + 501, 492, 3, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501 } ; -static grib_yyconst flex_int16_t grib_yy_chk[2150] = +static grib_yyconst flex_int16_t grib_yy_chk[2074] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, - 13, 14, 14, 515, 514, 13, 17, 17, 17, 18, - 18, 18, 19, 19, 19, 511, 510, 13, 18, 21, - 21, 21, 508, 507, 22, 22, 22, 23, 23, 23, - 24, 24, 24, 505, 26, 19, 26, 30, 26, 30, + 11, 11, 11, 12, 12, 12, 12, 13, 13, 16, + 16, 16, 17, 17, 17, 18, 18, 18, 20, 20, + 20, 17, 503, 21, 21, 21, 22, 22, 22, 23, + 23, 23, 502, 25, 499, 25, 498, 25, 18, 25, + 496, 22, 495, 20, 493, 20, 21, 20, 23, 20, - 26, 30, 23, 30, 21, 503, 21, 22, 21, 24, - 21, 25, 22, 502, 501, 23, 496, 495, 25, 494, - 25, 22, 25, 24, 25, 27, 27, 27, 489, 25, - 28, 28, 28, 31, 31, 31, 32, 33, 36, 488, - 32, 33, 36, 487, 32, 33, 36, 479, 31, 32, - 33, 36, 31, 28, 29, 33, 31, 29, 29, 478, - 67, 31, 67, 29, 67, 29, 67, 29, 477, 29, - 29, 34, 34, 34, 35, 37, 469, 106, 35, 37, - 468, 106, 35, 37, 37, 106, 467, 35, 37, 35, - 106, 457, 37, 456, 38, 37, 455, 445, 38, 139, + 24, 21, 491, 490, 22, 489, 484, 24, 483, 24, + 21, 24, 23, 24, 26, 26, 26, 482, 24, 27, + 27, 27, 29, 477, 29, 31, 29, 476, 29, 31, + 33, 33, 33, 31, 30, 30, 30, 32, 31, 475, + 467, 32, 27, 28, 466, 32, 28, 28, 465, 30, + 32, 457, 28, 30, 28, 32, 28, 30, 28, 28, + 33, 34, 30, 456, 33, 34, 63, 35, 63, 34, + 63, 35, 63, 36, 34, 35, 34, 36, 455, 37, + 35, 36, 36, 37, 445, 444, 36, 37, 443, 433, + 36, 432, 37, 36, 37, 38, 38, 38, 39, 39, - 444, 34, 38, 139, 443, 34, 442, 38, 139, 38, - 39, 39, 39, 40, 40, 40, 426, 46, 46, 46, - 46, 46, 47, 47, 47, 424, 46, 423, 422, 47, - 48, 48, 48, 402, 398, 40, 397, 39, 46, 396, - 369, 47, 364, 40, 49, 49, 49, 57, 57, 57, - 363, 49, 50, 50, 50, 50, 50, 58, 58, 58, - 362, 50, 51, 49, 51, 51, 51, 324, 318, 58, - 59, 59, 59, 50, 60, 60, 60, 61, 61, 61, - 62, 62, 62, 63, 63, 63, 64, 64, 64, 317, - 59, 65, 65, 65, 316, 61, 272, 60, 266, 68, + 39, 45, 45, 45, 45, 46, 46, 46, 47, 47, + 47, 47, 53, 53, 53, 54, 54, 54, 431, 430, + 39, 414, 38, 55, 55, 55, 412, 54, 39, 56, + 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, + 59, 411, 410, 55, 60, 60, 60, 61, 61, 61, + 57, 390, 56, 386, 64, 59, 62, 62, 62, 385, + 384, 64, 64, 64, 58, 64, 357, 64, 352, 59, + 65, 65, 65, 66, 66, 66, 60, 67, 67, 67, + 68, 68, 68, 61, 69, 69, 69, 351, 62, 350, + 65, 70, 70, 70, 71, 71, 71, 312, 306, 66, - 63, 66, 66, 66, 265, 264, 68, 68, 68, 62, - 68, 205, 68, 204, 63, 69, 69, 69, 64, 70, - 70, 70, 203, 71, 71, 71, 76, 65, 72, 72, - 72, 43, 41, 66, 16, 69, 73, 73, 73, 74, - 74, 74, 75, 75, 75, 70, 71, 77, 77, 77, - 78, 78, 78, 15, 73, 10, 7, 75, 5, 72, - 79, 79, 79, 3, 0, 77, 0, 0, 74, 80, - 80, 80, 81, 81, 81, 0, 78, 0, 0, 79, - 82, 82, 82, 83, 83, 83, 84, 84, 84, 81, - 85, 85, 85, 86, 86, 86, 87, 87, 87, 89, + 67, 305, 69, 73, 73, 73, 74, 74, 74, 71, + 304, 68, 75, 75, 75, 76, 76, 76, 260, 254, + 70, 73, 77, 77, 77, 78, 78, 78, 79, 79, + 79, 75, 74, 80, 80, 80, 82, 82, 82, 77, + 81, 81, 81, 83, 83, 83, 253, 79, 84, 84, + 84, 252, 80, 85, 85, 85, 81, 193, 192, 86, + 86, 86, 191, 82, 87, 87, 87, 88, 88, 88, + 89, 89, 89, 72, 83, 84, 84, 86, 42, 87, + 88, 40, 15, 84, 85, 85, 90, 90, 90, 91, + 91, 91, 92, 92, 92, 89, 93, 93, 93, 88, - 89, 89, 83, 0, 0, 84, 85, 88, 88, 88, - 90, 90, 90, 0, 91, 91, 91, 94, 94, 94, - 86, 0, 0, 92, 92, 92, 0, 87, 90, 91, - 89, 89, 0, 0, 88, 88, 92, 93, 93, 93, - 0, 0, 88, 0, 95, 95, 95, 96, 96, 96, - 97, 97, 97, 0, 0, 92, 98, 98, 98, 99, - 99, 99, 93, 95, 0, 96, 100, 100, 100, 101, - 101, 101, 0, 0, 99, 0, 102, 102, 102, 98, - 0, 97, 0, 100, 0, 99, 103, 103, 103, 0, - 101, 104, 104, 104, 105, 105, 105, 107, 100, 102, + 94, 94, 94, 95, 95, 95, 14, 10, 91, 7, + 92, 96, 96, 96, 97, 97, 97, 5, 95, 98, + 98, 98, 3, 94, 99, 99, 99, 93, 96, 95, + 100, 100, 100, 0, 0, 97, 101, 101, 101, 107, + 107, 107, 98, 96, 102, 0, 107, 103, 102, 0, + 0, 103, 102, 100, 99, 103, 0, 102, 107, 0, + 103, 104, 101, 103, 105, 104, 131, 0, 105, 104, + 131, 0, 105, 0, 104, 131, 0, 105, 108, 108, + 108, 109, 109, 109, 110, 110, 110, 111, 111, 111, + 108, 112, 112, 112, 113, 113, 113, 0, 0, 110, - 0, 107, 0, 0, 108, 107, 0, 0, 108, 0, - 107, 109, 108, 107, 104, 109, 103, 108, 0, 109, - 105, 0, 0, 111, 109, 111, 111, 111, 112, 112, - 112, 114, 114, 114, 113, 112, 113, 113, 113, 115, - 115, 115, 116, 116, 116, 0, 0, 112, 117, 117, - 117, 118, 118, 118, 116, 119, 119, 119, 120, 120, - 120, 121, 121, 121, 0, 0, 118, 122, 122, 122, - 123, 123, 123, 124, 124, 124, 0, 120, 125, 125, - 125, 126, 126, 126, 121, 0, 122, 127, 127, 127, - 128, 128, 128, 0, 126, 0, 0, 125, 129, 129, + 114, 114, 114, 115, 115, 115, 116, 116, 116, 0, + 112, 117, 117, 117, 118, 118, 118, 113, 0, 114, + 119, 119, 119, 120, 120, 120, 0, 118, 0, 0, + 117, 121, 121, 121, 122, 122, 122, 0, 0, 119, + 0, 0, 120, 123, 123, 123, 124, 124, 124, 0, + 0, 122, 125, 125, 125, 126, 126, 126, 0, 0, + 121, 124, 128, 128, 128, 122, 127, 127, 127, 129, + 129, 129, 130, 130, 130, 0, 132, 132, 132, 0, + 123, 125, 133, 133, 133, 127, 0, 126, 134, 134, + 134, 0, 0, 130, 132, 0, 0, 129, 135, 135, - 129, 130, 130, 130, 0, 0, 127, 0, 0, 128, - 131, 131, 131, 132, 132, 132, 0, 0, 130, 133, - 133, 133, 134, 134, 134, 0, 0, 129, 132, 136, - 136, 136, 130, 135, 135, 135, 137, 137, 137, 138, - 138, 138, 0, 140, 140, 140, 0, 131, 133, 141, - 141, 141, 135, 0, 134, 142, 142, 142, 0, 0, - 138, 140, 0, 0, 137, 143, 143, 143, 0, 141, - 144, 144, 144, 0, 142, 145, 145, 145, 146, 146, - 146, 147, 147, 147, 148, 148, 148, 149, 149, 149, - 143, 0, 145, 150, 150, 150, 0, 146, 0, 0, + 135, 0, 133, 136, 136, 136, 0, 134, 137, 137, + 137, 138, 138, 138, 139, 139, 139, 140, 140, 140, + 141, 141, 141, 135, 0, 137, 142, 142, 142, 0, + 138, 0, 0, 136, 0, 139, 143, 143, 143, 0, + 0, 141, 144, 144, 144, 145, 145, 145, 0, 140, + 142, 146, 146, 146, 0, 143, 147, 147, 147, 0, + 145, 148, 148, 148, 149, 149, 149, 150, 150, 150, + 151, 151, 151, 144, 146, 152, 152, 152, 148, 0, + 149, 148, 153, 153, 153, 0, 147, 154, 154, 154, + 0, 0, 150, 155, 155, 155, 156, 156, 156, 0, - 144, 0, 147, 151, 151, 151, 0, 0, 149, 152, - 152, 152, 153, 153, 153, 0, 148, 150, 154, 154, - 154, 0, 151, 155, 155, 155, 0, 153, 156, 156, - 156, 157, 157, 157, 158, 158, 158, 159, 159, 159, - 152, 154, 160, 160, 160, 156, 0, 157, 156, 161, - 161, 161, 0, 155, 162, 162, 162, 0, 0, 158, - 163, 163, 163, 164, 164, 164, 0, 159, 165, 165, - 165, 0, 161, 0, 160, 166, 166, 166, 163, 0, - 0, 162, 167, 167, 167, 168, 168, 168, 166, 0, - 0, 164, 169, 169, 169, 170, 170, 170, 0, 0, + 151, 157, 157, 157, 0, 153, 0, 152, 158, 158, + 158, 155, 0, 0, 154, 159, 159, 159, 160, 160, + 160, 158, 0, 0, 156, 161, 161, 161, 162, 162, + 162, 0, 0, 157, 163, 163, 163, 164, 164, 164, + 0, 0, 159, 0, 165, 165, 165, 160, 161, 166, + 166, 166, 167, 167, 167, 168, 168, 168, 0, 0, + 162, 0, 0, 163, 164, 165, 169, 169, 169, 170, + 170, 170, 0, 0, 166, 167, 171, 0, 171, 171, + 171, 0, 168, 172, 172, 172, 173, 173, 173, 0, + 0, 169, 172, 174, 174, 174, 175, 175, 175, 0, - 165, 171, 171, 171, 172, 172, 172, 0, 0, 167, - 0, 173, 173, 173, 168, 169, 174, 174, 174, 175, - 175, 175, 176, 176, 176, 0, 0, 170, 0, 0, - 171, 172, 173, 177, 177, 177, 178, 178, 178, 0, - 0, 174, 175, 179, 179, 179, 180, 180, 180, 176, - 181, 0, 181, 181, 181, 182, 182, 182, 177, 183, - 183, 183, 184, 184, 184, 185, 185, 185, 178, 0, - 0, 184, 186, 186, 186, 187, 187, 187, 188, 188, - 188, 189, 189, 189, 190, 190, 190, 191, 191, 191, - 192, 192, 192, 193, 193, 193, 185, 0, 187, 186, + 0, 170, 176, 176, 176, 177, 177, 177, 178, 178, + 178, 179, 179, 179, 180, 180, 180, 173, 0, 175, + 174, 182, 182, 182, 178, 181, 181, 181, 183, 183, + 183, 0, 176, 0, 184, 184, 184, 185, 185, 185, + 182, 186, 186, 186, 0, 0, 180, 184, 0, 0, + 181, 187, 187, 187, 188, 188, 188, 189, 189, 189, + 183, 190, 190, 190, 194, 194, 194, 197, 197, 197, + 185, 195, 195, 195, 187, 0, 0, 190, 196, 196, + 196, 0, 0, 194, 198, 198, 198, 189, 199, 199, + 199, 0, 190, 200, 200, 200, 195, 0, 196, 198, - 190, 194, 194, 194, 195, 195, 195, 0, 188, 0, - 196, 196, 196, 197, 197, 197, 0, 0, 193, 0, - 194, 0, 192, 196, 198, 198, 198, 199, 199, 199, - 200, 200, 200, 201, 201, 201, 195, 202, 202, 202, - 206, 206, 206, 209, 209, 209, 197, 207, 207, 207, - 199, 0, 0, 202, 208, 208, 208, 0, 0, 206, - 210, 210, 210, 201, 211, 211, 211, 0, 202, 212, - 212, 212, 207, 0, 208, 210, 209, 213, 213, 213, - 214, 214, 214, 215, 215, 215, 216, 216, 216, 0, - 217, 217, 217, 0, 212, 0, 215, 218, 218, 218, + 197, 201, 201, 201, 202, 202, 202, 203, 203, 203, + 204, 204, 204, 0, 205, 205, 205, 0, 200, 0, + 203, 206, 206, 206, 207, 207, 207, 208, 208, 208, + 209, 209, 209, 201, 0, 0, 206, 210, 210, 210, + 211, 211, 211, 204, 205, 0, 0, 208, 0, 209, + 212, 212, 212, 0, 0, 211, 213, 213, 213, 214, + 214, 214, 215, 215, 215, 210, 216, 216, 216, 217, + 217, 217, 0, 212, 218, 218, 218, 219, 219, 219, + 220, 220, 220, 221, 221, 221, 0, 218, 0, 214, + 215, 0, 0, 222, 222, 222, 0, 0, 216, 0, - 219, 219, 219, 220, 220, 220, 221, 221, 221, 213, - 0, 0, 218, 222, 222, 222, 223, 223, 223, 216, - 217, 0, 0, 220, 0, 221, 224, 224, 224, 0, - 0, 223, 225, 225, 225, 226, 226, 226, 227, 227, - 227, 222, 228, 228, 228, 229, 229, 229, 0, 224, - 230, 230, 230, 231, 231, 231, 232, 232, 232, 233, - 233, 233, 0, 230, 0, 226, 227, 0, 0, 234, - 234, 234, 0, 0, 228, 0, 0, 229, 0, 232, - 235, 235, 235, 236, 236, 236, 233, 231, 234, 237, - 237, 237, 238, 238, 238, 239, 239, 239, 240, 240, + 0, 217, 0, 220, 223, 223, 223, 224, 224, 224, + 221, 219, 222, 225, 225, 225, 226, 226, 226, 227, + 227, 227, 228, 228, 228, 229, 229, 229, 0, 0, + 225, 230, 230, 230, 224, 231, 231, 231, 232, 232, + 232, 226, 0, 228, 233, 233, 233, 0, 229, 0, + 227, 0, 230, 234, 234, 234, 0, 232, 235, 235, + 235, 0, 0, 233, 236, 236, 236, 237, 237, 237, + 238, 238, 238, 0, 0, 236, 239, 239, 239, 240, + 240, 240, 241, 241, 241, 242, 242, 242, 238, 243, + 243, 243, 244, 244, 244, 245, 245, 245, 0, 0, - 240, 241, 241, 241, 0, 0, 237, 242, 242, 242, - 236, 243, 243, 243, 244, 244, 244, 238, 0, 240, - 245, 245, 245, 0, 241, 0, 239, 0, 242, 246, - 246, 246, 0, 244, 247, 247, 247, 0, 0, 245, - 248, 248, 248, 249, 249, 249, 250, 250, 250, 0, - 0, 248, 251, 251, 251, 252, 252, 252, 253, 253, - 253, 254, 254, 254, 250, 255, 255, 255, 256, 256, - 256, 257, 257, 257, 0, 0, 254, 253, 258, 258, - 258, 260, 260, 260, 255, 0, 257, 252, 259, 259, - 259, 261, 261, 261, 262, 262, 262, 256, 263, 263, + 242, 241, 246, 246, 246, 248, 248, 248, 243, 0, + 245, 240, 247, 247, 247, 249, 249, 249, 250, 250, + 250, 244, 251, 251, 251, 245, 255, 255, 255, 0, + 246, 0, 0, 248, 256, 256, 256, 247, 257, 257, + 257, 250, 258, 258, 258, 0, 0, 249, 259, 259, + 259, 0, 0, 255, 261, 261, 261, 262, 262, 262, + 258, 0, 256, 257, 263, 263, 263, 0, 264, 264, + 264, 265, 265, 265, 266, 266, 266, 0, 0, 262, + 259, 267, 267, 267, 268, 268, 268, 0, 265, 0, + 269, 269, 269, 0, 0, 266, 263, 264, 270, 270, - 263, 257, 267, 267, 267, 0, 258, 0, 0, 260, - 268, 268, 268, 259, 269, 269, 269, 262, 270, 270, - 270, 0, 0, 261, 271, 271, 271, 0, 0, 267, - 273, 273, 273, 274, 274, 274, 270, 0, 268, 269, - 275, 275, 275, 0, 276, 276, 276, 277, 277, 277, - 278, 278, 278, 0, 0, 274, 271, 279, 279, 279, - 280, 280, 280, 0, 277, 0, 281, 281, 281, 0, - 0, 278, 275, 276, 282, 282, 282, 283, 283, 283, - 284, 284, 284, 0, 0, 285, 285, 285, 287, 287, - 287, 280, 0, 0, 279, 281, 0, 282, 286, 286, + 270, 271, 271, 271, 272, 272, 272, 0, 0, 273, + 273, 273, 275, 275, 275, 268, 0, 0, 267, 269, + 0, 270, 274, 274, 274, 0, 0, 272, 273, 276, + 276, 276, 0, 271, 0, 273, 277, 277, 277, 278, + 278, 278, 279, 279, 279, 274, 280, 280, 280, 0, + 281, 281, 281, 0, 0, 277, 0, 276, 282, 282, + 282, 283, 283, 283, 280, 0, 0, 278, 0, 0, + 279, 281, 284, 284, 284, 0, 283, 285, 285, 285, + 282, 0, 286, 286, 286, 287, 287, 287, 288, 288, + 288, 289, 289, 289, 0, 284, 285, 286, 290, 290, - 286, 0, 0, 284, 285, 288, 288, 288, 0, 283, - 0, 285, 289, 289, 289, 290, 290, 290, 291, 291, - 291, 286, 292, 292, 292, 0, 293, 293, 293, 0, - 0, 289, 0, 288, 294, 294, 294, 295, 295, 295, - 292, 0, 0, 290, 0, 0, 291, 293, 296, 296, - 296, 0, 295, 297, 297, 297, 294, 0, 298, 298, - 298, 299, 299, 299, 300, 300, 300, 301, 301, 301, - 0, 296, 297, 298, 302, 302, 302, 303, 303, 303, - 0, 0, 302, 304, 304, 304, 0, 0, 299, 305, - 305, 305, 306, 306, 306, 307, 307, 307, 308, 308, + 290, 291, 291, 291, 0, 0, 290, 292, 292, 292, + 0, 0, 287, 293, 293, 293, 294, 294, 294, 295, + 295, 295, 296, 296, 296, 0, 293, 0, 0, 297, + 297, 297, 294, 298, 298, 298, 299, 299, 299, 300, + 300, 300, 301, 301, 301, 302, 302, 302, 298, 303, + 303, 303, 0, 0, 296, 295, 297, 307, 307, 307, + 299, 308, 308, 308, 309, 309, 309, 0, 0, 301, + 0, 300, 310, 310, 310, 0, 308, 311, 311, 311, + 0, 303, 313, 313, 313, 314, 314, 314, 315, 315, + 315, 310, 309, 316, 316, 316, 317, 317, 317, 318, - 308, 0, 305, 0, 0, 309, 309, 309, 306, 310, - 310, 310, 311, 311, 311, 312, 312, 312, 313, 313, - 313, 314, 314, 314, 310, 315, 315, 315, 0, 0, - 308, 307, 309, 319, 319, 319, 311, 320, 320, 320, - 321, 321, 321, 0, 0, 313, 0, 312, 322, 322, - 322, 0, 320, 323, 323, 323, 0, 315, 325, 325, - 325, 326, 326, 326, 327, 327, 327, 322, 321, 328, - 328, 328, 329, 329, 329, 330, 330, 330, 331, 331, - 331, 323, 0, 0, 328, 332, 332, 332, 333, 333, - 333, 329, 334, 334, 334, 336, 336, 336, 326, 335, + 318, 318, 319, 319, 319, 311, 0, 0, 316, 320, + 320, 320, 321, 321, 321, 317, 322, 322, 322, 324, + 324, 324, 314, 323, 323, 323, 325, 325, 325, 326, + 326, 326, 0, 0, 319, 0, 0, 321, 327, 327, + 327, 323, 328, 328, 328, 0, 320, 329, 329, 329, + 330, 330, 330, 324, 331, 331, 331, 326, 0, 325, + 332, 332, 332, 0, 0, 327, 333, 333, 333, 0, + 330, 0, 0, 332, 329, 334, 334, 334, 335, 335, + 335, 336, 336, 336, 337, 337, 337, 338, 338, 338, + 339, 339, 339, 340, 340, 340, 0, 335, 341, 341, - 335, 335, 337, 337, 337, 338, 338, 338, 0, 0, - 331, 0, 0, 333, 339, 339, 339, 335, 340, 340, - 340, 0, 332, 341, 341, 341, 342, 342, 342, 336, - 343, 343, 343, 338, 0, 337, 344, 344, 344, 0, - 0, 339, 345, 345, 345, 0, 342, 0, 0, 344, - 341, 346, 346, 346, 347, 347, 347, 348, 348, 348, - 349, 349, 349, 350, 350, 350, 351, 351, 351, 352, - 352, 352, 0, 347, 353, 353, 353, 354, 354, 354, - 0, 0, 350, 346, 355, 355, 355, 348, 0, 0, - 354, 349, 356, 356, 356, 352, 0, 355, 0, 353, + 341, 342, 342, 342, 0, 0, 338, 334, 343, 343, + 343, 336, 0, 0, 342, 337, 344, 344, 344, 340, + 0, 343, 0, 341, 345, 345, 345, 346, 346, 346, + 347, 347, 347, 348, 348, 348, 349, 349, 349, 353, + 353, 353, 354, 354, 354, 0, 348, 345, 344, 355, + 355, 355, 356, 356, 356, 0, 0, 354, 358, 358, + 358, 359, 359, 359, 360, 360, 360, 361, 361, 361, + 0, 353, 362, 362, 362, 363, 363, 363, 364, 364, + 364, 0, 356, 365, 365, 365, 0, 358, 366, 366, + 366, 0, 359, 367, 367, 367, 0, 364, 368, 368, - 357, 357, 357, 358, 358, 358, 359, 359, 359, 360, - 360, 360, 361, 361, 361, 365, 365, 365, 366, 366, - 366, 0, 360, 357, 356, 367, 367, 367, 368, 368, - 368, 0, 0, 366, 370, 370, 370, 371, 371, 371, - 372, 372, 372, 373, 373, 373, 0, 365, 374, 374, - 374, 375, 375, 375, 376, 376, 376, 0, 368, 377, - 377, 377, 0, 370, 378, 378, 378, 0, 371, 379, - 379, 379, 0, 376, 380, 380, 380, 0, 377, 381, - 381, 381, 382, 382, 382, 383, 383, 383, 0, 378, - 0, 0, 381, 384, 384, 384, 379, 382, 0, 380, + 368, 0, 365, 369, 369, 369, 370, 370, 370, 371, + 371, 371, 0, 366, 0, 0, 369, 372, 372, 372, + 367, 370, 0, 368, 373, 373, 373, 374, 374, 374, + 375, 375, 375, 377, 377, 377, 372, 376, 376, 376, + 0, 371, 378, 378, 378, 379, 379, 379, 380, 380, + 380, 373, 381, 381, 381, 376, 377, 382, 382, 382, + 0, 378, 379, 383, 383, 383, 387, 387, 387, 388, + 388, 388, 389, 389, 389, 380, 391, 391, 391, 392, + 392, 392, 0, 0, 382, 393, 393, 393, 394, 394, + 394, 395, 395, 395, 383, 391, 0, 0, 392, 0, - 385, 385, 385, 386, 386, 386, 387, 387, 387, 389, - 389, 389, 384, 388, 388, 388, 0, 383, 390, 390, - 390, 391, 391, 391, 392, 392, 392, 385, 393, 393, - 393, 388, 389, 394, 394, 394, 0, 390, 391, 395, - 395, 395, 399, 399, 399, 400, 400, 400, 401, 401, - 401, 392, 403, 403, 403, 404, 404, 404, 0, 0, - 394, 405, 405, 405, 406, 406, 406, 407, 407, 407, - 395, 403, 0, 0, 404, 0, 0, 400, 408, 408, - 408, 409, 409, 409, 410, 410, 410, 411, 411, 411, - 0, 406, 412, 412, 412, 413, 413, 413, 0, 407, + 0, 388, 396, 396, 396, 397, 397, 397, 398, 398, + 398, 399, 399, 399, 0, 394, 400, 400, 400, 401, + 401, 401, 0, 395, 402, 402, 402, 403, 403, 403, + 0, 0, 401, 0, 399, 0, 0, 398, 404, 404, + 404, 0, 397, 405, 405, 405, 406, 406, 406, 407, + 407, 407, 0, 400, 0, 0, 402, 408, 408, 408, + 0, 409, 409, 409, 413, 413, 413, 0, 0, 404, + 415, 415, 415, 0, 406, 0, 0, 407, 416, 416, + 416, 417, 417, 417, 418, 418, 418, 0, 0, 408, + 409, 419, 419, 419, 420, 420, 420, 421, 421, 421, - 414, 414, 414, 415, 415, 415, 0, 0, 413, 0, - 411, 0, 0, 410, 416, 416, 416, 0, 409, 417, - 417, 417, 418, 418, 418, 419, 419, 419, 0, 412, - 0, 0, 414, 420, 420, 420, 0, 421, 421, 421, - 425, 425, 425, 0, 0, 416, 427, 427, 427, 0, - 418, 0, 0, 419, 428, 428, 428, 429, 429, 429, - 430, 430, 430, 0, 0, 420, 421, 431, 431, 431, - 432, 432, 432, 433, 433, 433, 434, 434, 434, 435, - 435, 435, 0, 430, 0, 432, 436, 436, 436, 437, - 437, 437, 438, 438, 438, 439, 439, 439, 433, 440, + 422, 422, 422, 423, 423, 423, 0, 418, 0, 420, + 424, 424, 424, 425, 425, 425, 426, 426, 426, 427, + 427, 427, 421, 428, 428, 428, 429, 429, 429, 422, + 423, 434, 434, 434, 426, 435, 435, 435, 0, 427, + 436, 436, 436, 0, 425, 429, 437, 437, 437, 438, + 438, 438, 0, 435, 0, 439, 439, 439, 0, 0, + 434, 440, 440, 440, 0, 437, 441, 441, 441, 442, + 442, 442, 447, 447, 447, 0, 0, 438, 439, 0, + 440, 441, 448, 448, 448, 0, 442, 449, 449, 449, + 450, 450, 450, 451, 451, 451, 0, 447, 0, 0, - 440, 440, 441, 441, 441, 434, 435, 446, 446, 446, - 438, 447, 447, 447, 0, 439, 448, 448, 448, 0, - 437, 441, 449, 449, 449, 450, 450, 450, 0, 447, - 0, 451, 451, 451, 0, 0, 446, 452, 452, 452, - 0, 449, 453, 453, 453, 454, 454, 454, 459, 459, - 459, 0, 0, 450, 451, 0, 452, 453, 460, 460, - 460, 0, 454, 461, 461, 461, 462, 462, 462, 463, - 463, 463, 0, 459, 0, 0, 460, 464, 464, 464, - 465, 465, 465, 466, 466, 466, 462, 0, 470, 470, - 470, 471, 471, 471, 0, 0, 463, 472, 472, 472, + 448, 452, 452, 452, 453, 453, 453, 454, 454, 454, + 450, 0, 458, 458, 458, 459, 459, 459, 0, 0, + 451, 460, 460, 460, 461, 461, 461, 453, 0, 0, + 454, 458, 0, 452, 0, 0, 460, 0, 459, 462, + 462, 462, 463, 463, 463, 461, 464, 464, 464, 468, + 468, 468, 0, 0, 462, 469, 469, 469, 470, 470, + 470, 471, 471, 471, 0, 0, 464, 463, 472, 472, + 472, 473, 473, 473, 474, 474, 474, 478, 478, 478, + 0, 470, 469, 0, 472, 479, 479, 479, 480, 480, + 480, 481, 481, 481, 485, 485, 485, 474, 478, 486, - 473, 473, 473, 465, 0, 0, 466, 470, 0, 464, - 0, 0, 472, 0, 471, 474, 474, 474, 475, 475, - 475, 473, 476, 476, 476, 480, 480, 480, 0, 0, - 474, 481, 481, 481, 482, 482, 482, 483, 483, 483, - 0, 0, 476, 475, 484, 484, 484, 485, 485, 485, - 486, 486, 486, 490, 490, 490, 0, 482, 481, 0, - 484, 491, 491, 491, 492, 492, 492, 493, 493, 493, - 497, 497, 497, 486, 490, 498, 498, 498, 499, 499, - 499, 500, 500, 500, 493, 0, 491, 0, 0, 492, - 504, 504, 504, 0, 0, 0, 0, 499, 513, 513, - - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513 + 486, 486, 487, 487, 487, 488, 488, 488, 481, 0, + 479, 0, 0, 480, 492, 492, 492, 0, 0, 0, + 0, 487, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 501, 501 } ; static grib_yy_state_type grib_yy_last_accepting_state; @@ -1129,7 +1110,7 @@ void _grib_ignore_grib_yyunput_unused_error() { grib_yyunput(0,0); } #endif */ -#line 1133 "lex.grib_yy.c" +#line 1114 "lex.grib_yy.c" #define INITIAL 0 @@ -1311,11 +1292,11 @@ YY_DECL register char *grib_yy_cp, *grib_yy_bp; register int grib_yy_act; -#line 59 "gribl.l" +#line 57 "gribl.l" -#line 1319 "lex.grib_yy.c" +#line 1300 "lex.grib_yy.c" if ( !(grib_yy_init) ) { @@ -1368,13 +1349,13 @@ grib_yy_match: while ( grib_yy_chk[grib_yy_base[grib_yy_current_state] + grib_yy_c] != grib_yy_current_state ) { grib_yy_current_state = (int) grib_yy_def[grib_yy_current_state]; - if ( grib_yy_current_state >= 514 ) + if ( grib_yy_current_state >= 502 ) grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c]; } grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (unsigned int) grib_yy_c]; ++grib_yy_cp; } - while ( grib_yy_base[grib_yy_current_state] != 2099 ); + while ( grib_yy_base[grib_yy_current_state] != 2023 ); grib_yy_find_action: grib_yy_act = grib_yy_accept[grib_yy_current_state]; @@ -1400,447 +1381,447 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 62 "gribl.l" +#line 60 "gribl.l" return EQ ; YY_BREAK case 2: YY_RULE_SETUP -#line 63 "gribl.l" +#line 61 "gribl.l" return GE ; YY_BREAK case 3: YY_RULE_SETUP -#line 64 "gribl.l" +#line 62 "gribl.l" return LE ; YY_BREAK case 4: YY_RULE_SETUP -#line 65 "gribl.l" +#line 63 "gribl.l" return NE ; YY_BREAK case 5: YY_RULE_SETUP -#line 66 "gribl.l" +#line 64 "gribl.l" return NE ; YY_BREAK case 6: YY_RULE_SETUP -#line 67 "gribl.l" +#line 65 "gribl.l" return BIT ; YY_BREAK case 7: YY_RULE_SETUP -#line 68 "gribl.l" +#line 66 "gribl.l" return BITOFF ; YY_BREAK case 8: YY_RULE_SETUP -#line 70 "gribl.l" +#line 68 "gribl.l" return IS ; YY_BREAK case 9: YY_RULE_SETUP -#line 71 "gribl.l" +#line 69 "gribl.l" return NOT ; YY_BREAK case 10: YY_RULE_SETUP -#line 72 "gribl.l" +#line 70 "gribl.l" return NOT ; YY_BREAK case 11: YY_RULE_SETUP -#line 73 "gribl.l" +#line 71 "gribl.l" return AND ; YY_BREAK case 12: YY_RULE_SETUP -#line 74 "gribl.l" +#line 72 "gribl.l" return AND ; YY_BREAK case 13: YY_RULE_SETUP -#line 75 "gribl.l" +#line 73 "gribl.l" return OR ; YY_BREAK case 14: YY_RULE_SETUP -#line 76 "gribl.l" +#line 74 "gribl.l" return OR ; YY_BREAK case 15: YY_RULE_SETUP -#line 78 "gribl.l" +#line 76 "gribl.l" return NIL ; YY_BREAK case 16: YY_RULE_SETUP -#line 79 "gribl.l" +#line 77 "gribl.l" return DUMMY ; YY_BREAK case 17: YY_RULE_SETUP -#line 81 "gribl.l" +#line 79 "gribl.l" return LOWERCASE; YY_BREAK case 18: YY_RULE_SETUP -#line 82 "gribl.l" +#line 80 "gribl.l" return IF ; YY_BREAK case 19: YY_RULE_SETUP -#line 83 "gribl.l" +#line 81 "gribl.l" return IF_TRANSIENT ; YY_BREAK case 20: YY_RULE_SETUP -#line 84 "gribl.l" +#line 82 "gribl.l" return ELSE ; YY_BREAK case 21: YY_RULE_SETUP -#line 85 "gribl.l" +#line 83 "gribl.l" return UNSIGNED ; YY_BREAK case 22: YY_RULE_SETUP -#line 86 "gribl.l" +#line 84 "gribl.l" return ASCII ; YY_BREAK case 23: YY_RULE_SETUP -#line 87 "gribl.l" +#line 85 "gribl.l" return BYTE ; YY_BREAK case 24: YY_RULE_SETUP -#line 88 "gribl.l" +#line 86 "gribl.l" return LABEL ; YY_BREAK case 25: YY_RULE_SETUP -#line 89 "gribl.l" +#line 87 "gribl.l" return LIST ; YY_BREAK case 26: YY_RULE_SETUP -#line 90 "gribl.l" +#line 88 "gribl.l" return WHILE ; YY_BREAK case 27: YY_RULE_SETUP -#line 91 "gribl.l" +#line 89 "gribl.l" return TEMPLATE ; YY_BREAK case 28: YY_RULE_SETUP -#line 92 "gribl.l" +#line 90 "gribl.l" return TEMPLATE_NOFAIL ; YY_BREAK case 29: YY_RULE_SETUP -#line 93 "gribl.l" +#line 91 "gribl.l" return TRIGGER ; YY_BREAK case 30: YY_RULE_SETUP -#line 94 "gribl.l" +#line 92 "gribl.l" return END ; YY_BREAK case 31: YY_RULE_SETUP -#line 95 "gribl.l" +#line 93 "gribl.l" return IBMFLOAT ; YY_BREAK case 32: YY_RULE_SETUP -#line 96 "gribl.l" +#line 94 "gribl.l" return FLOAT ; YY_BREAK case 33: YY_RULE_SETUP -#line 97 "gribl.l" +#line 95 "gribl.l" return SIGNED ; YY_BREAK case 34: YY_RULE_SETUP -#line 98 "gribl.l" +#line 96 "gribl.l" return CODETABLE; YY_BREAK case 35: YY_RULE_SETUP -#line 99 "gribl.l" +#line 97 "gribl.l" return CODETABLE; YY_BREAK case 36: YY_RULE_SETUP -#line 100 "gribl.l" +#line 98 "gribl.l" return FLAG ; YY_BREAK case 37: YY_RULE_SETUP -#line 101 "gribl.l" +#line 99 "gribl.l" return LOOKUP ; YY_BREAK case 38: YY_RULE_SETUP -#line 102 "gribl.l" +#line 100 "gribl.l" return META ; YY_BREAK case 39: YY_RULE_SETUP -#line 103 "gribl.l" +#line 101 "gribl.l" return PADTOEVEN ; YY_BREAK case 40: YY_RULE_SETUP -#line 104 "gribl.l" +#line 102 "gribl.l" return PADTO ; YY_BREAK case 41: YY_RULE_SETUP -#line 105 "gribl.l" +#line 103 "gribl.l" return PADTOMULTIPLE ; YY_BREAK case 42: YY_RULE_SETUP -#line 106 "gribl.l" +#line 104 "gribl.l" return PAD ; YY_BREAK case 43: YY_RULE_SETUP -#line 107 "gribl.l" +#line 105 "gribl.l" return SECTION_PADDING ; YY_BREAK case 44: YY_RULE_SETUP -#line 108 "gribl.l" +#line 106 "gribl.l" return MESSAGE ; YY_BREAK case 45: YY_RULE_SETUP -#line 109 "gribl.l" +#line 107 "gribl.l" return ALIAS ; YY_BREAK case 46: YY_RULE_SETUP -#line 110 "gribl.l" +#line 108 "gribl.l" return UNALIAS ; YY_BREAK case 47: YY_RULE_SETUP -#line 111 "gribl.l" +#line 109 "gribl.l" return POS ; YY_BREAK case 48: YY_RULE_SETUP -#line 112 "gribl.l" +#line 110 "gribl.l" return INTCONST ; YY_BREAK case 49: YY_RULE_SETUP -#line 113 "gribl.l" +#line 111 "gribl.l" return TRANS ; YY_BREAK case 50: YY_RULE_SETUP -#line 114 "gribl.l" +#line 112 "gribl.l" return STRING_TYPE ; YY_BREAK case 51: YY_RULE_SETUP -#line 115 "gribl.l" +#line 113 "gribl.l" return LONG_TYPE ; YY_BREAK case 52: YY_RULE_SETUP -#line 116 "gribl.l" +#line 114 "gribl.l" return ITERATOR ; YY_BREAK case 53: YY_RULE_SETUP -#line 117 "gribl.l" +#line 115 "gribl.l" return NEAREST ; YY_BREAK case 54: YY_RULE_SETUP -#line 118 "gribl.l" +#line 116 "gribl.l" return BOX ; YY_BREAK case 55: YY_RULE_SETUP -#line 119 "gribl.l" +#line 117 "gribl.l" return KSEC ; YY_BREAK case 56: YY_RULE_SETUP -#line 120 "gribl.l" +#line 118 "gribl.l" return FLAGBIT ; YY_BREAK case 57: YY_RULE_SETUP -#line 121 "gribl.l" +#line 119 "gribl.l" return KSEC1EXPVER ; YY_BREAK case 58: YY_RULE_SETUP -#line 122 "gribl.l" +#line 120 "gribl.l" return MODIFY ; YY_BREAK case 59: YY_RULE_SETUP -#line 124 "gribl.l" +#line 122 "gribl.l" return G1_HALF_BYTE ; YY_BREAK case 60: YY_RULE_SETUP -#line 125 "gribl.l" +#line 123 "gribl.l" return G1_MESSAGE_LENGTH ; YY_BREAK case 61: YY_RULE_SETUP -#line 126 "gribl.l" +#line 124 "gribl.l" return G1_SECTION4_LENGTH ; YY_BREAK case 62: YY_RULE_SETUP -#line 128 "gribl.l" +#line 126 "gribl.l" return EXPORT; YY_BREAK case 63: YY_RULE_SETUP -#line 129 "gribl.l" +#line 127 "gribl.l" return REMOVE; YY_BREAK case 64: YY_RULE_SETUP -#line 131 "gribl.l" +#line 129 "gribl.l" return SECTION_LENGTH ; YY_BREAK case 65: YY_RULE_SETUP -#line 133 "gribl.l" +#line 131 "gribl.l" return ASSERT ; YY_BREAK case 66: YY_RULE_SETUP -#line 135 "gribl.l" +#line 133 "gribl.l" return READ_ONLY; YY_BREAK case 67: YY_RULE_SETUP -#line 136 "gribl.l" +#line 134 "gribl.l" return NO_COPY; YY_BREAK case 68: YY_RULE_SETUP -#line 137 "gribl.l" +#line 135 "gribl.l" return EDITION_SPECIFIC; YY_BREAK case 69: YY_RULE_SETUP -#line 138 "gribl.l" +#line 136 "gribl.l" return DUMP; YY_BREAK case 70: YY_RULE_SETUP -#line 139 "gribl.l" +#line 137 "gribl.l" return NO_FAIL; YY_BREAK case 71: YY_RULE_SETUP -#line 140 "gribl.l" +#line 138 "gribl.l" return HIDDEN; YY_BREAK case 72: YY_RULE_SETUP -#line 141 "gribl.l" +#line 139 "gribl.l" return CAN_BE_MISSING; YY_BREAK case 73: YY_RULE_SETUP -#line 142 "gribl.l" +#line 140 "gribl.l" return MISSING; YY_BREAK case 74: YY_RULE_SETUP -#line 143 "gribl.l" +#line 141 "gribl.l" return CONSTRAINT; YY_BREAK case 75: YY_RULE_SETUP -#line 144 "gribl.l" +#line 142 "gribl.l" return OVERRIDE; YY_BREAK case 76: YY_RULE_SETUP -#line 145 "gribl.l" +#line 143 "gribl.l" return COPY_OK; YY_BREAK case 77: YY_RULE_SETUP -#line 147 "gribl.l" +#line 145 "gribl.l" return SET; YY_BREAK case 78: YY_RULE_SETUP -#line 148 "gribl.l" +#line 146 "gribl.l" return SET_NOFAIL; YY_BREAK case 79: YY_RULE_SETUP -#line 149 "gribl.l" +#line 147 "gribl.l" return WHEN; YY_BREAK case 80: YY_RULE_SETUP -#line 150 "gribl.l" +#line 148 "gribl.l" return CASE; YY_BREAK case 81: YY_RULE_SETUP -#line 151 "gribl.l" +#line 149 "gribl.l" return SWITCH; YY_BREAK case 82: YY_RULE_SETUP -#line 152 "gribl.l" +#line 150 "gribl.l" return DEFAULT; YY_BREAK case 83: YY_RULE_SETUP -#line 153 "gribl.l" +#line 151 "gribl.l" return CONCEPT; YY_BREAK case 84: YY_RULE_SETUP -#line 154 "gribl.l" +#line 152 "gribl.l" return CONCEPT_NOFAIL; YY_BREAK case 85: YY_RULE_SETUP -#line 155 "gribl.l" +#line 153 "gribl.l" return WRITE; YY_BREAK case 86: YY_RULE_SETUP -#line 156 "gribl.l" +#line 154 "gribl.l" return APPEND; YY_BREAK case 87: YY_RULE_SETUP -#line 157 "gribl.l" +#line 155 "gribl.l" return PRINT; YY_BREAK case 88: YY_RULE_SETUP -#line 158 "gribl.l" +#line 156 "gribl.l" return SKIP; YY_BREAK case 89: YY_RULE_SETUP -#line 160 "gribl.l" +#line 158 "gribl.l" { int c,q; while((c = input()) && isspace(c) && c != '\n') ; @@ -1860,7 +1841,7 @@ YY_RULE_SETUP YY_BREAK case 90: YY_RULE_SETUP -#line 177 "gribl.l" +#line 175 "gribl.l" { int c,q = grib_yytext[0]; @@ -1879,7 +1860,7 @@ YY_RULE_SETUP YY_BREAK case 91: YY_RULE_SETUP -#line 193 "gribl.l" +#line 191 "gribl.l" { int c; unsigned long val = 0; @@ -1895,32 +1876,22 @@ YY_RULE_SETUP YY_BREAK case 92: YY_RULE_SETUP -#line 207 "gribl.l" +#line 205 "gribl.l" { grib_yylval.str = strdup(grib_yytext); return IDENT; } YY_BREAK case 93: YY_RULE_SETUP -#line 208 "gribl.l" +#line 206 "gribl.l" { grib_yylval.lval = atol((const char *)grib_yytext); return INTEGER; } YY_BREAK case 94: YY_RULE_SETUP -#line 209 "gribl.l" +#line 207 "gribl.l" { grib_yylval.dval = atof((const char *)grib_yytext); return FLOAT; } YY_BREAK case 95: YY_RULE_SETUP #line 210 "gribl.l" -{ grib_yylval.dval = atof((const char *)grib_yytext); return FLOAT; } - YY_BREAK -case 96: -YY_RULE_SETUP -#line 211 "gribl.l" -{ grib_yylval.dval = atof((const char *)grib_yytext); return FLOAT; } - YY_BREAK -case 97: -YY_RULE_SETUP -#line 214 "gribl.l" { int c; while((c = input()) && (c != '\n')){} @@ -1928,28 +1899,28 @@ YY_RULE_SETUP grib_yylineno++; } YY_BREAK -case 98: +case 96: YY_RULE_SETUP -#line 220 "gribl.l" +#line 216 "gribl.l" ; YY_BREAK -case 99: -/* rule 99 can match eol */ +case 97: +/* rule 97 can match eol */ YY_RULE_SETUP -#line 221 "gribl.l" +#line 217 "gribl.l" grib_yylineno++; YY_BREAK -case 100: +case 98: YY_RULE_SETUP -#line 225 "gribl.l" +#line 221 "gribl.l" return *grib_yytext; YY_BREAK -case 101: +case 99: YY_RULE_SETUP -#line 227 "gribl.l" +#line 223 "gribl.l" ECHO; YY_BREAK -#line 1953 "lex.grib_yy.c" +#line 1924 "lex.grib_yy.c" case YY_STATE_EOF(INITIAL): grib_yyterminate(); @@ -2241,7 +2212,7 @@ static int grib_yy_get_next_buffer (void) while ( grib_yy_chk[grib_yy_base[grib_yy_current_state] + grib_yy_c] != grib_yy_current_state ) { grib_yy_current_state = (int) grib_yy_def[grib_yy_current_state]; - if ( grib_yy_current_state >= 514 ) + if ( grib_yy_current_state >= 502 ) grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c]; } grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (unsigned int) grib_yy_c]; @@ -2269,11 +2240,11 @@ static int grib_yy_get_next_buffer (void) while ( grib_yy_chk[grib_yy_base[grib_yy_current_state] + grib_yy_c] != grib_yy_current_state ) { grib_yy_current_state = (int) grib_yy_def[grib_yy_current_state]; - if ( grib_yy_current_state >= 514 ) + if ( grib_yy_current_state >= 502 ) grib_yy_c = grib_yy_meta[(unsigned int) grib_yy_c]; } grib_yy_current_state = grib_yy_nxt[grib_yy_base[grib_yy_current_state] + (unsigned int) grib_yy_c]; - grib_yy_is_jam = (grib_yy_current_state == 513); + grib_yy_is_jam = (grib_yy_current_state == 501); return grib_yy_is_jam ? 0 : grib_yy_current_state; } @@ -2947,7 +2918,7 @@ void grib_yyfree (void * ptr ) #define YYTABLES_NAME "grib_yytables" -#line 227 "gribl.l" +#line 223 "gribl.l" diff --git a/src/grib_memory.c b/src/grib_memory.c index 4dfc52df0..a91a4ab81 100755 --- a/src/grib_memory.c +++ b/src/grib_memory.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api_internal.h" /* #define CHECK_FOR_LEAKS */ diff --git a/src/grib_nearest_class_gen.c b/src/grib_nearest_class_gen.c index 18eccf236..7005c161e 100644 --- a/src/grib_nearest_class_gen.c +++ b/src/grib_nearest_class_gen.c @@ -8,13 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - - #include "grib_api_internal.h" /* diff --git a/src/grib_nearest_class_latlon_reduced.c b/src/grib_nearest_class_latlon_reduced.c index 481a5fedd..002457e77 100644 --- a/src/grib_nearest_class_latlon_reduced.c +++ b/src/grib_nearest_class_latlon_reduced.c @@ -7,12 +7,6 @@ * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - #include "grib_api_internal.h" diff --git a/src/grib_nearest_class_reduced.c b/src/grib_nearest_class_reduced.c index 6c2aab3bd..b54014928 100644 --- a/src/grib_nearest_class_reduced.c +++ b/src/grib_nearest_class_reduced.c @@ -7,12 +7,6 @@ * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - #include "grib_api_internal.h" diff --git a/src/grib_nearest_class_regular.c b/src/grib_nearest_class_regular.c index 39f8d8015..4d3dcc7be 100644 --- a/src/grib_nearest_class_regular.c +++ b/src/grib_nearest_class_regular.c @@ -8,12 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - #include "grib_api_internal.h" /* diff --git a/src/grib_nearest_class_sh.c b/src/grib_nearest_class_sh.c index 7030ff1f3..ba12faed0 100644 --- a/src/grib_nearest_class_sh.c +++ b/src/grib_nearest_class_sh.c @@ -8,12 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * - * - * - */ - #include "grib_api_internal.h" /* diff --git a/src/grib_openjpeg_encoding.c b/src/grib_openjpeg_encoding.c index 999856c7e..7eb3af43a 100644 --- a/src/grib_openjpeg_encoding.c +++ b/src/grib_openjpeg_encoding.c @@ -124,7 +124,6 @@ cleanup: return err; } - int grib_openjpeg_decode(grib_context *c, unsigned char *buf, size_t *buflen, double *val, size_t *n_vals) { int err = GRIB_SUCCESS; diff --git a/src/grib_rules.c b/src/grib_rules.c index 455d6369d..91e9576ee 100644 --- a/src/grib_rules.c +++ b/src/grib_rules.c @@ -18,8 +18,8 @@ grib_rule_entry *grib_new_rule_entry(grib_context* c,const char* name,grib_expre return e; } -#if 0 -/* new GCC compiler v4.5.0 complains function is defined but not used*/ +/* +new GCC compiler v4.5.0 complains function is defined but not used static void grib_rule_entry_delete(grib_context* c,grib_rule_entry* e) { if(e) @@ -30,7 +30,7 @@ static void grib_rule_entry_delete(grib_context* c,grib_rule_entry* e) } } -#endif +*/ grib_rule* grib_new_rule(grib_context* c,grib_expression* condition,grib_rule_entry* entries) { @@ -39,3 +39,5 @@ grib_rule* grib_new_rule(grib_context* c,grib_expression* condition,grib_rule_en r->entries = entries; return r; } + + diff --git a/src/grib_templates.c b/src/grib_templates.c index 860c20c8d..d9275c16a 100644 --- a/src/grib_templates.c +++ b/src/grib_templates.c @@ -79,53 +79,53 @@ static char* try_template_path(grib_context* c,const char* dir,const char* name) grib_handle* grib_external_template(grib_context* c,const char* name) { - const char *base = c->grib_samples_path; - char buffer[1024]; - char *p = buffer; - grib_handle *g = NULL; - /* printf("GRIB_TEMPLATES_PATH=%s\n",base); */ + const char *base = c->grib_samples_path; + char buffer[1024]; + char *p = buffer; + grib_handle *g = NULL; + /* printf("GRIB_TEMPLATES_PATH=%s\n",base); */ - if(!base) return NULL; + if(!base) return NULL; - while(*base) - { - if(*base == ':') - { - *p = 0; - g = try_template(c,buffer,name); - if(g) return g; - p = buffer; - base++; /*advance past delimiter*/ - } - *p++ = *base++; - } + while(*base) + { + if(*base == ':') + { + *p = 0; + g = try_template(c,buffer,name); + if(g) return g; + p = buffer; + base++; /*advance past delimiter*/ + } + *p++ = *base++; + } - *p = 0; - return g = try_template(c,buffer,name); + *p = 0; + return g = try_template(c,buffer,name); } char* grib_external_template_path(grib_context* c,const char* name) { - const char *base = c->grib_samples_path; - char buffer[1024]; - char *p = buffer; - char *g = NULL; + const char *base = c->grib_samples_path; + char buffer[1024]; + char *p = buffer; + char *g = NULL; - if(!base) return NULL; + if(!base) return NULL; - while(*base) - { - if(*base == ':') - { - *p = 0; - g = try_template_path(c,buffer,name); - if(g) return g; - p = buffer; - base++; - } - *p++ = *base++; - } + while(*base) + { + if(*base == ':') + { + *p = 0; + g = try_template_path(c,buffer,name); + if(g) return g; + p = buffer; + base++; + } + *p++ = *base++; + } - *p = 0; - return g = try_template_path(c,buffer,name); + *p = 0; + return g = try_template_path(c,buffer,name); } diff --git a/src/grib_timer.c b/src/grib_timer.c index 3cfb51003..31294d408 100644 --- a/src/grib_timer.c +++ b/src/grib_timer.c @@ -1,7 +1,19 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api_internal.h" -#include -#include -#include +#ifndef _WIN32 +# include +# include +# include +#endif #if GRIB_TIMER diff --git a/src/grib_util.c b/src/grib_util.c index 882dc6183..bae1d1657 100644 --- a/src/grib_util.c +++ b/src/grib_util.c @@ -14,30 +14,49 @@ ***************************************************************************/ #include "grib_api_internal.h" +#ifdef _WIN32 +/* Microsoft Windows Visual Studio support. Implementation of Unix rint() */ +double rint(double x) +{ + char * buf = 0; + int decimal=0, sign=0, err = 0; + double result = 0; + buf = (char*) malloc(_CVTBUFSIZE); + err = _fcvt_s(buf, _CVTBUFSIZE, x, 0, &decimal, &sign); + Assert(err == 0); + result = atof(buf); + if(sign == 1) { + result = result * -1; + } + free(buf); + return result; +} +#endif + static void set_total_length(unsigned char* buffer,long *section_length,long *section_offset,int edition,size_t totalLength) { long off; switch (edition) { - case 1: - if(totalLength < 0x800000 ) { - off=32; - grib_encode_unsigned_long(buffer, (unsigned long)totalLength , &off, 24); - } else { - long s4len,t120; - totalLength -= 4; - t120 = (totalLength+119)/120; - s4len = t120*120 - totalLength; - totalLength = 0x800000 | t120; - off=32; - grib_encode_unsigned_long(buffer, (unsigned long)totalLength , &off, 24); - off=section_offset[4]*8; - grib_encode_unsigned_long(buffer, (unsigned long)s4len , &off, 24); - } - break; - case 2: - off=64; - grib_encode_unsigned_long(buffer, (unsigned long)totalLength , &off, 64); - break; + case 1: + if(totalLength < 0x800000 ) { + off=32; + grib_encode_unsigned_long(buffer, (unsigned long)totalLength , &off, 24); + } else { + long s4len,t120; + totalLength -= 4; + t120 = (totalLength+119)/120; + s4len = t120*120 - totalLength; + totalLength = 0x800000 | t120; + off=32; + grib_encode_unsigned_long(buffer, (unsigned long)totalLength , &off, 24); + off=section_offset[4]*8; + grib_encode_unsigned_long(buffer, (unsigned long)s4len , &off, 24); + } + break; + case 2: + off=64; + grib_encode_unsigned_long(buffer, (unsigned long)totalLength , &off, 64); + break; } } @@ -58,7 +77,7 @@ static grib_handle* grib_sections_copy_internal(grib_handle* hfrom,grib_handle* *err=grib_get_long(hfrom,"edition",&edition); if (*err) return NULL; - + for (i=0;i<=hfrom->sections_count;i++) { if (sections[i]) {h=hfrom;} @@ -82,33 +101,33 @@ static grib_handle* grib_sections_copy_internal(grib_handle* hfrom,grib_handle* off=0; for (i=0;i<=hfrom->sections_count;i++) { grib_handle* h; - if (sections[i]) h=hfrom; + if (sections[i]) h=hfrom; else h=hto; p=memcpy(p,h->buffer->data+section_offset[i],section_length[i]); section_offset[i]=off; off+=section_length[i]; p+=section_length[i]; - } + } - /* copy section 3 present flag*/ - if (edition==1) { + /* copy section 3 present flag*/ + if (edition==1) { const void* buffer_to=NULL; size_t size_to=0; grib_get_message(hto,&buffer_to,&size_to); memcpy(buffer+15,((unsigned char*)buffer_to)+15,1); } - set_total_length(buffer,section_length,section_offset,edition,totalLength); + set_total_length(buffer,section_length,section_offset,edition,totalLength); - h=grib_handle_new_from_message(hfrom->context,buffer,totalLength); + h=grib_handle_new_from_message(hfrom->context,buffer,totalLength); - /*to allow free of buffer*/ - h->buffer->property = GRIB_MY_BUFFER; + /*to allow free of buffer*/ + h->buffer->property = GRIB_MY_BUFFER; - switch (edition) { - case 1: + switch (edition) { + case 1: if (sections[1] && sections[2]) break; - + if (sections[1]) { long PVPresent; grib_get_long(hfrom,"PVPresent",&PVPresent); @@ -159,9 +178,9 @@ static grib_handle* grib_sections_copy_internal(grib_handle* hfrom,grib_handle* grib_set_long(h,"discipline",discipline); } break; - } + } - return h; + return h; } grib_handle* grib_util_sections_copy(grib_handle* hfrom,grib_handle* hto,int what,int *err) { @@ -187,69 +206,69 @@ grib_handle* grib_util_sections_copy(grib_handle* hfrom,grib_handle* hto,int wha if (what & GRIB_SECTION_GRID) { switch (edition_from) { - case 1: - sections_to_copy[2]=1; - break; - case 2: - sections_to_copy[3]=1; - break; + case 1: + sections_to_copy[2]=1; + break; + case 2: + sections_to_copy[3]=1; + break; } } if (what & GRIB_SECTION_DATA) { switch (edition_from) { - case 1: - sections_to_copy[3]=1; - sections_to_copy[4]=1; - break; - case 2: - sections_to_copy[5]=1; - sections_to_copy[6]=1; - sections_to_copy[7]=1; - break; + case 1: + sections_to_copy[3]=1; + sections_to_copy[4]=1; + break; + case 2: + sections_to_copy[5]=1; + sections_to_copy[6]=1; + sections_to_copy[7]=1; + break; } } if (what & GRIB_SECTION_LOCAL) { switch (edition_from) { - case 1: - sections_to_copy[1]=1; - break; - case 2: - sections_to_copy[2]=1; - break; + case 1: + sections_to_copy[1]=1; + break; + case 2: + sections_to_copy[2]=1; + break; } } if (what & GRIB_SECTION_PRODUCT) { switch (edition_from) { - case 1: - grib_get_long(hfrom,"localDefinitionNumber",&localDefinitionNumber); - if (localDefinitionNumber==13) { - sections_to_copy[4]=1; - } - sections_to_copy[1]=1; - break; - case 2: - sections_to_copy[1]=1; + case 1: + grib_get_long(hfrom,"localDefinitionNumber",&localDefinitionNumber); + if (localDefinitionNumber==13) { sections_to_copy[4]=1; - break; + } + sections_to_copy[1]=1; + break; + case 2: + sections_to_copy[1]=1; + sections_to_copy[4]=1; + break; } } if (what & GRIB_SECTION_BITMAP) { switch (edition_from) { - case 1: - sections_to_copy[3]=1; - break; - case 2: - sections_to_copy[6]=1; - break; + case 1: + sections_to_copy[3]=1; + break; + case 2: + sections_to_copy[6]=1; + break; } } return grib_sections_copy_internal(hfrom,hto,sections_to_copy,err); - + } static grib_trie* init_list(const char* name); @@ -275,7 +294,7 @@ static grib_trie* init_list(const char* name) { grib_string_list* next=0; grib_trie* trie_list; grib_context* c=grib_context_get_default(); - full_path=grib_context_full_path(c,name); + full_path=grib_context_full_defs_path(c,name); fh=fopen(full_path,"r"); if (!fh) { @@ -310,41 +329,41 @@ static grib_trie* init_list(const char* name) { } static void print_values(grib_context* c,const grib_util_grid_spec* spec,const double* data_values,size_t data_values_count,const grib_values *values,int count) { - int i; - printf("GRIB_API DEBUG grib_util grib_set_values: setting %d values \n",count); + int i; + printf("GRIB_API DEBUG grib_util grib_set_values: setting %d values \n",count); - for(i = 0; i < count ; i++) + for(i = 0; i < count ; i++) + { + switch(values[i].type) { - switch(values[i].type) - { - case GRIB_TYPE_LONG: printf("GRIB_API DEBUG grib_util: => %s = %ld;\n" - ,values[i].name,(long)values[i].long_value); break; - case GRIB_TYPE_DOUBLE: printf("GRIB_API DEBUG grib_util: => %s = %.16e;\n" - ,values[i].name,values[i].double_value); break; - case GRIB_TYPE_STRING: printf("GRIB_API DEBUG grib_util: => %s = \"%s\";\n" - ,values[i].name,values[i].string_value); break; - } + case GRIB_TYPE_LONG: printf("GRIB_API DEBUG grib_util: => %s = %ld;\n" + ,values[i].name,(long)values[i].long_value); break; + case GRIB_TYPE_DOUBLE: printf("GRIB_API DEBUG grib_util: => %s = %.16e;\n" + ,values[i].name,values[i].double_value); break; + case GRIB_TYPE_STRING: printf("GRIB_API DEBUG grib_util: => %s = \"%s\";\n" + ,values[i].name,values[i].string_value); break; } + } - if(spec->bitmapPresent) { - int missing = 0; - double min = 1e100; - for(i = 0; i < data_values_count ; i++) - { - double d = data_values[i] - spec->missingValue; - if(d < 0) d = -d; - - if(d < min) { - min = d; - } - - if(data_values[i] == spec->missingValue) - missing++; - + if(spec->bitmapPresent) { + int missing = 0; + double min = 1e100; + for(i = 0; i < data_values_count ; i++) + { + double d = data_values[i] - spec->missingValue; + if(d < 0) d = -d; + if(d < min) { + min = d; } + if(data_values[i] == spec->missingValue) + missing++; + + } + + } } #define ISECTION_2 3000 @@ -383,7 +402,7 @@ grib_handle* grib_util_set_spec(grib_handle* h, double laplacianOperator; int packingTypeIsSet=0; int setSecondOrder=0; - size_t slen=17; + size_t slen=17; static grib_util_packing_spec default_packing_spec = {0, }; @@ -417,63 +436,63 @@ grib_handle* grib_util_set_spec(grib_handle* h, if (flags & GRIB_UTIL_SET_SPEC_FLAGS_ONLY_PACKING) { if (packing_spec->packing == GRIB_UTIL_PACKING_USE_PROVIDED && - strcmp(input_packing_type,"grid_simple_matrix")) { + strcmp(input_packing_type,"grid_simple_matrix")) { switch (packing_spec->packing_type) { - case GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX: - if (strcmp(input_packing_type,"spectral_complex") && !strcmp(input_packing_type,"spectral_simple")) - SET_STRING_VALUE("packingType","spectral_complex"); - break; - case GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE: - if (strcmp(input_packing_type,"spectral_simple") && !strcmp(input_packing_type,"spectral_complex")) - SET_STRING_VALUE("packingType","spectral_simple"); - break; - case GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE: - if (strcmp(input_packing_type,"grid_simple") && !strcmp(input_packing_type,"grid_complex") ) - SET_STRING_VALUE("packingType","grid_simple"); - break; - case GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX: - SET_STRING_VALUE("packingType","grid_simple_matrix"); - break; - case GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX: - if (strcmp(input_packing_type,"grid_complex") && !strcmp(input_packing_type,"grid_simple")) - SET_STRING_VALUE("packingType","grid_complex"); - break; - case GRIB_UTIL_PACKING_TYPE_JPEG: - if (strcmp(input_packing_type,"grid_jpeg") && !strcmp(input_packing_type,"grid_simple")) - SET_STRING_VALUE("packingType","grid_jpeg"); - break; - case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER: - /* we delay the set of grid_second_order because we don't want + case GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX: + if (strcmp(input_packing_type,"spectral_complex") && !strcmp(input_packing_type,"spectral_simple")) + SET_STRING_VALUE("packingType","spectral_complex"); + break; + case GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE: + if (strcmp(input_packing_type,"spectral_simple") && !strcmp(input_packing_type,"spectral_complex")) + SET_STRING_VALUE("packingType","spectral_simple"); + break; + case GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE: + if (strcmp(input_packing_type,"grid_simple") && !strcmp(input_packing_type,"grid_complex") ) + SET_STRING_VALUE("packingType","grid_simple"); + break; + case GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX: + SET_STRING_VALUE("packingType","grid_simple_matrix"); + break; + case GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX: + if (strcmp(input_packing_type,"grid_complex") && !strcmp(input_packing_type,"grid_simple")) + SET_STRING_VALUE("packingType","grid_complex"); + break; + case GRIB_UTIL_PACKING_TYPE_JPEG: + if (strcmp(input_packing_type,"grid_jpeg") && !strcmp(input_packing_type,"grid_simple")) + SET_STRING_VALUE("packingType","grid_jpeg"); + break; + case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER: + /* we delay the set of grid_second_order because we don't want to do it on a field with bitsPerValue=0 */ - setSecondOrder=1; - break; - default : - printf("invalid packing_spec->packing_type = %ld\n",(long)packing_spec->packing_type); - abort(); + setSecondOrder=1; + break; + default : + printf("invalid packing_spec->packing_type = %ld\n",(long)packing_spec->packing_type); + abort(); } packingTypeIsSet=1; } switch(packing_spec->accuracy) { - case GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT: + case GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT: break; - case GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES: - if (input_bits_per_value!=packing_spec->bitsPerValue) - SET_LONG_VALUE("bitsPerValue", packing_spec->bitsPerValue); - break; + case GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES: + if (input_bits_per_value!=packing_spec->bitsPerValue) + SET_LONG_VALUE("bitsPerValue", packing_spec->bitsPerValue); + break; - case GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT: - break; + case GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT: + break; - case GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR: - if (input_decimal_scale_factor!=packing_spec->decimalScaleFactor) - SET_LONG_VALUE("decimalScaleFactor", packing_spec->decimalScaleFactor); - break; + case GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR: + if (input_decimal_scale_factor!=packing_spec->decimalScaleFactor) + SET_LONG_VALUE("decimalScaleFactor", packing_spec->decimalScaleFactor); + break; - default: - printf("invalid packing_spec->accuracy = %ld\n",(long)packing_spec->accuracy); - abort(); + default: + printf("invalid packing_spec->accuracy = %ld\n",(long)packing_spec->accuracy); + abort(); } /*nothing to be changed*/ @@ -496,7 +515,7 @@ grib_handle* grib_util_set_spec(grib_handle* h, } if (h->context->debug==-1) { int j=0; - printf("GRIB_API DEBUG grib_util: grib_set_double_array\n"); + printf("GRIB_API DEBUG grib_util: grib_set_double_array\n"); for (j=0;j<20;j++) printf("GRIB_API DEBUG grib_util %g\n",data_values[j]); printf("GRIB_API DEBUG grib_util: data_values_count=%d \n",(int)data_values_count); } @@ -510,56 +529,56 @@ grib_handle* grib_util_set_spec(grib_handle* h, /* convert to second_order if not constant field */ - if (setSecondOrder ) { - size_t slen=17; - int ii=0; - int constant=1; - double missingValue=0; - double value=missingValue; + if (setSecondOrder ) { + size_t slen=17; + int ii=0; + int constant=1; + double missingValue=0; + double value=missingValue; - grib_get_double(h,"missingValue",&missingValue); - for (ii=0;ii65534 && h->context->no_spd ) { - slen=24; - grib_set_string(h,"packingType","grid_second_order_no_SPD",&slen); - grib_handle_delete(htmp); - } else { - grib_handle_delete(h); - h=htmp; - } + grib_get_double(h,"missingValue",&missingValue); + for (ii=0;iicontext->gribex_mode_on) { - h->context->gribex_mode_on=0; - grib_set_double_array(h,"values",data_values,data_values_count); - h->context->gribex_mode_on=1; + if (value!=data_values[ii]) { + constant=0; + break; + } } } - } + } + if (!constant) { + if (editionNumber == 1 ) { + long numberOfGroups; + grib_handle* htmp=grib_handle_clone(h); + + slen=17; + grib_set_string(htmp,"packingType","grid_second_order",&slen); + grib_get_long(htmp,"numberOfGroups",&numberOfGroups); + /* GRIBEX is not able to decode overflown numberOfGroups with SPD */ + if (numberOfGroups>65534 && h->context->no_spd ) { + slen=24; + grib_set_string(h,"packingType","grid_second_order_no_SPD",&slen); + grib_handle_delete(htmp); + } else { + grib_handle_delete(h); + h=htmp; + } + } else { + slen=17; + grib_set_string(h,"packingType","grid_second_order",&slen); + grib_set_double_array(h,"values",data_values,data_values_count); + } + } else { + if (h->context->gribex_mode_on) { + h->context->gribex_mode_on=0; + grib_set_double_array(h,"values",data_values,data_values_count); + h->context->gribex_mode_on=1; + } + } + } return h; } @@ -567,41 +586,41 @@ grib_handle* grib_util_set_spec(grib_handle* h, switch(spec->grid_type) { - case GRIB_UTIL_GRID_SPEC_REGULAR_LL: - grid_type = "regular_ll"; - break; + case GRIB_UTIL_GRID_SPEC_REGULAR_LL: + grid_type = "regular_ll"; + break; - case GRIB_UTIL_GRID_SPEC_ROTATED_LL: - grid_type = "rotated_ll"; - break; + case GRIB_UTIL_GRID_SPEC_ROTATED_LL: + grid_type = "rotated_ll"; + break; - case GRIB_UTIL_GRID_SPEC_REGULAR_GG: - grid_type = "regular_gg"; - break; + case GRIB_UTIL_GRID_SPEC_REGULAR_GG: + grid_type = "regular_gg"; + break; - case GRIB_UTIL_GRID_SPEC_ROTATED_GG: - grid_type = "rotated_gg"; - break; + case GRIB_UTIL_GRID_SPEC_ROTATED_GG: + grid_type = "rotated_gg"; + break; - case GRIB_UTIL_GRID_SPEC_REDUCED_LL: - grid_type = "reduced_ll"; - break; + case GRIB_UTIL_GRID_SPEC_REDUCED_LL: + grid_type = "reduced_ll"; + break; - case GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC: - grid_type = "polar_stereographic"; - break; + case GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC: + grid_type = "polar_stereographic"; + break; - case GRIB_UTIL_GRID_SPEC_REDUCED_GG: - grid_type = "reduced_gg"; - break; + case GRIB_UTIL_GRID_SPEC_REDUCED_GG: + grid_type = "reduced_gg"; + break; - case GRIB_UTIL_GRID_SPEC_SH: - grid_type = "sh"; - break; + case GRIB_UTIL_GRID_SPEC_SH: + grid_type = "sh"; + break; - default: - *err = GRIB_NOT_IMPLEMENTED; - return NULL; + default: + *err = GRIB_NOT_IMPLEMENTED; + return NULL; } @@ -614,11 +633,11 @@ grib_handle* grib_util_set_spec(grib_handle* h, size_t n = sizeof(levtype); Assert(grib_get_string(h,"levelType",levtype,&n) == 0); switch (spec->grid_type) { - case GRIB_UTIL_GRID_SPEC_REDUCED_GG: - sprintf(name, "%s_pl_%ld_grib%ld", grid_type,spec->N, editionNumber); - break; - default : - sprintf(name, "%s_pl_grib%ld", grid_type, editionNumber); + case GRIB_UTIL_GRID_SPEC_REDUCED_GG: + sprintf(name, "%s_pl_%ld_grib%ld", grid_type,spec->N, editionNumber); + break; + default : + sprintf(name, "%s_pl_grib%ld", grid_type, editionNumber); } } @@ -631,187 +650,187 @@ grib_handle* grib_util_set_spec(grib_handle* h, /* Set grid */ switch(spec->grid_type) { - case GRIB_UTIL_GRID_SPEC_REGULAR_LL: - case GRIB_UTIL_GRID_SPEC_ROTATED_LL: + case GRIB_UTIL_GRID_SPEC_REGULAR_LL: + case GRIB_UTIL_GRID_SPEC_ROTATED_LL: - COPY_SPEC_LONG (bitmapPresent); - if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); + COPY_SPEC_LONG (bitmapPresent); + if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); - SET_LONG_VALUE ("ijDirectionIncrementGiven", 1); + SET_LONG_VALUE ("ijDirectionIncrementGiven", 1); - /* default iScansNegatively=0 jScansPositively=0 is ok */ - COPY_SPEC_LONG(iScansNegatively); - COPY_SPEC_LONG(jScansPositively); + /* default iScansNegatively=0 jScansPositively=0 is ok */ + COPY_SPEC_LONG(iScansNegatively); + COPY_SPEC_LONG(jScansPositively); - COPY_SPEC_LONG(Ni); - COPY_SPEC_LONG(Nj); + COPY_SPEC_LONG(Ni); + COPY_SPEC_LONG(Nj); - COPY_SPEC_DOUBLE(iDirectionIncrementInDegrees); - COPY_SPEC_DOUBLE(jDirectionIncrementInDegrees); + COPY_SPEC_DOUBLE(iDirectionIncrementInDegrees); + COPY_SPEC_DOUBLE(jDirectionIncrementInDegrees); - COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); + COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); + COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); - break; + break; - case GRIB_UTIL_GRID_SPEC_REGULAR_GG: - case GRIB_UTIL_GRID_SPEC_ROTATED_GG: + case GRIB_UTIL_GRID_SPEC_REGULAR_GG: + case GRIB_UTIL_GRID_SPEC_ROTATED_GG: - COPY_SPEC_LONG (bitmapPresent); - if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); - SET_LONG_VALUE("ijDirectionIncrementGiven", 1); + COPY_SPEC_LONG (bitmapPresent); + if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); + SET_LONG_VALUE("ijDirectionIncrementGiven", 1); - /* TODO: add Assert */ + /* TODO: add Assert */ - COPY_SPEC_LONG(Ni); - COPY_SPEC_DOUBLE(iDirectionIncrementInDegrees); + COPY_SPEC_LONG(Ni); + COPY_SPEC_DOUBLE(iDirectionIncrementInDegrees); - COPY_SPEC_LONG(Nj); - COPY_SPEC_LONG(N); + COPY_SPEC_LONG(Nj); + COPY_SPEC_LONG(N); - /* TODO: Compute here ... */ - COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); + /* TODO: Compute here ... */ + COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); - break; + COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); + break; - case GRIB_UTIL_GRID_SPEC_REDUCED_LL: - COPY_SPEC_LONG (bitmapPresent); - if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); - SET_LONG_VALUE("ijDirectionIncrementGiven", 0); + case GRIB_UTIL_GRID_SPEC_REDUCED_LL: + COPY_SPEC_LONG (bitmapPresent); + if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); + SET_LONG_VALUE("ijDirectionIncrementGiven", 0); - COPY_SPEC_LONG(Nj); + COPY_SPEC_LONG(Nj); - COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); + COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); - break; + COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); + break; - case GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC: - COPY_SPEC_LONG (bitmapPresent); - if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); + case GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC: + COPY_SPEC_LONG (bitmapPresent); + if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); - COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); - COPY_SPEC_LONG(Ni); - COPY_SPEC_LONG(Nj); + COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); + COPY_SPEC_LONG(Ni); + COPY_SPEC_LONG(Nj); - /* default iScansNegatively=0 jScansPositively=0 is ok */ - COPY_SPEC_LONG(iScansNegatively); - COPY_SPEC_LONG(jScansPositively); + /* default iScansNegatively=0 jScansPositively=0 is ok */ + COPY_SPEC_LONG(iScansNegatively); + COPY_SPEC_LONG(jScansPositively); - COPY_SPEC_DOUBLE(orientationOfTheGridInDegrees); + COPY_SPEC_DOUBLE(orientationOfTheGridInDegrees); - COPY_SPEC_LONG(DxInMetres); - COPY_SPEC_LONG(DyInMetres); + COPY_SPEC_LONG(DxInMetres); + COPY_SPEC_LONG(DyInMetres); - break; + break; - case GRIB_UTIL_GRID_SPEC_REDUCED_GG: - COPY_SPEC_LONG (bitmapPresent); - if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); - SET_LONG_VALUE("ijDirectionIncrementGiven", 0); + case GRIB_UTIL_GRID_SPEC_REDUCED_GG: + COPY_SPEC_LONG (bitmapPresent); + if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue); + SET_LONG_VALUE("ijDirectionIncrementGiven", 0); - COPY_SPEC_LONG(Nj); - COPY_SPEC_LONG(N); + COPY_SPEC_LONG(Nj); + COPY_SPEC_LONG(N); - COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); + COPY_SPEC_DOUBLE(longitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(longitudeOfLastGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); - COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); + COPY_SPEC_DOUBLE(latitudeOfFirstGridPointInDegrees); + COPY_SPEC_DOUBLE(latitudeOfLastGridPointInDegrees); - break; + break; - case GRIB_UTIL_GRID_SPEC_SH: - *err=grib_get_string(h,"gridType",input_grid_type,&input_grid_type_len); + case GRIB_UTIL_GRID_SPEC_SH: + *err=grib_get_string(h,"gridType",input_grid_type,&input_grid_type_len); - SET_LONG_VALUE("J", spec->truncation); - SET_LONG_VALUE("K", spec->truncation); - SET_LONG_VALUE("M", spec->truncation); + SET_LONG_VALUE("J", spec->truncation); + SET_LONG_VALUE("K", spec->truncation); + SET_LONG_VALUE("M", spec->truncation); - if(packing_spec->packing_type == GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX) - { - SET_STRING_VALUE("packingType", "spectral_complex"); - packingTypeIsSet=1; - SET_LONG_VALUE("JS", 20); - SET_LONG_VALUE("KS", 20); - SET_LONG_VALUE("MS", 20); - if (packing_spec->packing == GRIB_UTIL_PACKING_USE_PROVIDED && editionNumber==2 ) { - SET_LONG_VALUE("computeLaplacianOperator", 1); - } else if ((!(*err) && strcmp(input_grid_type,"sh")) || packing_spec->computeLaplacianOperator ) { - SET_LONG_VALUE("computeLaplacianOperator", 1); - if (packing_spec->truncateLaplacian) - SET_LONG_VALUE("truncateLaplacian",1); - } else { - SET_LONG_VALUE("computeLaplacianOperator", 0); - *err=grib_get_double(h,"laplacianOperator",&laplacianOperator); - if (packing_spec->truncateLaplacian) SET_LONG_VALUE("truncateLaplacian",1); - SET_DOUBLE_VALUE("laplacianOperator", packing_spec->laplacianOperator); - if (laplacianOperator) { - SET_DOUBLE_VALUE("laplacianOperator", laplacianOperator); - } + if(packing_spec->packing_type == GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX) + { + SET_STRING_VALUE("packingType", "spectral_complex"); + packingTypeIsSet=1; + SET_LONG_VALUE("JS", 20); + SET_LONG_VALUE("KS", 20); + SET_LONG_VALUE("MS", 20); + if (packing_spec->packing == GRIB_UTIL_PACKING_USE_PROVIDED && editionNumber==2 ) { + SET_LONG_VALUE("computeLaplacianOperator", 1); + } else if ((!(*err) && strcmp(input_grid_type,"sh")) || packing_spec->computeLaplacianOperator ) { + SET_LONG_VALUE("computeLaplacianOperator", 1); + if (packing_spec->truncateLaplacian) + SET_LONG_VALUE("truncateLaplacian",1); + } else { + SET_LONG_VALUE("computeLaplacianOperator", 0); + *err=grib_get_double(h,"laplacianOperator",&laplacianOperator); + if (packing_spec->truncateLaplacian) SET_LONG_VALUE("truncateLaplacian",1); + SET_DOUBLE_VALUE("laplacianOperator", packing_spec->laplacianOperator); + if (laplacianOperator) { + SET_DOUBLE_VALUE("laplacianOperator", laplacianOperator); } - } - break; + } + + break; } /* Set rotation */ switch(spec->grid_type) { - case GRIB_UTIL_GRID_SPEC_ROTATED_LL: - case GRIB_UTIL_GRID_SPEC_ROTATED_GG: - COPY_SPEC_LONG(uvRelativeToGrid); - COPY_SPEC_DOUBLE(latitudeOfSouthernPoleInDegrees); - COPY_SPEC_DOUBLE(longitudeOfSouthernPoleInDegrees); - break; + case GRIB_UTIL_GRID_SPEC_ROTATED_LL: + case GRIB_UTIL_GRID_SPEC_ROTATED_GG: + COPY_SPEC_LONG(uvRelativeToGrid); + COPY_SPEC_DOUBLE(latitudeOfSouthernPoleInDegrees); + COPY_SPEC_DOUBLE(longitudeOfSouthernPoleInDegrees); + break; } /* process packing options */ if (!packingTypeIsSet && - packing_spec->packing == GRIB_UTIL_PACKING_USE_PROVIDED && - strcmp(input_packing_type,"grid_simple_matrix")) { + packing_spec->packing == GRIB_UTIL_PACKING_USE_PROVIDED && + strcmp(input_packing_type,"grid_simple_matrix")) { switch (packing_spec->packing_type) { - case GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX: - if (strcmp(input_packing_type,"spectral_complex") && !strcmp(input_packing_type,"spectral_simple")) - SET_STRING_VALUE("packingType","spectral_complex"); - break; - case GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE: - if (strcmp(input_packing_type,"spectral_simple") && !strcmp(input_packing_type,"spectral_complex")) - SET_STRING_VALUE("packingType","spectral_simple"); - break; - case GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE: - if (strcmp(input_packing_type,"grid_simple") && !strcmp(input_packing_type,"grid_complex")) - SET_STRING_VALUE("packingType","grid_simple"); - break; - case GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX: - if (strcmp(input_packing_type,"grid_complex") && !strcmp(input_packing_type,"grid_simple")) - SET_STRING_VALUE("packingType","grid_complex"); - break; - case GRIB_UTIL_PACKING_TYPE_JPEG: - if (strcmp(input_packing_type,"grid_jpeg") && !strcmp(input_packing_type,"grid_simple")) - SET_STRING_VALUE("packingType","grid_jpeg"); - break; - case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER: - /* we delay the set of grid_second_order because we don't want + case GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX: + if (strcmp(input_packing_type,"spectral_complex") && !strcmp(input_packing_type,"spectral_simple")) + SET_STRING_VALUE("packingType","spectral_complex"); + break; + case GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE: + if (strcmp(input_packing_type,"spectral_simple") && !strcmp(input_packing_type,"spectral_complex")) + SET_STRING_VALUE("packingType","spectral_simple"); + break; + case GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE: + if (strcmp(input_packing_type,"grid_simple") && !strcmp(input_packing_type,"grid_complex")) + SET_STRING_VALUE("packingType","grid_simple"); + break; + case GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX: + if (strcmp(input_packing_type,"grid_complex") && !strcmp(input_packing_type,"grid_simple")) + SET_STRING_VALUE("packingType","grid_complex"); + break; + case GRIB_UTIL_PACKING_TYPE_JPEG: + if (strcmp(input_packing_type,"grid_jpeg") && !strcmp(input_packing_type,"grid_simple")) + SET_STRING_VALUE("packingType","grid_jpeg"); + break; + case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER: + /* we delay the set of grid_second_order because we don't want to do it on a field with bitsPerValue=0 */ - setSecondOrder=1; - break; - default : - printf("invalid packing_spec->packing_type = %ld\n",(long)packing_spec->packing_type); - abort(); + setSecondOrder=1; + break; + default : + printf("invalid packing_spec->packing_type = %ld\n",(long)packing_spec->packing_type); + abort(); } } if (!strcmp(input_packing_type,"grid_simple_matrix")) { @@ -838,33 +857,33 @@ grib_handle* grib_util_set_spec(grib_handle* h, switch(packing_spec->accuracy) { - case GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT: - { - long bitsPerValue = 0; - Assert(grib_get_long(h, "bitsPerValue", &bitsPerValue) == 0); - SET_LONG_VALUE("bitsPerValue", bitsPerValue); - } - break; + case GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT: + { + long bitsPerValue = 0; + Assert(grib_get_long(h, "bitsPerValue", &bitsPerValue) == 0); + SET_LONG_VALUE("bitsPerValue", bitsPerValue); + } + break; - case GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES: - SET_LONG_VALUE("bitsPerValue", packing_spec->bitsPerValue); - break; + case GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES: + SET_LONG_VALUE("bitsPerValue", packing_spec->bitsPerValue); + break; - case GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT: - { - long decimalScaleFactor = 0; - Assert(grib_get_long(h, "decimalScaleFactor", &decimalScaleFactor) == 0); - SET_LONG_VALUE("decimalScaleFactor", decimalScaleFactor); - } - break; + case GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT: + { + long decimalScaleFactor = 0; + Assert(grib_get_long(h, "decimalScaleFactor", &decimalScaleFactor) == 0); + SET_LONG_VALUE("decimalScaleFactor", decimalScaleFactor); + } + break; - case GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR: - SET_LONG_VALUE("decimalScaleFactor", packing_spec->decimalScaleFactor); - break; + case GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR: + SET_LONG_VALUE("decimalScaleFactor", packing_spec->decimalScaleFactor); + break; - default: - printf("invalid packing_spec->accuracy = %ld\n",(long)packing_spec->accuracy); - abort(); + default: + printf("invalid packing_spec->accuracy = %ld\n",(long)packing_spec->accuracy); + abort(); } if(packing_spec->extra_settings_count) { @@ -935,58 +954,58 @@ grib_handle* grib_util_set_spec(grib_handle* h, grib_set_string(outh,"packingType","grid_simple",&slen); } } - */ + */ - /* convert to second_order if not constant field */ - if (setSecondOrder ) { - int ii=0; - int constant=1; - double missingValue=0; - double value=missingValue; + /* convert to second_order if not constant field */ + if (setSecondOrder ) { + int ii=0; + int constant=1; + double missingValue=0; + double value=missingValue; - grib_get_double(outh,"missingValue",&missingValue); - for (ii=0;ii65534 && outh->context->no_spd) { - slen=24; - grib_set_string(outh,"packingType","grid_second_order_no_SPD",&slen); - grib_handle_delete(htmp); - } else { - grib_handle_delete(outh); - outh=htmp; - } - } else { - slen=17; - grib_set_string(outh,"packingType","grid_second_order",&slen); - grib_set_double_array(outh,"values",data_values,data_values_count); - } + grib_get_double(outh,"missingValue",&missingValue); + for (ii=0;iicontext->gribex_mode_on) { - outh->context->gribex_mode_on=0; - grib_set_double_array(outh,"values",data_values,data_values_count); - outh->context->gribex_mode_on=1; + if (value!=data_values[ii]) { + constant=0; + break; } } - } + } + } + if (!constant) { + if (editionNumber == 1 ) { + long numberOfGroups; + grib_handle* htmp=grib_handle_clone(outh); + + slen=17; + grib_set_string(htmp,"packingType","grid_second_order",&slen); + grib_get_long(htmp,"numberOfGroups",&numberOfGroups); + /* GRIBEX is not able to decode overflown numberOfGroups with SPD */ + if (numberOfGroups>65534 && outh->context->no_spd) { + slen=24; + grib_set_string(outh,"packingType","grid_second_order_no_SPD",&slen); + grib_handle_delete(htmp); + } else { + grib_handle_delete(outh); + outh=htmp; + } + } else { + slen=17; + grib_set_string(outh,"packingType","grid_second_order",&slen); + grib_set_double_array(outh,"values",data_values,data_values_count); + } + } else { + if (outh->context->gribex_mode_on) { + outh->context->gribex_mode_on=0; + grib_set_double_array(outh,"values",data_values,data_values_count); + outh->context->gribex_mode_on=1; + } + } + } if(packing_spec->editionNumber && packing_spec->editionNumber!=editionNumber) grib_set_long(outh,"edition", packing_spec->editionNumber); @@ -1234,4 +1253,3 @@ int parse_keyval_string(char* grib_tool, char* arg, int values_required, int def } return GRIB_SUCCESS; } - diff --git a/src/grib_value.c b/src/grib_value.c index e9ca46b2d..68ca10802 100644 --- a/src/grib_value.c +++ b/src/grib_value.c @@ -14,117 +14,117 @@ #include "grib_api_internal.h" GRIB_INLINE static int grib_inline_strcmp(const char* a,const char* b) { - if (*a != *b) return 1; - while((*a!=0 && *b!=0) && *(a) == *(b) ) {a++;b++;} - return (*a==0 && *b==0) ? 0 : 1; + if (*a != *b) return 1; + while((*a!=0 && *b!=0) && *(a) == *(b) ) {a++;b++;} + return (*a==0 && *b==0) ? 0 : 1; } #define SWAP(a,b) temp=(a);(a)=(b);(b)=temp; int grib_set_expression(grib_handle* h, const char* name,grib_expression* e) { - grib_accessor* a = grib_find_accessor(h, name); - int ret = GRIB_SUCCESS; + grib_accessor* a = grib_find_accessor(h, name); + int ret = GRIB_SUCCESS; - if(a){ + if(a){ - if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) - return GRIB_READ_ONLY; + if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) + return GRIB_READ_ONLY; - ret = grib_pack_expression(a, e); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } - return ret; - } - return GRIB_NOT_FOUND; + ret = grib_pack_expression(a, e); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } + return ret; + } + return GRIB_NOT_FOUND; } int grib_set_expression_internal(grib_handle* h, const char* name,grib_expression* e) { - grib_accessor* a = grib_find_accessor(h, name); + grib_accessor* a = grib_find_accessor(h, name); - int ret = GRIB_SUCCESS; - if(a){ - ret = grib_pack_expression(a, e); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } - return ret; - } - return GRIB_NOT_FOUND; + int ret = GRIB_SUCCESS; + if(a){ + ret = grib_pack_expression(a, e); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } + return ret; + } + return GRIB_NOT_FOUND; } int grib_set_long_internal(grib_handle* h, const char* name, long val) { - grib_context* c=h->context; - int ret = GRIB_SUCCESS; - grib_accessor* a =NULL; - size_t l = 1; + grib_context* c=h->context; + int ret = GRIB_SUCCESS; + grib_accessor* a =NULL; + size_t l = 1; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_long %s=%ld\n",name,(long)val); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_long %s=%ld\n",name,(long)val); - if(a){ - ret = grib_pack_long(a, &val, &l); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } + if(a){ + ret = grib_pack_long(a, &val, &l); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } - grib_context_log(c,GRIB_LOG_ERROR,"unable to set %s=%ld as long (%s)", - name,val,grib_get_error_message(ret)); - return ret; - } + grib_context_log(c,GRIB_LOG_ERROR,"unable to set %s=%ld as long (%s)", + name,val,grib_get_error_message(ret)); + return ret; + } - grib_context_log(c,GRIB_LOG_ERROR,"unable to find accessor %s",name); - return GRIB_NOT_FOUND; + grib_context_log(c,GRIB_LOG_ERROR,"unable to find accessor %s",name); + return GRIB_NOT_FOUND; } int grib_set_long(grib_handle* h, const char* name, long val) { - int ret = GRIB_SUCCESS; - grib_accessor* a =NULL; - size_t l = 1; + int ret = GRIB_SUCCESS; + grib_accessor* a =NULL; + size_t l = 1; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_long %s=%ld\n",name,(long)val); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_long %s=%ld\n",name,(long)val); - if(a){ - if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) - return GRIB_READ_ONLY; + if(a){ + if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) + return GRIB_READ_ONLY; - ret = grib_pack_long(a, &val, &l); - if(ret == GRIB_SUCCESS) - return grib_dependency_notify_change(a); - - return ret; - } - return GRIB_NOT_FOUND; + ret = grib_pack_long(a, &val, &l); + if(ret == GRIB_SUCCESS) + return grib_dependency_notify_change(a); + + return ret; + } + return GRIB_NOT_FOUND; } int grib_set_double_internal(grib_handle* h, const char* name, double val) { - int ret = GRIB_SUCCESS; - grib_accessor* a =NULL; - size_t l = 1; + int ret = GRIB_SUCCESS; + grib_accessor* a =NULL; + size_t l = 1; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_double %s=%g\n",name,val); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_double %s=%g\n",name,val); - if(a){ - ret = grib_pack_double(a, &val, &l); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } + if(a){ + ret = grib_pack_double(a, &val, &l); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=%g as double (%s)", - name,val,grib_get_error_message(ret)); - return ret; - } + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=%g as double (%s)", + name,val,grib_get_error_message(ret)); + return ret; + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); - return GRIB_NOT_FOUND; + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); + return GRIB_NOT_FOUND; } typedef struct grib_key_err grib_key_err; @@ -145,19 +145,19 @@ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src) { grib_key_err* key_err=NULL; grib_key_err* first=NULL; int todo=1,count=0; - + grib_keys_iterator* iter=NULL; if (!dest || !src) return GRIB_NULL_HANDLE; - + iter=grib_keys_iterator_new(src,0,(char*)name); - + if (!iter) { grib_context_log(src->context,GRIB_LOG_ERROR,"grib_copy_namespace: unable to get iterator for %s",name ); return GRIB_INTERNAL_ERROR; } - + while(grib_keys_iterator_next(iter)) { grib_key_err* k=grib_context_malloc_clear(src->context,sizeof(grib_key_err)); k->err=GRIB_NOT_FOUND; @@ -170,7 +170,7 @@ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src) { key_err=key_err->next; } } - + count=0; todo=1; while (todo && count<4) { @@ -184,7 +184,7 @@ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src) { key_err=key_err->next; continue; } - + if ((a=grib_find_accessor(dest,key))==NULL) { key_err->err=GRIB_NOT_FOUND; key_err=key_err->next; @@ -196,74 +196,74 @@ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src) { key_err=key_err->next; continue; } - + if ( grib_is_missing(src,key,err) && *err == 0 && (*err=grib_set_missing(dest,key))) { if ( *err!=GRIB_SUCCESS && *err!=GRIB_NOT_FOUND) return *err; key_err=key_err->next; continue; } - + if ((*err=grib_get_native_type(dest,key,&type))!=GRIB_SUCCESS) { if ( *err!=GRIB_SUCCESS && *err!=GRIB_NOT_FOUND) return *err; key_err=key_err->next; continue; } - + if((*err = grib_get_size(src,key,&len)) != GRIB_SUCCESS) return *err; switch (type) { - case GRIB_TYPE_STRING: - len=512; - sval = grib_context_malloc(src->context,len*sizeof(char)); - - if((*err = grib_get_string(src,key,sval,&len)) != GRIB_SUCCESS) - return *err; + case GRIB_TYPE_STRING: + len=512; + sval = grib_context_malloc(src->context,len*sizeof(char)); - if((*err = grib_set_string(dest,key,sval,&len)) != GRIB_SUCCESS) - return *err; + if((*err = grib_get_string(src,key,sval,&len)) != GRIB_SUCCESS) + return *err; - grib_context_free(src->context,sval); - break; + if((*err = grib_set_string(dest,key,sval,&len)) != GRIB_SUCCESS) + return *err; - case GRIB_TYPE_LONG: - lval = grib_context_malloc(src->context,len*sizeof(long)); + grib_context_free(src->context,sval); + break; - if((*err = grib_get_long_array(src,key,lval,&len)) != GRIB_SUCCESS) - return *err; + case GRIB_TYPE_LONG: + lval = grib_context_malloc(src->context,len*sizeof(long)); - if((*err = grib_set_long_array(dest,key,lval,len)) != GRIB_SUCCESS) - return *err; + if((*err = grib_get_long_array(src,key,lval,&len)) != GRIB_SUCCESS) + return *err; - grib_context_free(src->context,lval); - break; + if((*err = grib_set_long_array(dest,key,lval,len)) != GRIB_SUCCESS) + return *err; - case GRIB_TYPE_DOUBLE: - dval = grib_context_malloc(src->context,len*sizeof(double)); + grib_context_free(src->context,lval); + break; - if((*err = grib_get_double_array(src,key,dval,&len)) != GRIB_SUCCESS) - return *err; + case GRIB_TYPE_DOUBLE: + dval = grib_context_malloc(src->context,len*sizeof(double)); - if((*err = grib_set_double_array(dest,key,dval,len)) != GRIB_SUCCESS) - return *err; + if((*err = grib_get_double_array(src,key,dval,&len)) != GRIB_SUCCESS) + return *err; - break; + if((*err = grib_set_double_array(dest,key,dval,len)) != GRIB_SUCCESS) + return *err; - case GRIB_TYPE_BYTES: - if (len==0) len=512; - uval = grib_context_malloc(src->context,len*sizeof(unsigned char)); - - if((*err = grib_get_bytes(src,key,uval,&len)) != GRIB_SUCCESS) - return *err; + break; - if((*err = grib_get_bytes(dest,key,uval,&len)) != GRIB_SUCCESS) - return *err; + case GRIB_TYPE_BYTES: + if (len==0) len=512; + uval = grib_context_malloc(src->context,len*sizeof(unsigned char)); - grib_context_free(src->context,uval); + if((*err = grib_get_bytes(src,key,uval,&len)) != GRIB_SUCCESS) + return *err; - break; + if((*err = grib_get_bytes(dest,key,uval,&len)) != GRIB_SUCCESS) + return *err; - default: - break; + grib_context_free(src->context,uval); + + break; + + default: + break; } key_err=key_err->next; @@ -287,220 +287,220 @@ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src) { grib_context_free(src->context,key_err); key_err=next; } - + return *err; } int grib_set_double(grib_handle* h, const char* name, double val) { - int ret = GRIB_SUCCESS; - grib_accessor* a =NULL; - size_t l = 1; + int ret = GRIB_SUCCESS; + grib_accessor* a =NULL; + size_t l = 1; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_double %s=%g\n",name,val); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_double %s=%g\n",name,val); - if(a){ + if(a){ - if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) - return GRIB_READ_ONLY; + if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) + return GRIB_READ_ONLY; - ret = grib_pack_double(a, &val, &l); - if(ret == GRIB_SUCCESS) - return grib_dependency_notify_change(a); - - return ret; - } - return GRIB_NOT_FOUND; + ret = grib_pack_double(a, &val, &l); + if(ret == GRIB_SUCCESS) + return grib_dependency_notify_change(a); + + return ret; + } + return GRIB_NOT_FOUND; } int grib_set_string_internal(grib_handle* h, const char* name, - const char* val, size_t *length) + const char* val, size_t *length) { - int ret = GRIB_SUCCESS; - grib_accessor* a =NULL; + int ret = GRIB_SUCCESS; + grib_accessor* a =NULL; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_string %s=%s\n",name,val); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_string %s=%s\n",name,val); - if(a){ - ret = grib_pack_string(a, val, length); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } + if(a){ + ret = grib_pack_string(a, val, length); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=%s as string (%s)", - name,val,grib_get_error_message(ret)); - return ret; - } + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=%s as string (%s)", + name,val,grib_get_error_message(ret)); + return ret; + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); - return GRIB_NOT_FOUND; + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); + return GRIB_NOT_FOUND; } int grib_set_string(grib_handle* h, const char* name, const char* val, size_t *length) { - int ret=0; - grib_accessor* a; + int ret=0; + grib_accessor* a; #if 1 - /*second order doesn't have a proper representation for constant fields + /*second order doesn't have a proper representation for constant fields the best is not to do the change of packing type if bitsPerValue=0 - */ - if (!grib_inline_strcmp(name,"packingType") && !grib_inline_strcmp(val,"grid_second_order")) { - long bitsPerValue=0; - grib_get_long(h,"bitsPerValue",&bitsPerValue); - if (bitsPerValue==0) return 0; - } + */ + if (!grib_inline_strcmp(name,"packingType") && !grib_inline_strcmp(val,"grid_second_order")) { + long bitsPerValue=0; + grib_get_long(h,"bitsPerValue",&bitsPerValue); + if (bitsPerValue==0) return 0; + } #endif - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_string %s=%s\n",name,val); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_string %s=%s\n",name,val); - if(a) - { - if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) - return GRIB_READ_ONLY; + if(a) + { + if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) + return GRIB_READ_ONLY; - ret=grib_pack_string(a, val, length); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } - return ret; - } - return GRIB_NOT_FOUND; + ret=grib_pack_string(a, val, length); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } + return ret; + } + return GRIB_NOT_FOUND; } int grib_set_bytes_internal(grib_handle* h, const char* name, const unsigned char* val, size_t *length) { - int ret = GRIB_SUCCESS; - grib_accessor* a =NULL; + int ret = GRIB_SUCCESS; + grib_accessor* a =NULL; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if(a){ - ret = grib_pack_bytes(a, val, length); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } + if(a){ + ret = grib_pack_bytes(a, val, length); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=%ld as bytes (%s)", - name,val,grib_get_error_message(ret)); - return ret; - } + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=%ld as bytes (%s)", + name,val,grib_get_error_message(ret)); + return ret; + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); - return GRIB_NOT_FOUND; + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); + return GRIB_NOT_FOUND; } int grib_set_bytes(grib_handle* h, const char* name, const unsigned char* val, size_t *length) { - int ret=0; - grib_accessor* a = grib_find_accessor(h, name); + int ret=0; + grib_accessor* a = grib_find_accessor(h, name); - if(a) - { - /* if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) */ - /* return GRIB_READ_ONLY; */ + if(a) + { + /* if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) */ + /* return GRIB_READ_ONLY; */ - ret=grib_pack_bytes(a, val, length); - if(ret == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } - return ret; - } - return GRIB_NOT_FOUND; + ret=grib_pack_bytes(a, val, length); + if(ret == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } + return ret; + } + return GRIB_NOT_FOUND; } int grib_clear(grib_handle* h, const char* name) { - int ret=0; - grib_accessor* a =NULL; + int ret=0; + grib_accessor* a =NULL; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if(a) { - if (a->length ==0) return 0; - if ((ret=grib_pack_zero(a)) != GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to clear %s (%s)", - name,grib_get_error_message(ret)); - return ret; - } + if(a) { + if (a->length ==0) return 0; + if ((ret=grib_pack_zero(a)) != GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to clear %s (%s)", + name,grib_get_error_message(ret)); + return ret; + } - /*grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name);*/ - return GRIB_NOT_FOUND; + /*grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name);*/ + return GRIB_NOT_FOUND; } int grib_set_missing_internal(grib_handle* h, const char* name) { - int ret=0; - grib_accessor* a =NULL; + int ret=0; + grib_accessor* a =NULL; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if(a) { - if(a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { - ret=grib_pack_missing(a); - if(ret == GRIB_SUCCESS) - return grib_dependency_notify_change(a); - } else - ret=GRIB_VALUE_CANNOT_BE_MISSING; + if(a) { + if(a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { + ret=grib_pack_missing(a); + if(ret == GRIB_SUCCESS) + return grib_dependency_notify_change(a); + } else + ret=GRIB_VALUE_CANNOT_BE_MISSING; - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=missing (%s)", - name,grib_get_error_message(ret)); - return ret; - } + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=missing (%s)", + name,grib_get_error_message(ret)); + return ret; + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); - return GRIB_NOT_FOUND; + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); + return GRIB_NOT_FOUND; } int grib_set_missing(grib_handle* h, const char* name) { - int ret=0; - grib_accessor* a =NULL; + int ret=0; + grib_accessor* a =NULL; - a = grib_find_accessor(h, name); + a = grib_find_accessor(h, name); - if(a) { - if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) - return GRIB_READ_ONLY; + if(a) { + if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) + return GRIB_READ_ONLY; - if(a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { - ret=grib_pack_missing(a); - if(ret == GRIB_SUCCESS) - return grib_dependency_notify_change(a); - } else ret=GRIB_VALUE_CANNOT_BE_MISSING; + if(a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { + ret=grib_pack_missing(a); + if(ret == GRIB_SUCCESS) + return grib_dependency_notify_change(a); + } else ret=GRIB_VALUE_CANNOT_BE_MISSING; - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=missing (%s)", - name,grib_get_error_message(ret)); - return ret; - } + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s=missing (%s)", + name,grib_get_error_message(ret)); + return ret; + } - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); - return GRIB_NOT_FOUND; + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name); + return GRIB_NOT_FOUND; } int grib_is_missing(grib_handle* h, const char* name,int* err) { - grib_accessor* a = grib_find_accessor(h, name); - *err=GRIB_SUCCESS; + grib_accessor* a = grib_find_accessor(h, name); + *err=GRIB_SUCCESS; - if(a) { - if(a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) - return grib_is_missing_internal(a); - else - return 0; - } - else { - *err=GRIB_NOT_FOUND; - return 1; - } + if(a) { + if(a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) + return grib_is_missing_internal(a); + else + return 0; + } + else { + *err=GRIB_NOT_FOUND; + return 1; + } } /* Return true if the given key exists (is defined) in our grib message */ @@ -511,270 +511,270 @@ int grib_is_defined(grib_handle* h, const char* name) } int grib_set_flag(grib_handle *h,const char* name,unsigned long flag) { - grib_accessor* a=grib_find_accessor(h,name); + grib_accessor* a=grib_find_accessor(h,name); - if (!a) return GRIB_NOT_FOUND; + if (!a) return GRIB_NOT_FOUND; - a->flags|=flag; + a->flags|=flag; - return GRIB_SUCCESS; + return GRIB_SUCCESS; } static int _grib_set_double_array_internal(grib_handle* h,grib_accessor* a, - const double* val, size_t buffer_len,size_t *encoded_length,int check) + const double* val, size_t buffer_len,size_t *encoded_length,int check) { - if(a) { - int err = _grib_set_double_array_internal(h,a->same,val,buffer_len,encoded_length,check); + if(a) { + int err = _grib_set_double_array_internal(h,a->same,val,buffer_len,encoded_length,check); - if(check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) - return GRIB_READ_ONLY; + if(check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) + return GRIB_READ_ONLY; - if(err == GRIB_SUCCESS) - { - size_t len = buffer_len - *encoded_length; - if(len) { - err = grib_pack_double(a, val + *encoded_length, &len); - *encoded_length += len; - if(err == GRIB_SUCCESS){ - return grib_dependency_notify_change(a); - } - } - else { - grib_get_size(h,a->name,encoded_length); - err = GRIB_WRONG_ARRAY_SIZE; - } - } + if(err == GRIB_SUCCESS) + { + size_t len = buffer_len - *encoded_length; + if(len) { + err = grib_pack_double(a, val + *encoded_length, &len); + *encoded_length += len; + if(err == GRIB_SUCCESS){ + return grib_dependency_notify_change(a); + } + } + else { + grib_get_size(h,a->name,encoded_length); + err = GRIB_WRONG_ARRAY_SIZE; + } + } - return err; + return err; - } - else { - return GRIB_SUCCESS; - } + } + else { + return GRIB_SUCCESS; + } } static int _grib_set_double_array(grib_handle* h, const char* name, - const double* val, size_t length,int check) + const double* val, size_t length,int check) { - size_t encoded = 0; - grib_accessor* a = grib_find_accessor(h, name); - int err=0; + size_t encoded = 0; + grib_accessor* a = grib_find_accessor(h, name); + int err=0; - err = a ?_grib_set_double_array_internal(h,a,val,length,&encoded,check) : GRIB_NOT_FOUND ; + err = a ?_grib_set_double_array_internal(h,a,val,length,&encoded,check) : GRIB_NOT_FOUND ; - if(err == GRIB_SUCCESS && length > encoded) - err = GRIB_ARRAY_TOO_SMALL; + if(err == GRIB_SUCCESS && length > encoded) + err = GRIB_ARRAY_TOO_SMALL; - if(err == GRIB_SUCCESS) - return grib_dependency_notify_change(a); - - return err; + if(err == GRIB_SUCCESS) + return grib_dependency_notify_change(a); + + return err; } int grib_set_double_array_internal(grib_handle* h, const char* name, const double* val, size_t length) { - int ret=0; + int ret=0; - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_double_array %ld values\n",(long)length); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_double_array %ld values\n",(long)length); - if (length==0) { - grib_accessor* a = grib_find_accessor(h, name); - ret=grib_pack_double(a, val , &length); - } else { - ret=_grib_set_double_array(h,name,val,length,0); - } + if (length==0) { + grib_accessor* a = grib_find_accessor(h, name); + ret=grib_pack_double(a, val , &length); + } else { + ret=_grib_set_double_array(h,name,val,length,0); + } - if (ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set double array %s (%s)", - name,grib_get_error_message(ret)); - return ret; + if (ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set double array %s (%s)", + name,grib_get_error_message(ret)); + return ret; } int grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length) { - double v=val[0]; - int constant,i; + double v=val[0]; + int constant,i; - if (h->context->debug==-1) - printf("GRIB_API DEBUG grib_set_double_array %ld values\n",(long)length); + if (h->context->debug==-1) + printf("GRIB_API DEBUG grib_set_double_array %ld values\n",(long)length); - if (length==0) { - grib_accessor* a = grib_find_accessor(h, name); - return grib_pack_double(a, val , &length); - } + if (length==0) { + grib_accessor* a = grib_find_accessor(h, name); + return grib_pack_double(a, val , &length); + } - /*second order doesn't have a proper representation for constant fields + /*second order doesn't have a proper representation for constant fields the best is not to do the change of packing type if the field is constant - */ - if (!strcmp(name,"values") || !strcmp(name,"codedValues")) { - double missingValue; - int ret=0; + */ + if (!strcmp(name,"values") || !strcmp(name,"codedValues")) { + double missingValue; + int ret=0; - ret=grib_get_double(h,"missingValue",&missingValue); - if (ret) missingValue=9999; + ret=grib_get_double(h,"missingValue",&missingValue); + if (ret) missingValue=9999; - v=missingValue; - constant=1; - for (i=0;icontext->debug == -1) - printf("GRIB_API DEBUG grib_set_double_array forcing grid_simple\n"); - grib_set_string(h,"packingType","grid_simple",&slen); + slen=11; /*length of 'grid_simple' */ + if (h->context->debug == -1) + printf("GRIB_API DEBUG grib_set_double_array forcing grid_simple\n"); + grib_set_string(h,"packingType","grid_simple",&slen); + } } - } - } + } - return _grib_set_double_array(h,name,val,length,1); + return _grib_set_double_array(h,name,val,length,1); } static int _grib_set_long_array_internal(grib_handle* h,grib_accessor* a,const long* val, size_t buffer_len,size_t *encoded_length,int check) { - if(a) { - int err = _grib_set_long_array_internal(h,a->same,val,buffer_len,encoded_length,check); + if(a) { + int err = _grib_set_long_array_internal(h,a->same,val,buffer_len,encoded_length,check); - if(check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) - return GRIB_READ_ONLY; + if(check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) + return GRIB_READ_ONLY; - if(err == GRIB_SUCCESS) - { - size_t len = buffer_len - *encoded_length; - if(len) { - err = grib_pack_long(a, val + *encoded_length, &len); - *encoded_length += len; - } - else { - grib_get_size(h,a->name,encoded_length); - err = GRIB_WRONG_ARRAY_SIZE; - } - } + if(err == GRIB_SUCCESS) + { + size_t len = buffer_len - *encoded_length; + if(len) { + err = grib_pack_long(a, val + *encoded_length, &len); + *encoded_length += len; + } + else { + grib_get_size(h,a->name,encoded_length); + err = GRIB_WRONG_ARRAY_SIZE; + } + } - return err; + return err; - } - else { - return GRIB_SUCCESS; - } + } + else { + return GRIB_SUCCESS; + } } static int _grib_set_long_array(grib_handle* h, const char* name, const long* val, size_t length,int check) { - size_t encoded = 0; - grib_accessor* a = grib_find_accessor(h, name); - int err = a ?_grib_set_long_array_internal(h,a,val,length,&encoded,check) : GRIB_NOT_FOUND ; + size_t encoded = 0; + grib_accessor* a = grib_find_accessor(h, name); + int err = a ?_grib_set_long_array_internal(h,a,val,length,&encoded,check) : GRIB_NOT_FOUND ; - if(err == GRIB_SUCCESS && length > encoded) - err = GRIB_ARRAY_TOO_SMALL; + if(err == GRIB_SUCCESS && length > encoded) + err = GRIB_ARRAY_TOO_SMALL; - if(err == GRIB_SUCCESS) - return grib_dependency_notify_change(a); - - return err; + if(err == GRIB_SUCCESS) + return grib_dependency_notify_change(a); + + return err; } int grib_set_long_array_internal(grib_handle* h, const char* name, const long* val, size_t length) { - int ret=_grib_set_long_array(h,name,val,length,0); - if (ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set long array %s (%s)", - name,grib_get_error_message(ret)); - return ret; + int ret=_grib_set_long_array(h,name,val,length,0); + if (ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set long array %s (%s)", + name,grib_get_error_message(ret)); + return ret; } int grib_set_long_array(grib_handle* h, const char* name, const long* val, size_t length) { - return _grib_set_long_array(h,name,val,length,1); + return _grib_set_long_array(h,name,val,length,1); } int grib_get_long_internal(grib_handle* h, const char* name, long* val) { - int ret = grib_get_long(h,name,val); + int ret = grib_get_long(h,name,val); - if(ret!=GRIB_SUCCESS) { - grib_context_log(h->context,GRIB_LOG_ERROR, - "unable to get %s as long (%s)", - name, grib_get_error_message(ret)); - } + if(ret!=GRIB_SUCCESS) { + grib_context_log(h->context,GRIB_LOG_ERROR, + "unable to get %s as long (%s)", + name, grib_get_error_message(ret)); + } - return ret; + return ret; } int grib_get_long(grib_handle* h, const char* name, long* val) { - grib_accessor* act = NULL; - size_t l = 1; - int ret=0; + grib_accessor* act = NULL; + size_t l = 1; + int ret=0; - act = grib_find_accessor(h, name); + act = grib_find_accessor(h, name); - ret = act ? grib_unpack_long(act, val, &l) : GRIB_NOT_FOUND; + ret = act ? grib_unpack_long(act, val, &l) : GRIB_NOT_FOUND; - return ret; + return ret; } int grib_get_double_internal(grib_handle* h, const char* name, double* val) { - int ret = grib_get_double(h,name,val); + int ret = grib_get_double(h,name,val); - if(ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR, - "unable to get %s as double (%s)", - name, grib_get_error_message(ret)); + if(ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR, + "unable to get %s as double (%s)", + name, grib_get_error_message(ret)); - return ret; + return ret; } int grib_get_double(grib_handle* h, const char* name, double* val) { - grib_accessor* act = grib_find_accessor(h, name); - size_t l = 1; + grib_accessor* act = grib_find_accessor(h, name); + size_t l = 1; - if(act) - return grib_unpack_double(act, val, &l); + if(act) + return grib_unpack_double(act, val, &l); - return GRIB_NOT_FOUND; + return GRIB_NOT_FOUND; } int grib_get_double_element_internal(grib_handle* h, const char* name, int i,double* val) { - int ret = grib_get_double_element(h,name,i,val); + int ret = grib_get_double_element(h,name,i,val); - if(ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR, - "unable to get %s as double element (%s)", - name, grib_get_error_message(ret)); + if(ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR, + "unable to get %s as double element (%s)", + name, grib_get_error_message(ret)); - return ret; + return ret; } int grib_get_double_element(grib_handle* h, const char* name, int i, double* val) { - grib_accessor* act = grib_find_accessor(h, name); + grib_accessor* act = grib_find_accessor(h, name); - if(act) - return grib_unpack_double_element(act, i,val); + if(act) + return grib_unpack_double_element(act, i,val); - return GRIB_NOT_FOUND; + return GRIB_NOT_FOUND; } int grib_points_get_values(grib_handle* h, grib_points* points, double* val) @@ -794,566 +794,566 @@ int grib_points_get_values(grib_handle* h, grib_points* points, double* val) int grib_get_double_elements(grib_handle* h, const char* name, int* i, long len,double* val) { - double* values=0; - int ret=0; - size_t size=0; - int j=0; - grib_accessor* act =NULL; + double* values=0; + int ret=0; + size_t size=0; + int j=0; + grib_accessor* act =NULL; - act= grib_find_accessor(h, name); + act= grib_find_accessor(h, name); - ret=_grib_get_size(h,act,&size); + ret=_grib_get_size(h,act,&size); - if (ret!=GRIB_SUCCESS) { - grib_context_log(h->context,GRIB_LOG_ERROR,"grib_get_double_elements: cannot get size of %s\n",name); - return ret; - } + if (ret!=GRIB_SUCCESS) { + grib_context_log(h->context,GRIB_LOG_ERROR,"grib_get_double_elements: cannot get size of %s\n",name); + return ret; + } - values=grib_context_malloc( h->context,size * sizeof(double)); + values=grib_context_malloc( h->context,size * sizeof(double)); - if (!values) { - grib_context_log(h->context,GRIB_LOG_ERROR,"grib_get_double_elements: unable to allocate %ld bytes\n", - size*sizeof(double)); - return GRIB_OUT_OF_MEMORY; - } + if (!values) { + grib_context_log(h->context,GRIB_LOG_ERROR,"grib_get_double_elements: unable to allocate %ld bytes\n", + size*sizeof(double)); + return GRIB_OUT_OF_MEMORY; + } - ret = grib_unpack_double(act, values, &size); + ret = grib_unpack_double(act, values, &size); - for (j=0;jcontext,values); + grib_context_free(h->context,values); - return GRIB_SUCCESS; + return GRIB_SUCCESS; } int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t *length) { - int ret = grib_get_string(h,name,val,length); + int ret = grib_get_string(h,name,val,length); - if(ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR, - "unable to get %s as string (%s)", - name, grib_get_error_message(ret)); + if(ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR, + "unable to get %s as string (%s)", + name, grib_get_error_message(ret)); - return ret; + return ret; } int grib_get_string(grib_handle* h, const char* name, char* val, size_t *length) { - grib_accessor* act = grib_find_accessor(h, name); - if(act) - return grib_unpack_string(act, val, length); - return GRIB_NOT_FOUND; + grib_accessor* act = grib_find_accessor(h, name); + if(act) + return grib_unpack_string(act, val, length); + return GRIB_NOT_FOUND; } int grib_get_bytes_internal(grib_handle* h, const char* name, unsigned char* val, size_t *length) { - int ret = grib_get_bytes(h,name,val,length); + int ret = grib_get_bytes(h,name,val,length); - if(ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR, - "unable to get %s as bytes (%s)", - name, grib_get_error_message(ret)); + if(ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR, + "unable to get %s as bytes (%s)", + name, grib_get_error_message(ret)); - return ret; + return ret; } int grib_get_bytes(grib_handle* h, const char* name, unsigned char* val, size_t *length) { - int err=0; - grib_accessor* act = grib_find_accessor(h, name); - err = act? grib_unpack_bytes(act, val, length) : GRIB_NOT_FOUND; - if(err) grib_context_log(h->context,GRIB_LOG_ERROR, - "grib_get_bytes_internal %s failed %s", name, grib_get_error_message(err)); - return err; + int err=0; + grib_accessor* act = grib_find_accessor(h, name); + err = act? grib_unpack_bytes(act, val, length) : GRIB_NOT_FOUND; + if(err) grib_context_log(h->context,GRIB_LOG_ERROR, + "grib_get_bytes_internal %s failed %s", name, grib_get_error_message(err)); + return err; } int grib_get_native_type(grib_handle* h, const char* name,int* type) { - grib_accessor* act = grib_find_accessor(h, name); - *type = GRIB_TYPE_UNDEFINED; + grib_accessor* act = grib_find_accessor(h, name); + *type = GRIB_TYPE_UNDEFINED; - if(act) { - *type = grib_accessor_get_native_type(act); - return GRIB_SUCCESS; - } - return GRIB_NOT_FOUND; + if(act) { + *type = grib_accessor_get_native_type(act); + return GRIB_SUCCESS; + } + return GRIB_NOT_FOUND; } const char* grib_get_accessor_class_name(grib_handle* h, const char* name) { - grib_accessor* act = grib_find_accessor(h, name); - return act?act->cclass->name:NULL; + grib_accessor* act = grib_find_accessor(h, name); + return act?act->cclass->name:NULL; } int _grib_get_double_array_internal(grib_handle* h,grib_accessor* a,double* val, size_t buffer_len,size_t *decoded_length) { - if(a) { - int err = _grib_get_double_array_internal(h,a->same,val,buffer_len,decoded_length); + if(a) { + int err = _grib_get_double_array_internal(h,a->same,val,buffer_len,decoded_length); - if(err == GRIB_SUCCESS) - { - size_t len = buffer_len - *decoded_length; - err = grib_unpack_double(a, val + *decoded_length, &len); - *decoded_length += len; - } + if(err == GRIB_SUCCESS) + { + size_t len = buffer_len - *decoded_length; + err = grib_unpack_double(a, val + *decoded_length, &len); + *decoded_length += len; + } - return err; + return err; - } - else { - return GRIB_SUCCESS; - } + } + else { + return GRIB_SUCCESS; + } } int grib_get_double_array_internal(grib_handle* h, const char* name, double* val, size_t *length) { - int ret = grib_get_double_array(h,name,val,length); + int ret = grib_get_double_array(h,name,val,length); - if(ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR, - "unable to get %s as double array (%s)", - name, grib_get_error_message(ret)); + if(ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR, + "unable to get %s as double array (%s)", + name, grib_get_error_message(ret)); - return ret; + return ret; } int grib_get_double_array(grib_handle* h, const char* name, double* val, size_t *length) { - size_t len = *length; - grib_accessor* a = grib_find_accessor(h, name); - if(!a) return GRIB_NOT_FOUND; + size_t len = *length; + grib_accessor* a = grib_find_accessor(h, name); + if(!a) return GRIB_NOT_FOUND; - *length = 0; - return _grib_get_double_array_internal(h,a,val,len,length); + *length = 0; + return _grib_get_double_array_internal(h,a,val,len,length); } int grib_get_string_length(grib_handle* h, const char* name,size_t* size) { - grib_accessor* a = grib_find_accessor(h, name); - size_t s=0; - if(!a) return GRIB_NOT_FOUND; + grib_accessor* a = grib_find_accessor(h, name); + size_t s=0; + if(!a) return GRIB_NOT_FOUND; - *size = 0; - while(a) { - s = grib_string_length(a); - if (s > *size) *size=s; - a = a->same; - } - (*size)+=1; + *size = 0; + while(a) { + s = grib_string_length(a); + if (s > *size) *size=s; + a = a->same; + } + (*size)+=1; - return GRIB_SUCCESS; + return GRIB_SUCCESS; } int grib_get_size(grib_handle* h, const char* name,size_t* size) { - grib_accessor* a = grib_find_accessor(h, name); - if(!a) return GRIB_NOT_FOUND; + grib_accessor* a = grib_find_accessor(h, name); + if(!a) return GRIB_NOT_FOUND; - *size = 0; - while(a) { - *size += grib_value_count(a); - a = a->same; - } - return GRIB_SUCCESS; + *size = 0; + while(a) { + *size += grib_value_count(a); + a = a->same; + } + return GRIB_SUCCESS; } int grib_get_count(grib_handle* h, const char* name,size_t* size) { - grib_accessor* a = grib_find_accessor(h, name); - if(!a) return GRIB_NOT_FOUND; + grib_accessor* a = grib_find_accessor(h, name); + if(!a) return GRIB_NOT_FOUND; - *size = 0; - while(a) { - (*size)++; - a = a->same; - } - return GRIB_SUCCESS; + *size = 0; + while(a) { + (*size)++; + a = a->same; + } + return GRIB_SUCCESS; } int _grib_get_size(grib_handle* h, grib_accessor* a,size_t* size) { - if(!a) return GRIB_NOT_FOUND; + if(!a) return GRIB_NOT_FOUND; - *size = 0; - while(a) { - *size += grib_value_count(a); - a = a->same; - } - return GRIB_SUCCESS; + *size = 0; + while(a) { + *size += grib_value_count(a); + a = a->same; + } + return GRIB_SUCCESS; } int grib_get_offset(grib_handle* h, const char* key,size_t* val) { - grib_accessor* act = grib_find_accessor(h, key); - if(act) { - *val = (size_t)grib_byte_offset(act); - return GRIB_SUCCESS; - } - return GRIB_NOT_FOUND; + grib_accessor* act = grib_find_accessor(h, key); + if(act) { + *val = (size_t)grib_byte_offset(act); + return GRIB_SUCCESS; + } + return GRIB_NOT_FOUND; } int _grib_get_long_array_internal(grib_handle* h,grib_accessor* a,long* val, size_t buffer_len,size_t *decoded_length) { - if(a) { - int err = _grib_get_long_array_internal(h,a->same,val,buffer_len,decoded_length); + if(a) { + int err = _grib_get_long_array_internal(h,a->same,val,buffer_len,decoded_length); - if(err == GRIB_SUCCESS) - { - size_t len = buffer_len - *decoded_length; - err = grib_unpack_long(a, val + *decoded_length, &len); - *decoded_length += len; - } + if(err == GRIB_SUCCESS) + { + size_t len = buffer_len - *decoded_length; + err = grib_unpack_long(a, val + *decoded_length, &len); + *decoded_length += len; + } - return err; + return err; - } else { - return GRIB_SUCCESS; - } + } else { + return GRIB_SUCCESS; + } } int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, size_t *length) { - int ret = grib_get_long_array(h,name,val,length); + int ret = grib_get_long_array(h,name,val,length); - if(ret!=GRIB_SUCCESS) - grib_context_log(h->context,GRIB_LOG_ERROR, - "unable to get %s as long array (%s)", - name, grib_get_error_message(ret)); + if(ret!=GRIB_SUCCESS) + grib_context_log(h->context,GRIB_LOG_ERROR, + "unable to get %s as long array (%s)", + name, grib_get_error_message(ret)); - return ret; + return ret; } int grib_get_long_array(grib_handle* h, const char* name, long* val, size_t *length) { - size_t len = *length; - grib_accessor* a = grib_find_accessor(h, name); - if(!a) return GRIB_NOT_FOUND; + size_t len = *length; + grib_accessor* a = grib_find_accessor(h, name); + if(!a) return GRIB_NOT_FOUND; - *length = 0; - return _grib_get_long_array_internal(h,a,val,len,length); + *length = 0; + return _grib_get_long_array_internal(h,a,val,len,length); } static void grib_clean_key_value(grib_context* c,grib_key_value_list* kv) { - if (kv->long_value) grib_context_free(c,kv->long_value); - kv->long_value=NULL; - if (kv->double_value) grib_context_free(c,kv->double_value); - kv->double_value=NULL; - if (kv->string_value) grib_context_free(c,kv->string_value); - kv->string_value=NULL; - if (kv->namespace_value) grib_key_value_list_delete(c,kv->namespace_value); - kv->namespace_value=NULL; - kv->error=0; - kv->has_value=0; - kv->size=0; + if (kv->long_value) grib_context_free(c,kv->long_value); + kv->long_value=NULL; + if (kv->double_value) grib_context_free(c,kv->double_value); + kv->double_value=NULL; + if (kv->string_value) grib_context_free(c,kv->string_value); + kv->string_value=NULL; + if (kv->namespace_value) grib_key_value_list_delete(c,kv->namespace_value); + kv->namespace_value=NULL; + kv->error=0; + kv->has_value=0; + kv->size=0; } static int grib_get_key_value(grib_handle* h,grib_key_value_list* kv) { - int ret=0; - size_t size=0; - grib_keys_iterator* iter=NULL; - grib_key_value_list* list=NULL; + int ret=0; + size_t size=0; + grib_keys_iterator* iter=NULL; + grib_key_value_list* list=NULL; - if (kv->has_value) grib_clean_key_value(h->context,kv); - - ret=grib_get_size(h,kv->name,&size); - if (ret) { - kv->error=ret; - return ret; - } - if (size==0) size=512; - - switch (kv->type) { - case GRIB_TYPE_LONG: - kv->long_value=grib_context_malloc_clear(h->context,size*sizeof(long)); - ret=grib_get_long_array(h,kv->name,kv->long_value,&size); - kv->error=ret; - break; - case GRIB_TYPE_DOUBLE: - kv->double_value=grib_context_malloc_clear(h->context,size*sizeof(double)); - ret=grib_get_double_array(h,kv->name,kv->double_value,&size); - kv->error=ret; - break; - case GRIB_TYPE_STRING: - grib_get_string_length(h,kv->name,&size); - kv->string_value=grib_context_malloc_clear(h->context,size*sizeof(char)); - ret=grib_get_string(h,kv->name,kv->string_value,&size); - kv->error=ret; - break; - case GRIB_TYPE_BYTES: - kv->string_value=grib_context_malloc_clear(h->context,size*sizeof(char)); - ret=grib_get_bytes(h,kv->name,(unsigned char*)kv->string_value,&size); - kv->error=ret; - break; - case GRIB_NAMESPACE: - iter=grib_keys_iterator_new(h,0,(char*)kv->name); - list=grib_context_malloc_clear(h->context,sizeof(grib_key_value_list)); - kv->namespace_value=list; - while(grib_keys_iterator_next(iter)) - { - list->name=grib_keys_iterator_get_name(iter); - ret=grib_get_native_type(h,list->name,&(list->type)); - ret=grib_get_key_value(h,list); - list->next=grib_context_malloc_clear(h->context,sizeof(grib_key_value_list)); - list=list->next; - } - grib_keys_iterator_delete(iter); - break; + if (kv->has_value) grib_clean_key_value(h->context,kv); - default: - ret=grib_get_native_type(h,kv->name,&(kv->type)); - ret=grib_get_key_value(h,kv); - break; - } - kv->has_value=1; - return ret; + ret=grib_get_size(h,kv->name,&size); + if (ret) { + kv->error=ret; + return ret; + } + if (size==0) size=512; + + switch (kv->type) { + case GRIB_TYPE_LONG: + kv->long_value=grib_context_malloc_clear(h->context,size*sizeof(long)); + ret=grib_get_long_array(h,kv->name,kv->long_value,&size); + kv->error=ret; + break; + case GRIB_TYPE_DOUBLE: + kv->double_value=grib_context_malloc_clear(h->context,size*sizeof(double)); + ret=grib_get_double_array(h,kv->name,kv->double_value,&size); + kv->error=ret; + break; + case GRIB_TYPE_STRING: + grib_get_string_length(h,kv->name,&size); + kv->string_value=grib_context_malloc_clear(h->context,size*sizeof(char)); + ret=grib_get_string(h,kv->name,kv->string_value,&size); + kv->error=ret; + break; + case GRIB_TYPE_BYTES: + kv->string_value=grib_context_malloc_clear(h->context,size*sizeof(char)); + ret=grib_get_bytes(h,kv->name,(unsigned char*)kv->string_value,&size); + kv->error=ret; + break; + case GRIB_NAMESPACE: + iter=grib_keys_iterator_new(h,0,(char*)kv->name); + list=grib_context_malloc_clear(h->context,sizeof(grib_key_value_list)); + kv->namespace_value=list; + while(grib_keys_iterator_next(iter)) + { + list->name=grib_keys_iterator_get_name(iter); + ret=grib_get_native_type(h,list->name,&(list->type)); + ret=grib_get_key_value(h,list); + list->next=grib_context_malloc_clear(h->context,sizeof(grib_key_value_list)); + list=list->next; + } + grib_keys_iterator_delete(iter); + break; + + default: + ret=grib_get_native_type(h,kv->name,&(kv->type)); + ret=grib_get_key_value(h,kv); + break; + } + kv->has_value=1; + return ret; } grib_key_value_list* grib_key_value_list_clone(grib_context* c,grib_key_value_list* list) { - grib_key_value_list* next=list; - grib_key_value_list* clone=grib_context_malloc_clear(c,sizeof(grib_key_value_list)); - grib_key_value_list* p=clone; + grib_key_value_list* next=list; + grib_key_value_list* clone=grib_context_malloc_clear(c,sizeof(grib_key_value_list)); + grib_key_value_list* p=clone; - while (next && next->name) { - p->name=grib_context_strdup(c,next->name); - p->type=next->type; - next=next->next; - } - return clone; + while (next && next->name) { + p->name=grib_context_strdup(c,next->name); + p->type=next->type; + next=next->next; + } + return clone; } void grib_key_value_list_delete(grib_context* c,grib_key_value_list* kvl) { - grib_key_value_list* next=kvl; - grib_key_value_list* p=NULL; - while (next) { - p=next->next; - if (next->type == GRIB_NAMESPACE) - grib_key_value_list_delete(c,next->namespace_value); - - grib_clean_key_value(c,next); - grib_context_free(c,next); - next=p; - } + grib_key_value_list* next=kvl; + grib_key_value_list* p=NULL; + while (next) { + p=next->next; + if (next->type == GRIB_NAMESPACE) + grib_key_value_list_delete(c,next->namespace_value); + + grib_clean_key_value(c,next); + grib_context_free(c,next); + next=p; + } } int grib_get_key_value_list(grib_handle* h,grib_key_value_list* list) { - int ret=0; - grib_key_value_list* kvl=list; - while (kvl) { - ret=grib_get_key_value(h,kvl); - kvl=kvl->next; - } - return ret; + int ret=0; + grib_key_value_list* kvl=list; + while (kvl) { + ret=grib_get_key_value(h,kvl); + kvl=kvl->next; + } + return ret; } int grib_get_values(grib_handle* h,grib_values* args,size_t count) { - int ret=0; - int i=0; + int ret=0; + int i=0; - for (i=0; ivalues_stack++; + int i, error=0; + int err=0; + size_t len; + int more = 1; + int stack = h->values_stack++; - Assert(h->values_stack < MAX_SET_VALUES - 1); + Assert(h->values_stack < MAX_SET_VALUES - 1); - h->values[stack] = args; - h->values_count[stack] = count; + h->values[stack] = args; + h->values_count[stack] = count; - for(i = 0; i < count ; i++) - args[i].error = GRIB_NOT_FOUND; + for(i = 0; i < count ; i++) + args[i].error = GRIB_NOT_FOUND; - while(more) - { - more = 0; - for(i = 0; i < count ; i++) - { - if(args[i].error != GRIB_NOT_FOUND) - continue; + while(more) + { + more = 0; + for(i = 0; i < count ; i++) + { + if(args[i].error != GRIB_NOT_FOUND) + continue; - switch(args[i].type) - { - case GRIB_TYPE_LONG: - error = grib_set_long(h,args[i].name,args[i].long_value); - args[i].error=error; - if(args[i].error == GRIB_SUCCESS) more = 1; - break; + switch(args[i].type) + { + case GRIB_TYPE_LONG: + error = grib_set_long(h,args[i].name,args[i].long_value); + args[i].error=error; + if(args[i].error == GRIB_SUCCESS) more = 1; + break; - case GRIB_TYPE_DOUBLE: - args[i].error = grib_set_double(h,args[i].name,args[i].double_value); - if(args[i].error == GRIB_SUCCESS) more = 1; - break; + case GRIB_TYPE_DOUBLE: + args[i].error = grib_set_double(h,args[i].name,args[i].double_value); + if(args[i].error == GRIB_SUCCESS) more = 1; + break; - case GRIB_TYPE_STRING: - len = strlen(args[i].string_value); - args[i].error = grib_set_string(h,args[i].name,args[i].string_value,&len); - if(args[i].error == GRIB_SUCCESS) more = 1; - break; + case GRIB_TYPE_STRING: + len = strlen(args[i].string_value); + args[i].error = grib_set_string(h,args[i].name,args[i].string_value,&len); + if(args[i].error == GRIB_SUCCESS) more = 1; + break; - case GRIB_TYPE_MISSING: - args[i].error = grib_set_missing(h,args[i].name); - if(args[i].error == GRIB_SUCCESS) more = 1; - break; + case GRIB_TYPE_MISSING: + args[i].error = grib_set_missing(h,args[i].name); + if(args[i].error == GRIB_SUCCESS) more = 1; + break; - default: - grib_context_log(h->context,GRIB_LOG_ERROR, "grib_set_values[%d] %s invalid type %d", i, args[i].name, args[i].type); - args[i].error = GRIB_INVALID_ARGUMENT; - break; - } - /*if (args[i].error != GRIB_SUCCESS) + default: + grib_context_log(h->context,GRIB_LOG_ERROR, "grib_set_values[%d] %s invalid type %d", i, args[i].name, args[i].type); + args[i].error = GRIB_INVALID_ARGUMENT; + break; + } + /*if (args[i].error != GRIB_SUCCESS) grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s (%s)", args[i].name,grib_get_error_message(args[i].error)); */ - } - } + } + } - h->values[stack] = NULL; - h->values_count[stack] = 0; + h->values[stack] = NULL; + h->values_count[stack] = 0; - h->values_stack--; + h->values_stack--; - for(i = 0; i < count ; i++) { - if(args[i].error != GRIB_SUCCESS) - { - grib_context_log(h->context,GRIB_LOG_ERROR, - "grib_set_values[%d] %s (%d) failed: %s", i, args[i].name, args[i].type, - grib_get_error_message(args[i].error)); - err= err==GRIB_SUCCESS ? args[i].error : err; - } - } + for(i = 0; i < count ; i++) { + if(args[i].error != GRIB_SUCCESS) + { + grib_context_log(h->context,GRIB_LOG_ERROR, + "grib_set_values[%d] %s (%d) failed: %s", i, args[i].name, args[i].type, + grib_get_error_message(args[i].error)); + err= err==GRIB_SUCCESS ? args[i].error : err; + } + } - return err; + return err; } int grib_get_nearest_smaller_value(grib_handle* h, const char* name, - double val,double* nearest) + double val,double* nearest) { - grib_accessor* act = grib_find_accessor(h, name); - Assert(act); - return grib_nearest_smaller_value(act,val,nearest); + grib_accessor* act = grib_find_accessor(h, name); + Assert(act); + return grib_nearest_smaller_value(act,val,nearest); } void grib_print_values(grib_values* values,int count) { - int i; - for(i = 0; i < count ; i++) - { - printf("%s = ",values[i].name); - switch(values[i].type) - { - case GRIB_TYPE_LONG: printf("%ld",values[i].long_value); break; - case GRIB_TYPE_DOUBLE: printf("%g",values[i].double_value); break; - case GRIB_TYPE_STRING: printf("%s",values[i].string_value); break; - } - printf("\n"); - } + int i; + for(i = 0; i < count ; i++) + { + printf("%s = ",values[i].name); + switch(values[i].type) + { + case GRIB_TYPE_LONG: printf("%ld",values[i].long_value); break; + case GRIB_TYPE_DOUBLE: printf("%g",values[i].double_value); break; + case GRIB_TYPE_STRING: printf("%s",values[i].string_value); break; + } + printf("\n"); + } } int grib_values_check(grib_handle* h, grib_values* values, int count) { - int i=0; - long long_value; - double double_value; - unsigned char ubuff[1024]={0,}; - char buff[1024]={0,}; - size_t len=1024; + int i=0; + long long_value; + double double_value; + unsigned char ubuff[1024]={0,}; + char buff[1024]={0,}; + size_t len=1024; - for (i=0; inext = (grib_yyvsp[(2) - (2)].act); (grib_yyval.act) = (grib_yyvsp[(1) - (2)].act); } break; case 14: /* Line 1455 of yacc.c */ -#line 222 "griby.y" +#line 224 "griby.y" { (grib_yyvsp[(1) - (3)].act)->next = (grib_yyvsp[(3) - (3)].act); (grib_yyval.act) = (grib_yyvsp[(1) - (3)].act); } break; case 15: /* Line 1455 of yacc.c */ -#line 223 "griby.y" +#line 225 "griby.y" { (grib_yyval.act) = (grib_yyvsp[(1) - (2)].act);} break; case 26: /* Line 1455 of yacc.c */ -#line 241 "griby.y" +#line 243 "griby.y" { (grib_yyval.explist) = 0; } break; case 29: /* Line 1455 of yacc.c */ -#line 246 "griby.y" +#line 248 "griby.y" { (grib_yyvsp[(1) - (3)].explist)->next = (grib_yyvsp[(3) - (3)].explist); (grib_yyval.explist) = (grib_yyvsp[(1) - (3)].explist); } break; case 30: /* Line 1455 of yacc.c */ -#line 249 "griby.y" +#line 251 "griby.y" { (grib_yyval.explist) = grib_arguments_new(grib_parser_context,(grib_yyvsp[(1) - (1)].exp),NULL); } break; case 31: /* Line 1455 of yacc.c */ -#line 254 "griby.y" +#line 256 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"unsigned",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 32: /* Line 1455 of yacc.c */ -#line 257 "griby.y" +#line 259 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"unsigned",(grib_yyvsp[(3) - (10)].lval),(grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL); free((grib_yyvsp[(5) - (10)].str)); } break; case 33: /* Line 1455 of yacc.c */ -#line 260 "griby.y" +#line 262 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"unsigned_bits",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 34: /* Line 1455 of yacc.c */ -#line 263 "griby.y" +#line 265 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"unsigned_bits",(grib_yyvsp[(3) - (10)].lval),(grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL); free((grib_yyvsp[(5) - (10)].str)); } break; case 35: /* Line 1455 of yacc.c */ -#line 266 "griby.y" +#line 268 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"ascii",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 36: /* Line 1455 of yacc.c */ -#line 270 "griby.y" +#line 272 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"ascii",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 37: /* Line 1455 of yacc.c */ -#line 273 "griby.y" +#line 275 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"bytes",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 38: /* Line 1455 of yacc.c */ -#line 276 "griby.y" +#line 278 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"bytes",(grib_yyvsp[(3) - (10)].lval),(grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL); free((grib_yyvsp[(5) - (10)].str)); } break; case 39: /* Line 1455 of yacc.c */ -#line 279 "griby.y" +#line 281 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"ksec1expver",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 40: /* Line 1455 of yacc.c */ -#line 282 "griby.y" +#line 284 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"signed",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 41: /* Line 1455 of yacc.c */ -#line 285 "griby.y" +#line 287 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"signed",(grib_yyvsp[(3) - (10)].lval),(grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL); free((grib_yyvsp[(5) - (10)].str)); } break; case 42: /* Line 1455 of yacc.c */ -#line 288 "griby.y" +#line 290 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (7)].str),"signed_bits",(grib_yyvsp[(3) - (7)].lval),NULL,(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(5) - (7)].str)); } break; case 43: /* Line 1455 of yacc.c */ -#line 291 "griby.y" +#line 293 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"signed_bits",(grib_yyvsp[(3) - (10)].lval),(grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL); free((grib_yyvsp[(5) - (10)].str)); } break; case 44: /* Line 1455 of yacc.c */ -#line 294 "griby.y" +#line 296 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"codetable",(grib_yyvsp[(3) - (8)].lval), (grib_yyvsp[(6) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL); free((grib_yyvsp[(5) - (8)].str)); } break; case 45: /* Line 1455 of yacc.c */ -#line 297 "griby.y" +#line 299 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (12)].str),"codetable",(grib_yyvsp[(3) - (12)].lval), (grib_yyvsp[(6) - (12)].explist),(grib_yyvsp[(7) - (12)].explist),(grib_yyvsp[(12) - (12)].lval),NULL,(grib_yyvsp[(10) - (12)].str)); free((grib_yyvsp[(5) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); } break; @@ -2441,231 +2441,231 @@ grib_yyreduce: case 46: /* Line 1455 of yacc.c */ -#line 301 "griby.y" +#line 303 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"codetable",(grib_yyvsp[(3) - (10)].lval), (grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL); free((grib_yyvsp[(5) - (10)].str)); } break; case 47: /* Line 1455 of yacc.c */ -#line 304 "griby.y" +#line 306 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"complex_codetable",(grib_yyvsp[(3) - (8)].lval), (grib_yyvsp[(6) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL); free((grib_yyvsp[(5) - (8)].str)); } break; case 48: /* Line 1455 of yacc.c */ -#line 307 "griby.y" +#line 309 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"complex_codetable",(grib_yyvsp[(3) - (10)].lval), (grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL); free((grib_yyvsp[(5) - (10)].str)); } break; case 49: /* Line 1455 of yacc.c */ -#line 310 "griby.y" +#line 312 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"codeflag",(grib_yyvsp[(3) - (8)].lval), (grib_yyvsp[(6) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL); free((grib_yyvsp[(5) - (8)].str)); } break; case 50: /* Line 1455 of yacc.c */ -#line 313 "griby.y" +#line 315 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (9)].str),"lookup",(grib_yyvsp[(3) - (9)].lval),(grib_yyvsp[(7) - (9)].explist),NULL,(grib_yyvsp[(9) - (9)].lval),NULL,NULL); free((grib_yyvsp[(5) - (9)].str)); } break; case 51: /* Line 1455 of yacc.c */ -#line 316 "griby.y" +#line 318 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"bit",0,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(2) - (7)].str)); } break; case 52: /* Line 1455 of yacc.c */ -#line 319 "griby.y" +#line 321 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"label",0,NULL,NULL,0,NULL,NULL); free((grib_yyvsp[(2) - (2)].str)); } break; case 53: /* Line 1455 of yacc.c */ -#line 322 "griby.y" +#line 324 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"label",0,NULL,NULL,0,NULL,NULL); free((grib_yyvsp[(2) - (2)].str)); } break; case 54: /* Line 1455 of yacc.c */ -#line 325 "griby.y" +#line 327 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"ibmfloat",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str)); } break; case 55: /* Line 1455 of yacc.c */ -#line 328 "griby.y" +#line 330 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(4) - (6)].str),"ibmfloat",4,NULL,(grib_yyvsp[(5) - (6)].explist),(grib_yyvsp[(6) - (6)].lval),(grib_yyvsp[(2) - (6)].str),NULL);free((grib_yyvsp[(4) - (6)].str)); free((grib_yyvsp[(2) - (6)].str)); } break; case 56: /* Line 1455 of yacc.c */ -#line 331 "griby.y" +#line 333 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"ibmfloat",4,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);free((grib_yyvsp[(2) - (7)].str)); } break; case 57: /* Line 1455 of yacc.c */ -#line 334 "griby.y" +#line 336 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"position",0,NULL,NULL,0,NULL,NULL); free((grib_yyvsp[(2) - (2)].str)); } break; case 58: /* Line 1455 of yacc.c */ -#line 337 "griby.y" +#line 339 "griby.y" { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"constant",0,(grib_yyvsp[(4) - (5)].explist),NULL,(grib_yyvsp[(5) - (5)].lval),NULL);free((grib_yyvsp[(2) - (5)].str)); } break; case 59: /* Line 1455 of yacc.c */ -#line 340 "griby.y" +#line 342 "griby.y" { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"transient",0,(grib_yyvsp[(4) - (5)].explist),(grib_yyvsp[(4) - (5)].explist),(grib_yyvsp[(5) - (5)].lval),NULL); free((grib_yyvsp[(2) - (5)].str)); } break; case 60: /* Line 1455 of yacc.c */ -#line 343 "griby.y" +#line 345 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"ieeefloat",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL); free((grib_yyvsp[(2) - (4)].str)); } break; case 61: /* Line 1455 of yacc.c */ -#line 346 "griby.y" +#line 348 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(4) - (6)].str),"ieeefloat",4,NULL,(grib_yyvsp[(5) - (6)].explist),(grib_yyvsp[(6) - (6)].lval),(grib_yyvsp[(2) - (6)].str),NULL); free((grib_yyvsp[(4) - (6)].str));free((grib_yyvsp[(2) - (6)].str));} break; case 62: /* Line 1455 of yacc.c */ -#line 349 "griby.y" +#line 351 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"ieeefloat",4,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);free((grib_yyvsp[(2) - (7)].str)); } break; case 63: /* Line 1455 of yacc.c */ -#line 352 "griby.y" +#line 354 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"g1_half_byte_codeflag",0,NULL,NULL,0,NULL,NULL);free((grib_yyvsp[(2) - (2)].str)); } break; case 64: /* Line 1455 of yacc.c */ -#line 355 "griby.y" +#line 357 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (5)].str),"section_length",(grib_yyvsp[(3) - (5)].lval),NULL,NULL,0,NULL,NULL);free((grib_yyvsp[(5) - (5)].str)); } break; case 65: /* Line 1455 of yacc.c */ -#line 358 "griby.y" +#line 360 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"g1_message_length",(grib_yyvsp[(3) - (8)].lval),(grib_yyvsp[(7) - (8)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(5) - (8)].str)); } break; case 66: /* Line 1455 of yacc.c */ -#line 361 "griby.y" +#line 363 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"g1_section4_length",(grib_yyvsp[(3) - (8)].lval),(grib_yyvsp[(7) - (8)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(5) - (8)].str)); } break; case 67: /* Line 1455 of yacc.c */ -#line 364 "griby.y" +#line 366 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"ksec",0,(grib_yyvsp[(3) - (3)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(2) - (3)].str)); } break; case 68: /* Line 1455 of yacc.c */ -#line 367 "griby.y" +#line 369 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"pad",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL); free((grib_yyvsp[(2) - (5)].str)); } break; case 69: /* Line 1455 of yacc.c */ -#line 370 "griby.y" +#line 372 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padto",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL); free((grib_yyvsp[(2) - (5)].str)); } break; case 70: /* Line 1455 of yacc.c */ -#line 373 "griby.y" +#line 375 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padtoeven",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL); free((grib_yyvsp[(2) - (5)].str)); } break; case 71: /* Line 1455 of yacc.c */ -#line 376 "griby.y" +#line 378 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padtomultiple",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL); free((grib_yyvsp[(2) - (5)].str)); } break; case 72: /* Line 1455 of yacc.c */ -#line 379 "griby.y" +#line 381 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (6)].str),"message",(grib_yyvsp[(3) - (6)].lval),0,0,(grib_yyvsp[(6) - (6)].lval),NULL,NULL); free((grib_yyvsp[(5) - (6)].str)); } break; case 73: /* Line 1455 of yacc.c */ -#line 382 "griby.y" +#line 384 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"section_padding",0,0,0,(grib_yyvsp[(3) - (3)].lval),NULL,NULL); free((grib_yyvsp[(2) - (3)].str)); } break; case 74: /* Line 1455 of yacc.c */ -#line 384 "griby.y" +#line 386 "griby.y" { (grib_yyval.act) = grib_action_create_template(grib_parser_context,0,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].str)); free((grib_yyvsp[(2) - (3)].str)); free((grib_yyvsp[(3) - (3)].str));} break; case 75: /* Line 1455 of yacc.c */ -#line 386 "griby.y" +#line 388 "griby.y" { (grib_yyval.act) = grib_action_create_template(grib_parser_context,1,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].str)); free((grib_yyvsp[(2) - (3)].str)); free((grib_yyvsp[(3) - (3)].str));} break; case 76: /* Line 1455 of yacc.c */ -#line 389 "griby.y" +#line 391 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(2) - (5)].str),(grib_yyvsp[(4) - (5)].str),NULL,(grib_yyvsp[(5) - (5)].lval)); free((grib_yyvsp[(2) - (5)].str)); free((grib_yyvsp[(4) - (5)].str)); } break; case 77: /* Line 1455 of yacc.c */ -#line 392 "griby.y" +#line 394 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(2) - (2)].str),NULL,NULL,0); free((grib_yyvsp[(2) - (2)].str)); } break; case 78: /* Line 1455 of yacc.c */ -#line 395 "griby.y" +#line 397 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(4) - (7)].str),(grib_yyvsp[(6) - (7)].str),(grib_yyvsp[(2) - (7)].str),(grib_yyvsp[(7) - (7)].lval)); free((grib_yyvsp[(2) - (7)].str)); free((grib_yyvsp[(4) - (7)].str)); free((grib_yyvsp[(6) - (7)].str)); } @@ -2674,7 +2674,7 @@ grib_yyreduce: case 79: /* Line 1455 of yacc.c */ -#line 399 "griby.y" +#line 401 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(4) - (4)].str),NULL,(grib_yyvsp[(2) - (4)].str),0); free((grib_yyvsp[(2) - (4)].str)); free((grib_yyvsp[(4) - (4)].str)); } @@ -2683,21 +2683,21 @@ grib_yyreduce: case 80: /* Line 1455 of yacc.c */ -#line 403 "griby.y" +#line 405 "griby.y" { (grib_yyval.act) = grib_action_create_meta(grib_parser_context,(grib_yyvsp[(2) - (8)].str),(grib_yyvsp[(3) - (8)].str),(grib_yyvsp[(5) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL); free((grib_yyvsp[(2) - (8)].str));free((grib_yyvsp[(3) - (8)].str));} break; case 81: /* Line 1455 of yacc.c */ -#line 406 "griby.y" +#line 408 "griby.y" { (grib_yyval.act) = grib_action_create_meta(grib_parser_context,(grib_yyvsp[(4) - (10)].str),(grib_yyvsp[(5) - (10)].str),(grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),(grib_yyvsp[(2) - (10)].str)); free((grib_yyvsp[(4) - (10)].str));free((grib_yyvsp[(5) - (10)].str));free((grib_yyvsp[(2) - (10)].str));} break; case 82: /* Line 1455 of yacc.c */ -#line 409 "griby.y" +#line 411 "griby.y" { grib_arguments* a = grib_arguments_new( grib_parser_context, @@ -2714,7 +2714,7 @@ grib_yyreduce: case 83: /* Line 1455 of yacc.c */ -#line 421 "griby.y" +#line 423 "griby.y" { grib_arguments* a = grib_arguments_new( grib_parser_context, @@ -2731,7 +2731,7 @@ grib_yyreduce: case 84: /* Line 1455 of yacc.c */ -#line 433 "griby.y" +#line 435 "griby.y" { grib_arguments* a = grib_arguments_new( grib_parser_context, @@ -2748,541 +2748,541 @@ grib_yyreduce: case 85: /* Line 1455 of yacc.c */ -#line 445 "griby.y" +#line 447 "griby.y" { (grib_yyval.act) = grib_action_create_put(grib_parser_context,(grib_yyvsp[(2) - (5)].str),(grib_yyvsp[(4) - (5)].explist));free((grib_yyvsp[(2) - (5)].str));} break; case 86: /* Line 1455 of yacc.c */ -#line 448 "griby.y" +#line 450 "griby.y" { (grib_yyval.act) = grib_action_create_remove(grib_parser_context,(grib_yyvsp[(2) - (2)].explist));} break; case 87: /* Line 1455 of yacc.c */ -#line 451 "griby.y" +#line 453 "griby.y" { (grib_yyval.act) = grib_action_create_assert(grib_parser_context,(grib_yyvsp[(3) - (4)].exp));} break; case 88: /* Line 1455 of yacc.c */ -#line 454 "griby.y" +#line 456 "griby.y" { (grib_yyval.act) = grib_action_create_modify(grib_parser_context,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].lval)); free((grib_yyvsp[(2) - (3)].str));} break; case 89: /* Line 1455 of yacc.c */ -#line 456 "griby.y" +#line 458 "griby.y" { (grib_yyval.act) = grib_action_create_set_missing(grib_parser_context,(grib_yyvsp[(2) - (4)].str)); free((grib_yyvsp[(2) - (4)].str)); } break; case 90: /* Line 1455 of yacc.c */ -#line 457 "griby.y" +#line 459 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),0); free((grib_yyvsp[(2) - (4)].str)); } break; case 91: /* Line 1455 of yacc.c */ -#line 458 "griby.y" +#line 460 "griby.y" { (grib_yyval.act) = grib_action_create_set_darray(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(5) - (6)].dvalue)); free((grib_yyvsp[(2) - (6)].str)); } break; case 92: /* Line 1455 of yacc.c */ -#line 460 "griby.y" +#line 462 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),1); free((grib_yyvsp[(2) - (4)].str)); } break; case 93: /* Line 1455 of yacc.c */ -#line 463 "griby.y" +#line 465 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(2) - (2)].str),0,0); free((grib_yyvsp[(2) - (2)].str));} break; case 94: /* Line 1455 of yacc.c */ -#line 464 "griby.y" +#line 466 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",0,0); } break; case 95: /* Line 1455 of yacc.c */ -#line 465 "griby.y" +#line 467 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(5) - (5)].str),0,(grib_yyvsp[(3) - (5)].lval)); free((grib_yyvsp[(5) - (5)].str));} break; case 96: /* Line 1455 of yacc.c */ -#line 466 "griby.y" +#line 468 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",0,(grib_yyvsp[(3) - (4)].lval)); } break; case 97: /* Line 1455 of yacc.c */ -#line 467 "griby.y" +#line 469 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(2) - (2)].str),1,0); free((grib_yyvsp[(2) - (2)].str));} break; case 98: /* Line 1455 of yacc.c */ -#line 468 "griby.y" +#line 470 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",1,0); } break; case 99: /* Line 1455 of yacc.c */ -#line 469 "griby.y" +#line 471 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(5) - (5)].str),1,(grib_yyvsp[(3) - (5)].lval)); free((grib_yyvsp[(5) - (5)].str));} break; case 100: /* Line 1455 of yacc.c */ -#line 470 "griby.y" +#line 472 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",1,(grib_yyvsp[(3) - (4)].lval)); } break; case 101: /* Line 1455 of yacc.c */ -#line 472 "griby.y" +#line 474 "griby.y" { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[(2) - (2)].str),0); free((grib_yyvsp[(2) - (2)].str)); } break; case 102: /* Line 1455 of yacc.c */ -#line 473 "griby.y" +#line 475 "griby.y" { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[(5) - (5)].str),(grib_yyvsp[(3) - (5)].str)); free((grib_yyvsp[(5) - (5)].str)); free((grib_yyvsp[(3) - (5)].str));} break; case 103: /* Line 1455 of yacc.c */ -#line 474 "griby.y" +#line 476 "griby.y" { (grib_yyval.act) = grib_action_create_print(grib_parser_context,"",0); } break; case 104: /* Line 1455 of yacc.c */ -#line 478 "griby.y" +#line 480 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act),0,0); } break; case 105: /* Line 1455 of yacc.c */ -#line 479 "griby.y" +#line 481 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (11)].exp),(grib_yyvsp[(6) - (11)].act),(grib_yyvsp[(10) - (11)].act),0); } break; case 106: /* Line 1455 of yacc.c */ -#line 480 "griby.y" +#line 482 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act),0,1); } break; case 107: /* Line 1455 of yacc.c */ -#line 481 "griby.y" +#line 483 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (11)].exp),(grib_yyvsp[(6) - (11)].act),(grib_yyvsp[(10) - (11)].act),1); } break; case 108: /* Line 1455 of yacc.c */ -#line 485 "griby.y" +#line 487 "griby.y" { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[(3) - (6)].exp),(grib_yyvsp[(5) - (6)].act),NULL); } break; case 109: /* Line 1455 of yacc.c */ -#line 486 "griby.y" +#line 488 "griby.y" { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act),NULL); } break; case 110: /* Line 1455 of yacc.c */ -#line 487 "griby.y" +#line 489 "griby.y" { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[(3) - (11)].exp),(grib_yyvsp[(6) - (11)].act),(grib_yyvsp[(10) - (11)].act)); } break; case 111: /* Line 1455 of yacc.c */ -#line 490 "griby.y" +#line 492 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),0); free((grib_yyvsp[(2) - (4)].str)); } break; case 112: /* Line 1455 of yacc.c */ -#line 491 "griby.y" +#line 493 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),1); free((grib_yyvsp[(2) - (4)].str)); } break; case 114: /* Line 1455 of yacc.c */ -#line 495 "griby.y" +#line 497 "griby.y" { (grib_yyvsp[(1) - (3)].act)->next = (grib_yyvsp[(2) - (3)].act); (grib_yyval.act) = (grib_yyvsp[(1) - (3)].act); } break; case 115: /* Line 1455 of yacc.c */ -#line 499 "griby.y" +#line 501 "griby.y" { (grib_yyval.explist) = NULL ;} break; case 116: /* Line 1455 of yacc.c */ -#line 500 "griby.y" +#line 502 "griby.y" { (grib_yyval.explist) = (grib_yyvsp[(2) - (2)].explist) ;} break; case 117: /* Line 1455 of yacc.c */ -#line 503 "griby.y" +#line 505 "griby.y" { (grib_yyval.lval) = 0 ; } break; case 118: /* Line 1455 of yacc.c */ -#line 504 "griby.y" +#line 506 "griby.y" { (grib_yyval.lval) = (grib_yyvsp[(2) - (2)].lval); } break; case 120: /* Line 1455 of yacc.c */ -#line 508 "griby.y" +#line 510 "griby.y" { (grib_yyval.lval) = (grib_yyvsp[(1) - (3)].lval) | (grib_yyvsp[(3) - (3)].lval); } break; case 121: /* Line 1455 of yacc.c */ -#line 511 "griby.y" +#line 513 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_READ_ONLY; } break; case 122: /* Line 1455 of yacc.c */ -#line 512 "griby.y" +#line 514 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_LOWERCASE; } break; case 123: /* Line 1455 of yacc.c */ -#line 513 "griby.y" +#line 515 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_DUMP; } break; case 124: /* Line 1455 of yacc.c */ -#line 514 "griby.y" +#line 516 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_NO_COPY; } break; case 125: /* Line 1455 of yacc.c */ -#line 515 "griby.y" +#line 517 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_NO_FAIL; } break; case 126: /* Line 1455 of yacc.c */ -#line 516 "griby.y" +#line 518 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_HIDDEN; } break; case 127: /* Line 1455 of yacc.c */ -#line 517 "griby.y" +#line 519 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; } break; case 128: /* Line 1455 of yacc.c */ -#line 518 "griby.y" +#line 520 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_CAN_BE_MISSING; } break; case 129: /* Line 1455 of yacc.c */ -#line 519 "griby.y" +#line 521 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_CONSTRAINT; } break; case 130: /* Line 1455 of yacc.c */ -#line 520 "griby.y" +#line 522 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_OVERRIDE; } break; case 131: /* Line 1455 of yacc.c */ -#line 521 "griby.y" +#line 523 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_COPY_OK; } break; case 132: /* Line 1455 of yacc.c */ -#line 522 "griby.y" +#line 524 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_TRANSIENT; } break; case 133: /* Line 1455 of yacc.c */ -#line 523 "griby.y" +#line 525 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_STRING_TYPE; } break; case 134: /* Line 1455 of yacc.c */ -#line 524 "griby.y" +#line 526 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_LONG_TYPE; } break; case 135: /* Line 1455 of yacc.c */ -#line 527 "griby.y" +#line 529 "griby.y" { (grib_yyval.act) = grib_action_create_list(grib_parser_context,(grib_yyvsp[(1) - (8)].str),(grib_yyvsp[(4) - (8)].exp),(grib_yyvsp[(7) - (8)].act)); free((grib_yyvsp[(1) - (8)].str)); } break; case 136: /* Line 1455 of yacc.c */ -#line 530 "griby.y" +#line 532 "griby.y" { (grib_yyval.act) = grib_action_create_while(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act)); } break; case 137: /* Line 1455 of yacc.c */ -#line 533 "griby.y" +#line 535 "griby.y" { (grib_yyval.act) = grib_action_create_trigger(grib_parser_context,(grib_yyvsp[(3) - (7)].explist),(grib_yyvsp[(6) - (7)].act)); } break; case 138: /* Line 1455 of yacc.c */ -#line 536 "griby.y" +#line 538 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(4) - (6)].concept_value),0,0,0,0,0,0,(grib_yyvsp[(6) - (6)].lval),0); free((grib_yyvsp[(2) - (6)].str)); } break; case 139: /* Line 1455 of yacc.c */ -#line 537 "griby.y" +#line 539 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (9)].str),(grib_yyvsp[(7) - (9)].concept_value),0,0,(grib_yyvsp[(4) - (9)].str),0,0,0,(grib_yyvsp[(9) - (9)].lval),0); free((grib_yyvsp[(2) - (9)].str));free((grib_yyvsp[(4) - (9)].str)); } break; case 140: /* Line 1455 of yacc.c */ -#line 538 "griby.y" +#line 540 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (12)].str),0,(grib_yyvsp[(6) - (12)].str),0,(grib_yyvsp[(4) - (12)].str),(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,(grib_yyvsp[(12) - (12)].lval),0); free((grib_yyvsp[(2) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); } break; case 141: /* Line 1455 of yacc.c */ -#line 539 "griby.y" +#line 541 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (14)].str),0,(grib_yyvsp[(6) - (14)].str),0,(grib_yyvsp[(4) - (14)].str),(grib_yyvsp[(8) - (14)].str),(grib_yyvsp[(10) - (14)].str),(grib_yyvsp[(12) - (14)].str),(grib_yyvsp[(14) - (14)].lval),0); free((grib_yyvsp[(2) - (14)].str));free((grib_yyvsp[(6) - (14)].str));free((grib_yyvsp[(4) - (14)].str));free((grib_yyvsp[(8) - (14)].str));free((grib_yyvsp[(10) - (14)].str));free((grib_yyvsp[(12) - (14)].str)); } break; case 142: /* Line 1455 of yacc.c */ -#line 540 "griby.y" +#line 542 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (10)].str),0,(grib_yyvsp[(6) - (10)].str),0,(grib_yyvsp[(4) - (10)].str),(grib_yyvsp[(8) - (10)].str),0,0,(grib_yyvsp[(10) - (10)].lval),0); free((grib_yyvsp[(2) - (10)].str));free((grib_yyvsp[(6) - (10)].str));free((grib_yyvsp[(4) - (10)].str));free((grib_yyvsp[(8) - (10)].str)); } break; case 143: /* Line 1455 of yacc.c */ -#line 541 "griby.y" +#line 543 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (14)].str),0,(grib_yyvsp[(8) - (14)].str),(grib_yyvsp[(2) - (14)].str),(grib_yyvsp[(6) - (14)].str),(grib_yyvsp[(10) - (14)].str),(grib_yyvsp[(12) - (14)].str),0,(grib_yyvsp[(14) - (14)].lval),0); free((grib_yyvsp[(4) - (14)].str));free((grib_yyvsp[(8) - (14)].str));free((grib_yyvsp[(6) - (14)].str));free((grib_yyvsp[(10) - (14)].str)); free((grib_yyvsp[(2) - (14)].str));} break; case 144: /* Line 1455 of yacc.c */ -#line 542 "griby.y" +#line 544 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (12)].str),0,(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(2) - (12)].str),(grib_yyvsp[(6) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,0,(grib_yyvsp[(12) - (12)].lval),0); free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); free((grib_yyvsp[(2) - (12)].str));} break; case 145: /* Line 1455 of yacc.c */ -#line 543 "griby.y" +#line 545 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (8)].str),(grib_yyvsp[(6) - (8)].concept_value),0,(grib_yyvsp[(2) - (8)].str),0,0,0,0,(grib_yyvsp[(8) - (8)].lval),0); free((grib_yyvsp[(2) - (8)].str));free((grib_yyvsp[(4) - (8)].str)); } break; case 146: /* Line 1455 of yacc.c */ -#line 544 "griby.y" +#line 546 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (11)].str),(grib_yyvsp[(9) - (11)].concept_value),0,(grib_yyvsp[(2) - (11)].str),(grib_yyvsp[(6) - (11)].str),0,0,0,(grib_yyvsp[(11) - (11)].lval),0); free((grib_yyvsp[(2) - (11)].str));free((grib_yyvsp[(4) - (11)].str));free((grib_yyvsp[(6) - (11)].str)); } break; case 147: /* Line 1455 of yacc.c */ -#line 545 "griby.y" +#line 547 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(4) - (6)].concept_value),0,0,0,0,0,0,(grib_yyvsp[(6) - (6)].lval),1); free((grib_yyvsp[(2) - (6)].str)); } break; case 148: /* Line 1455 of yacc.c */ -#line 546 "griby.y" +#line 548 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (9)].str),(grib_yyvsp[(7) - (9)].concept_value),0,0,(grib_yyvsp[(4) - (9)].str),0,0,0,(grib_yyvsp[(9) - (9)].lval),1); free((grib_yyvsp[(2) - (9)].str));free((grib_yyvsp[(4) - (9)].str)); } break; case 149: /* Line 1455 of yacc.c */ -#line 547 "griby.y" +#line 549 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (12)].str),0,(grib_yyvsp[(6) - (12)].str),0,(grib_yyvsp[(4) - (12)].str),(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,(grib_yyvsp[(12) - (12)].lval),1); free((grib_yyvsp[(2) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); } break; case 150: /* Line 1455 of yacc.c */ -#line 548 "griby.y" +#line 550 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (10)].str),0,(grib_yyvsp[(6) - (10)].str),0,(grib_yyvsp[(4) - (10)].str),(grib_yyvsp[(8) - (10)].str),0,0,(grib_yyvsp[(10) - (10)].lval),1); free((grib_yyvsp[(2) - (10)].str));free((grib_yyvsp[(6) - (10)].str));free((grib_yyvsp[(4) - (10)].str));free((grib_yyvsp[(8) - (10)].str)); } break; case 151: /* Line 1455 of yacc.c */ -#line 549 "griby.y" +#line 551 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (14)].str),0,(grib_yyvsp[(8) - (14)].str),(grib_yyvsp[(2) - (14)].str),(grib_yyvsp[(6) - (14)].str),(grib_yyvsp[(10) - (14)].str),(grib_yyvsp[(12) - (14)].str),0,(grib_yyvsp[(14) - (14)].lval),1); free((grib_yyvsp[(4) - (14)].str));free((grib_yyvsp[(8) - (14)].str));free((grib_yyvsp[(6) - (14)].str));free((grib_yyvsp[(10) - (14)].str));free((grib_yyvsp[(12) - (14)].str)); free((grib_yyvsp[(2) - (14)].str));} break; case 152: /* Line 1455 of yacc.c */ -#line 550 "griby.y" +#line 552 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (12)].str),0,(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(2) - (12)].str),(grib_yyvsp[(6) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,0,(grib_yyvsp[(12) - (12)].lval),1); free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); free((grib_yyvsp[(2) - (12)].str));} break; case 153: /* Line 1455 of yacc.c */ -#line 551 "griby.y" +#line 553 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (8)].str),(grib_yyvsp[(6) - (8)].concept_value),0,(grib_yyvsp[(2) - (8)].str),0,0,0,0,(grib_yyvsp[(8) - (8)].lval),1); free((grib_yyvsp[(2) - (8)].str));free((grib_yyvsp[(4) - (8)].str)); } break; case 154: /* Line 1455 of yacc.c */ -#line 552 "griby.y" +#line 554 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (11)].str),(grib_yyvsp[(9) - (11)].concept_value),0,(grib_yyvsp[(2) - (11)].str),(grib_yyvsp[(6) - (11)].str),0,0,0,(grib_yyvsp[(11) - (11)].lval),1); free((grib_yyvsp[(2) - (11)].str));free((grib_yyvsp[(4) - (11)].str));free((grib_yyvsp[(6) - (11)].str)); } break; case 156: /* Line 1455 of yacc.c */ -#line 557 "griby.y" +#line 559 "griby.y" { (grib_yyval.concept_value) = (grib_yyvsp[(2) - (2)].concept_value); (grib_yyvsp[(2) - (2)].concept_value)->next = (grib_yyvsp[(1) - (2)].concept_value); } break; case 158: /* Line 1455 of yacc.c */ -#line 561 "griby.y" +#line 563 "griby.y" { (grib_yyval.case_value) = (grib_yyvsp[(2) - (2)].case_value); (grib_yyvsp[(2) - (2)].case_value)->next = (grib_yyvsp[(1) - (2)].case_value); } break; case 159: /* Line 1455 of yacc.c */ -#line 564 "griby.y" +#line 566 "griby.y" { (grib_yyval.case_value) = grib_case_new(grib_parser_context,(grib_yyvsp[(2) - (4)].explist),(grib_yyvsp[(4) - (4)].act)); } break; case 160: /* Line 1455 of yacc.c */ -#line 568 "griby.y" +#line 570 "griby.y" { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[(3) - (10)].explist),(grib_yyvsp[(6) - (10)].case_value),(grib_yyvsp[(9) - (10)].act)); } break; case 161: /* Line 1455 of yacc.c */ -#line 569 "griby.y" +#line 571 "griby.y" { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[(3) - (9)].explist),(grib_yyvsp[(6) - (9)].case_value),grib_action_create_noop(grib_parser_context,"continue")); } break; case 162: /* Line 1455 of yacc.c */ -#line 570 "griby.y" +#line 572 "griby.y" { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[(3) - (7)].explist),(grib_yyvsp[(6) - (7)].case_value),0); } break; case 163: -/* Line 1455 of yacc.c */ -#line 573 "griby.y" - { - (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,(grib_yyvsp[(1) - (5)].str),(grib_yyvsp[(4) - (5)].concept_condition)); free((grib_yyvsp[(1) - (5)].str));} - break; - - case 164: - /* Line 1455 of yacc.c */ #line 575 "griby.y" { (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,(grib_yyvsp[(1) - (5)].str),(grib_yyvsp[(4) - (5)].concept_condition)); free((grib_yyvsp[(1) - (5)].str));} break; - case 165: + case 164: /* Line 1455 of yacc.c */ #line 577 "griby.y" + { + (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,(grib_yyvsp[(1) - (5)].str),(grib_yyvsp[(4) - (5)].concept_condition)); free((grib_yyvsp[(1) - (5)].str));} + break; + + case 165: + +/* Line 1455 of yacc.c */ +#line 579 "griby.y" { char buf[80]; sprintf(buf,"%ld",(long)(grib_yyvsp[(1) - (5)].lval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[(4) - (5)].concept_condition));} break; @@ -3290,7 +3290,7 @@ grib_yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 579 "griby.y" +#line 581 "griby.y" { char buf[80]; sprintf(buf,"%g",(double)(grib_yyvsp[(1) - (5)].dval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[(4) - (5)].concept_condition));} break; @@ -3298,252 +3298,252 @@ grib_yyreduce: case 168: /* Line 1455 of yacc.c */ -#line 584 "griby.y" +#line 586 "griby.y" { (grib_yyvsp[(1) - (2)].concept_condition)->next = (grib_yyvsp[(2) - (2)].concept_condition); (grib_yyval.concept_condition) = (grib_yyvsp[(1) - (2)].concept_condition); } break; case 169: /* Line 1455 of yacc.c */ -#line 587 "griby.y" +#line 589 "griby.y" { (grib_yyval.concept_condition) = grib_concept_condition_new(grib_parser_context,(grib_yyvsp[(1) - (4)].str),(grib_yyvsp[(3) - (4)].exp)); free((grib_yyvsp[(1) - (4)].str)); } break; case 170: /* Line 1455 of yacc.c */ -#line 590 "griby.y" +#line 592 "griby.y" { (grib_yyval.exp) = new_accessor_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].str)); free((grib_yyvsp[(1) - (1)].str)); } break; case 171: /* Line 1455 of yacc.c */ -#line 591 "griby.y" +#line 593 "griby.y" { (grib_yyval.exp) = new_string_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].str)); free((grib_yyvsp[(1) - (1)].str)); } break; case 173: /* Line 1455 of yacc.c */ -#line 595 "griby.y" +#line 597 "griby.y" { (grib_yyval.exp) = new_long_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].lval)); } break; case 174: /* Line 1455 of yacc.c */ -#line 596 "griby.y" +#line 598 "griby.y" { (grib_yyval.exp) = new_double_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].dval)); /* TODO: change to new_float_expression*/} break; case 175: /* Line 1455 of yacc.c */ -#line 598 "griby.y" +#line 600 "griby.y" { (grib_yyval.exp) = NULL; } break; case 176: /* Line 1455 of yacc.c */ -#line 599 "griby.y" +#line 601 "griby.y" { (grib_yyval.exp) = new_true_expression(grib_parser_context); } break; case 177: /* Line 1455 of yacc.c */ -#line 600 "griby.y" +#line 602 "griby.y" { (grib_yyval.exp) = (grib_yyvsp[(2) - (3)].exp); } break; case 178: /* Line 1455 of yacc.c */ -#line 601 "griby.y" +#line 603 "griby.y" { (grib_yyval.exp) = new_unop_expression(grib_parser_context,&grib_op_neg,&grib_op_neg_d,(grib_yyvsp[(2) - (2)].exp)); } break; case 179: /* Line 1455 of yacc.c */ -#line 602 "griby.y" +#line 604 "griby.y" { (grib_yyval.exp) = new_func_expression(grib_parser_context,(grib_yyvsp[(1) - (3)].str),NULL); free((grib_yyvsp[(1) - (3)].str));} break; case 180: /* Line 1455 of yacc.c */ -#line 603 "griby.y" +#line 605 "griby.y" { (grib_yyval.exp) = new_func_expression(grib_parser_context,(grib_yyvsp[(1) - (4)].str),(grib_yyvsp[(3) - (4)].explist)); free((grib_yyvsp[(1) - (4)].str));} break; case 181: /* Line 1455 of yacc.c */ -#line 607 "griby.y" +#line 609 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_pow,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 183: /* Line 1455 of yacc.c */ -#line 611 "griby.y" +#line 613 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_mul,&grib_op_mul_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 184: /* Line 1455 of yacc.c */ -#line 612 "griby.y" +#line 614 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_div,&grib_op_div_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 185: /* Line 1455 of yacc.c */ -#line 613 "griby.y" +#line 615 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_modulo,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 186: /* Line 1455 of yacc.c */ -#line 614 "griby.y" +#line 616 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_bit,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 187: /* Line 1455 of yacc.c */ -#line 615 "griby.y" +#line 617 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_bitoff,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 189: /* Line 1455 of yacc.c */ -#line 619 "griby.y" +#line 621 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_add,&grib_op_add_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 190: /* Line 1455 of yacc.c */ -#line 620 "griby.y" +#line 622 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_sub,&grib_op_sub_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 192: /* Line 1455 of yacc.c */ -#line 624 "griby.y" +#line 626 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_gt,&grib_op_gt_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 193: /* Line 1455 of yacc.c */ -#line 626 "griby.y" +#line 628 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_eq,&grib_op_eq_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 194: /* Line 1455 of yacc.c */ -#line 627 "griby.y" +#line 629 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_lt,&grib_op_lt_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 195: /* Line 1455 of yacc.c */ -#line 628 "griby.y" +#line 630 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_ge,&grib_op_ge_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 196: /* Line 1455 of yacc.c */ -#line 629 "griby.y" +#line 631 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_le,&grib_op_le_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 197: /* Line 1455 of yacc.c */ -#line 630 "griby.y" +#line 632 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_ne,&grib_op_ne_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 198: /* Line 1455 of yacc.c */ -#line 631 "griby.y" +#line 633 "griby.y" { (grib_yyval.exp) = new_string_compare_expression(grib_parser_context,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 199: /* Line 1455 of yacc.c */ -#line 636 "griby.y" +#line 638 "griby.y" { (grib_yyval.exp) = new_unop_expression(grib_parser_context,&grib_op_not,NULL,(grib_yyvsp[(2) - (2)].exp)); } break; case 201: /* Line 1455 of yacc.c */ -#line 640 "griby.y" +#line 642 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_and,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); } break; case 203: /* Line 1455 of yacc.c */ -#line 644 "griby.y" +#line 646 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_or,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp));} break; case 208: /* Line 1455 of yacc.c */ -#line 658 "griby.y" +#line 660 "griby.y" { (grib_yyval.rule_entry) = grib_new_rule_entry(grib_parser_context,(grib_yyvsp[(1) - (4)].str),(grib_yyvsp[(3) - (4)].exp)); free((grib_yyvsp[(1) - (4)].str)); } break; case 209: /* Line 1455 of yacc.c */ -#line 659 "griby.y" +#line 661 "griby.y" { (grib_yyval.rule_entry) = grib_new_rule_entry(grib_parser_context,"skip",0);} break; case 211: /* Line 1455 of yacc.c */ -#line 663 "griby.y" +#line 665 "griby.y" { (grib_yyvsp[(1) - (2)].rule_entry)->next = (grib_yyvsp[(2) - (2)].rule_entry); (grib_yyval.rule_entry) = (grib_yyvsp[(1) - (2)].rule_entry); } break; case 212: /* Line 1455 of yacc.c */ -#line 666 "griby.y" +#line 668 "griby.y" { (grib_yyval.rules) = grib_new_rule(grib_parser_context,NULL,(grib_yyvsp[(1) - (1)].rule_entry)); } break; case 213: /* Line 1455 of yacc.c */ -#line 670 "griby.y" +#line 672 "griby.y" { (grib_yyval.rules) = grib_new_rule(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].rule_entry)); } break; case 215: /* Line 1455 of yacc.c */ -#line 674 "griby.y" +#line 676 "griby.y" { (grib_yyvsp[(1) - (2)].rules)->next = (grib_yyvsp[(2) - (2)].rules); (grib_yyval.rules) = (grib_yyvsp[(1) - (2)].rules); } break; @@ -3762,7 +3762,7 @@ grib_yyreturn: /* Line 1675 of yacc.c */ -#line 678 "griby.y" +#line 680 "griby.y" static grib_concept_value *reverse_concept(grib_concept_value *r,grib_concept_value *s) diff --git a/src/grib_yacc.h b/src/grib_yacc.h index 48f35abd7..661284f58 100644 --- a/src/grib_yacc.h +++ b/src/grib_yacc.h @@ -225,7 +225,7 @@ typedef union YYSTYPE { /* Line 1676 of yacc.c */ -#line 32 "griby.y" +#line 34 "griby.y" char *str; long lval; diff --git a/src/hash.c b/src/hash.c index 37aa3a1da..e96b3761b 100755 --- a/src/hash.c +++ b/src/hash.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include #include "mars.h" diff --git a/src/md5.c b/src/md5.c index 091363df6..62238b3ba 100644 --- a/src/md5.c +++ b/src/md5.c @@ -1,10 +1,18 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ #include "md5.h" -#include #include #include -#include +#include static unsigned long r[] = { 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, @@ -200,97 +208,99 @@ static void grib_md5_flush(grib_md5_state* s) s->word_count = 0; } -void grib_md5_init(grib_md5_state* s) { - memset(s,0,sizeof(grib_md5_state)); - s->h0 = 0x67452301; - s->h1 = 0xefcdab89; - s->h2 = 0x98badcfe; - s->h3 = 0x10325476; +void grib_md5_init(grib_md5_state* s) +{ + assert( sizeof(UnsignedInt64) == 8 ); + memset(s,0,sizeof(grib_md5_state)); + s->h0 = 0x67452301; + s->h1 = 0xefcdab89; + s->h2 = 0x98badcfe; + s->h3 = 0x10325476; } void grib_md5_add(grib_md5_state* s,const void* data,size_t len) { - unsigned char* p = (unsigned char*)data; - s->size += len; + unsigned char* p = (unsigned char*)data; + s->size += len; - while(len-- > 0) { - s->bytes[s->byte_count++] = *p++; + while(len-- > 0) { + s->bytes[s->byte_count++] = *p++; - if(s->byte_count == 4) { - s->words[s->word_count++] = (s->bytes[3]<<24)|(s->bytes[2]<<16)|(s->bytes[1]<<8)|(s->bytes[0]); - s->byte_count = 0; + if(s->byte_count == 4) { + s->words[s->word_count++] = (s->bytes[3]<<24)|(s->bytes[2]<<16)|(s->bytes[1]<<8)|(s->bytes[0]); + s->byte_count = 0; - if(s->word_count == 16) - grib_md5_flush(s); - } + if(s->word_count == 16) + grib_md5_flush(s); + } - } + } } void grib_md5_end(grib_md5_state* s, char *digest) { - uint64_t h = 8; - uint64_t bits, leng = s->size * h; - unsigned char c = 0x80; - int i; + UnsignedInt64 h = 8; + UnsignedInt64 bits, leng = s->size * h; + unsigned char c = 0x80; + int i; - grib_md5_add(s,&c,1); + grib_md5_add(s,&c,1); - bits = s->size * h; - c = 0; - while( (bits % 512) != 448) - { - grib_md5_add(s,&c,1); - bits = s->size * h; - } + bits = s->size * h; + c = 0; + while( (bits % 512) != 448) + { + grib_md5_add(s,&c,1); + bits = s->size * h; + } - for(i = 0; i < 8 ; i++) { - c = leng & 0xff; - leng >>= 8; - grib_md5_add(s,&c,1); - } + for(i = 0; i < 8 ; i++) { + c = leng & 0xff; + leng >>= 8; + grib_md5_add(s,&c,1); + } #define U(x) ((unsigned int)(x)) - sprintf(digest, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - U(s->h0 & 0xff), U((s->h0 >> 8) & 0xff), U((s->h0 >> 16) & 0xff), U((s->h0 >> 24) & 0xff), - U(s->h1 & 0xff), U((s->h1 >> 8) & 0xff), U((s->h1 >> 16) & 0xff), U((s->h1 >> 24) & 0xff), - U(s->h2 & 0xff), U((s->h2 >> 8) & 0xff), U((s->h2 >> 16) & 0xff), U((s->h2 >> 24) & 0xff), - U(s->h3 & 0xff), U((s->h3 >> 8) & 0xff), U((s->h3 >> 16) & 0xff), U((s->h3 >> 24) & 0xff)); + sprintf(digest, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + U(s->h0 & 0xff), U((s->h0 >> 8) & 0xff), U((s->h0 >> 16) & 0xff), U((s->h0 >> 24) & 0xff), + U(s->h1 & 0xff), U((s->h1 >> 8) & 0xff), U((s->h1 >> 16) & 0xff), U((s->h1 >> 24) & 0xff), + U(s->h2 & 0xff), U((s->h2 >> 8) & 0xff), U((s->h2 >> 16) & 0xff), U((s->h2 >> 24) & 0xff), + U(s->h3 & 0xff), U((s->h3 >> 8) & 0xff), U((s->h3 >> 16) & 0xff), U((s->h3 >> 24) & 0xff)); } #if 0 main(int argc, char **argv) { - char digest[1024]; + char digest[1024]; - const char* p = "The quick brown fox jumps over the lazy dog"; - grib_md5_state s; - grib_md5_init(&s); - if(argc>1) { - char buffer[10240]; - long len = 0; - FILE* f = fopen64(argv[1],"r"); - if(!f) { - perror(argv[1]); - exit(1); - } - while((len = fread(buffer, 1, sizeof(buffer), f)) > 0) { - grib_md5_add(&s,buffer,len); - } - fclose(f); - } - else - { - grib_md5_add(&s,p,strlen(p)); - } - grib_md5_end(&s, digest); + const char* p = "The quick brown fox jumps over the lazy dog"; + grib_md5_state s; + grib_md5_init(&s); + if(argc>1) { + char buffer[10240]; + long len = 0; + FILE* f = fopen64(argv[1],"r"); + if(!f) { + perror(argv[1]); + exit(1); + } + while((len = fread(buffer, 1, sizeof(buffer), f)) > 0) { + grib_md5_add(&s,buffer,len); + } + fclose(f); + } + else + { + grib_md5_add(&s,p,strlen(p)); + } + grib_md5_end(&s, digest); - printf("%s\n",digest); + printf("%s\n",digest); } #endif diff --git a/src/md5.h b/src/md5.h index e75359754..073561ae5 100644 --- a/src/md5.h +++ b/src/md5.h @@ -1,24 +1,40 @@ - #ifndef md5_H #define md5_H -#include -#include +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ +#include +#ifndef _WIN32 +#include +#endif + +#ifdef _WIN32 + typedef unsigned __int64 UnsignedInt64; +#else + typedef uint64_t UnsignedInt64; +#endif typedef struct grib_md5_state { - uint64_t size; + UnsignedInt64 size; - unsigned long words[64]; - unsigned long word_count; + unsigned long words[64]; + unsigned long word_count; - unsigned char bytes[4]; - unsigned long byte_count; + unsigned char bytes[4]; + unsigned long byte_count; - unsigned long h0; - unsigned long h1; - unsigned long h2; - unsigned long h3; + unsigned long h0; + unsigned long h1; + unsigned long h2; + unsigned long h3; } grib_md5_state; @@ -26,6 +42,5 @@ void grib_md5_init(grib_md5_state* s); void grib_md5_add(grib_md5_state* s,const void* data,size_t len); void grib_md5_end(grib_md5_state* s, char *digest); - - #endif + diff --git a/tests/Makefile.am b/tests/Makefile.am index f885ca3cb..c58b54d72 100755 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,9 @@ TESTS = definitions.sh \ ieee.sh grib1to2.sh \ - grib2to1.sh badgrib.sh ls.sh convert.sh filter.sh \ - multi.sh budg.sh gridType.sh concept.sh decimalPrecision.sh \ + unit_tests.sh \ + grib2to1.sh badgrib.sh ls.sh convert.sh filter.sh \ + multi.sh budg.sh gridType.sh concept.sh decimalPrecision.sh \ bitsPerValue.sh get_fail.sh missing.sh \ local.sh step.sh set.sh iterator.sh \ compare.sh level.sh index.sh \ @@ -13,7 +14,7 @@ noinst_PROGRAMS = packing_check gauss_sub read_any double_cmp packing pack_unpack \ multi_from_message julian read_index index gribex_perf\ - jpeg_perf so_perf png_perf bpv_limit laplacian + jpeg_perf so_perf png_perf bpv_limit laplacian unit_tests multi_from_message_SOURCES = multi_from_message.c laplacian_SOURCES = laplacian.c @@ -24,6 +25,7 @@ double_cmp_SOURCES = double_cmp.c pack_unpack_SOURCES = pack_unpack.c julian_SOURCES = julian.c + unit_tests_SOURCES = unit_tests.c index_SOURCES = index.c read_index_SOURCES = read_index.c jpeg_perf_SOURCES = jpeg_perf.c diff --git a/tests/badgrib.sh b/tests/badgrib.sh index 955f7a035..7960779f2 100755 --- a/tests/badgrib.sh +++ b/tests/badgrib.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/bitmap.sh b/tests/bitmap.sh index 3e3d9bb5a..f8bc10620 100755 --- a/tests/bitmap.sh +++ b/tests/bitmap.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/bitsPerValue.sh b/tests/bitsPerValue.sh index 8c87fc1d2..671b4a584 100755 --- a/tests/bitsPerValue.sh +++ b/tests/bitsPerValue.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/bpv_limit.sh b/tests/bpv_limit.sh index d768e6ffb..18229ee5d 100755 --- a/tests/bpv_limit.sh +++ b/tests/bpv_limit.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/budg.sh b/tests/budg.sh index a1f33dcff..dba84472b 100755 --- a/tests/budg.sh +++ b/tests/budg.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/change_scanning.sh b/tests/change_scanning.sh index d2081ddf8..ac0769095 100755 --- a/tests/change_scanning.sh +++ b/tests/change_scanning.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/compare.sh b/tests/compare.sh index f482127db..78f187898 100755 --- a/tests/compare.sh +++ b/tests/compare.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/concept.sh b/tests/concept.sh index b8c8cdb2f..8e8a91de3 100755 --- a/tests/concept.sh +++ b/tests/concept.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/convert.sh b/tests/convert.sh index 6d6ce1d5b..b5a33f9e6 100755 --- a/tests/convert.sh +++ b/tests/convert.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/debug.sh b/tests/debug.sh index ec80c09b8..82a8067b9 100755 --- a/tests/debug.sh +++ b/tests/debug.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/decimalPrecision.sh b/tests/decimalPrecision.sh index c8d9a0daf..2778ccc59 100755 --- a/tests/decimalPrecision.sh +++ b/tests/decimalPrecision.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/definitions.sh b/tests/definitions.sh index 3c6b07704..e2c733544 100755 --- a/tests/definitions.sh +++ b/tests/definitions.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/double_cmp.sh b/tests/double_cmp.sh index 440f2c894..12aae1fb1 100755 --- a/tests/double_cmp.sh +++ b/tests/double_cmp.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/fortran_interface.sh b/tests/fortran_interface.sh index aa0f4d068..654ffd48b 100755 --- a/tests/fortran_interface.sh +++ b/tests/fortran_interface.sh @@ -1,13 +1,11 @@ +#! /bin/sh # Copyright 2005-2012 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. -# - -#! /bin/sh set -e tmpfiles="fortran_interface.dat" diff --git a/tests/get_fail.sh b/tests/get_fail.sh index e00f39daa..5540c24d1 100755 --- a/tests/get_fail.sh +++ b/tests/get_fail.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/grib1to2.sh b/tests/grib1to2.sh index d596aa406..0143c0a8a 100755 --- a/tests/grib1to2.sh +++ b/tests/grib1to2.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/grib2to1.sh b/tests/grib2to1.sh index 4da19f449..2db60859e 100755 --- a/tests/grib2to1.sh +++ b/tests/grib2to1.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/gridType.sh b/tests/gridType.sh index 242e76e60..79822d1b3 100755 --- a/tests/gridType.sh +++ b/tests/gridType.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/include.sh b/tests/include.sh index 38a3a95cd..3bff6edce 100644 --- a/tests/include.sh +++ b/tests/include.sh @@ -2,11 +2,10 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # - set -ea echo diff --git a/tests/index.sh b/tests/index.sh index 5a210bf2e..56c7c975c 100755 --- a/tests/index.sh +++ b/tests/index.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/iterator.sh b/tests/iterator.sh index a3d40ebaa..f9714325e 100755 --- a/tests/iterator.sh +++ b/tests/iterator.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/jpeg.sh b/tests/jpeg.sh index 0ec2091b8..a262f46c3 100755 --- a/tests/jpeg.sh +++ b/tests/jpeg.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/julian.sh b/tests/julian.sh index 870ea5709..2a6a7c5d9 100755 --- a/tests/julian.sh +++ b/tests/julian.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/level.sh b/tests/level.sh index 5ed0b9a95..f95af325b 100755 --- a/tests/level.sh +++ b/tests/level.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/list.sh b/tests/list.sh index 21cb415aa..b21aa436d 100755 --- a/tests/list.sh +++ b/tests/list.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/list_all_keys.ksh b/tests/list_all_keys.ksh index e6a33d901..abf408a96 100755 --- a/tests/list_all_keys.ksh +++ b/tests/list_all_keys.ksh @@ -3,10 +3,9 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. -# . ./include.sh diff --git a/tests/local.sh b/tests/local.sh index deb83b5b8..8a8c5354d 100755 --- a/tests/local.sh +++ b/tests/local.sh @@ -20,28 +20,28 @@ rm -f local.log | true # GRIB2 definitions for chemicals and aerosols for MACC sample_g2=$GRIB_SAMPLES_PATH/GRIB2.tmpl -#${tools_dir}grib_set -s paramId=210005 $sample_g2 macc.grb2 -#result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,units,aerosolType,name macc.grb2` -#[ "$result" = '0 20 2 aermr05 kg kg**-1 62001 Dust Aerosol (0.55 - 0.9 um) Mixing Ratio' ] -#[ `${tools_dir}grib_get -p productDefinitionTemplateNumber macc.grb2` = '44' ] +${tools_dir}grib_set -s paramId=210005 $sample_g2 macc.grb2 +result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,units,aerosolType,name macc.grb2` +[ "$result" = '0 20 2 aermr05 kg kg**-1 62001 Dust Aerosol (0.55 - 0.9 um) Mixing Ratio' ] +[ `${tools_dir}grib_get -p productDefinitionTemplateNumber macc.grb2` = '44' ] -#${tools_dir}grib_set -s paramId=210001 $sample_g2 macc.grb2 -#result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,units,aerosolType,name macc.grb2` -#[ "$result" = '0 20 2 aermr01 kg kg**-1 62008 Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio' ] +${tools_dir}grib_set -s paramId=210001 $sample_g2 macc.grb2 +result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,units,aerosolType,name macc.grb2` +[ "$result" = '0 20 2 aermr01 kg kg**-1 62008 Sea Salt Aerosol (0.03 - 0.5 um) Mixing Ratio' ] -#${tools_dir}grib_set -s paramId=210007 $sample_g2 macc.grb2 -#result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,typeOfSizeInterval,aerosolType,name macc.grb2` -#[ "$result" = '0 20 2 aermr07 255 62016 Hydrophobic Organic Matter Aerosol Mixing Ratio' ] +${tools_dir}grib_set -s paramId=210007 $sample_g2 macc.grb2 +result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,typeOfSizeInterval,aerosolType,name macc.grb2` +[ "$result" = '0 20 2 aermr07 255 62016 Hydrophobic Organic Matter Aerosol Mixing Ratio' ] -#${tools_dir}grib_set -s paramId=210061 $sample_g2 macc.grb2 -#result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,productDefinitionTemplateNumber,constituentType,name macc.grb2` -#[ "$result" = '0 20 2 co2 40 3 Carbon Dioxide' ] +${tools_dir}grib_set -s paramId=210061 $sample_g2 macc.grb2 +result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,productDefinitionTemplateNumber,constituentType,name macc.grb2` +[ "$result" = '0 20 2 co2 40 3 Carbon Dioxide' ] -#${tools_dir}grib_set -s paramId=210062 $sample_g2 macc.grb2 -#result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,productDefinitionTemplateNumber,constituentType,name macc.grb2` -#[ "$result" = '0 20 2 ch4 40 2 Methane' ] +${tools_dir}grib_set -s paramId=210062 $sample_g2 macc.grb2 +result=`${tools_dir}grib_get -p discipline,parameterCategory,parameterNumber,shortName,productDefinitionTemplateNumber,constituentType,name macc.grb2` +[ "$result" = '0 20 2 ch4 40 2 Methane' ] -#rm -f macc.grb2 | true +rm -f macc.grb2 | true ${tools_dir}grib_set -s edition=2,setLocalDefinition=1 reduced_gaussian_model_level.grib1 loc.grib2 diff --git a/tests/ls.sh b/tests/ls.sh index 449e54b36..724f5f0aa 100755 --- a/tests/ls.sh +++ b/tests/ls.sh @@ -69,7 +69,7 @@ rm -f tmp_rlls.grib1 | true # GRIB-305. GRIB edition 1 file with one large message if [ -f "sst_globus0083.grib" ]; then - ${tools_dir}grib_ls sst_globus0083.grib > /dev/null + ${tools_dir}grib_ls sst_globus0083.grib > /dev/null fi cd $workdir diff --git a/tests/missing.sh b/tests/missing.sh index 26beb38d8..340cb76fe 100755 --- a/tests/missing.sh +++ b/tests/missing.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/multi.sh b/tests/multi.sh index a604327dd..88db15a96 100755 --- a/tests/multi.sh +++ b/tests/multi.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/multi_from_message.sh b/tests/multi_from_message.sh index 3677c0bfb..44eb775a3 100755 --- a/tests/multi_from_message.sh +++ b/tests/multi_from_message.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/padding.sh b/tests/padding.sh index 0495a1206..893d94549 100755 --- a/tests/padding.sh +++ b/tests/padding.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/read_any.sh b/tests/read_any.sh index 37167702c..788daa2c5 100755 --- a/tests/read_any.sh +++ b/tests/read_any.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/set.sh b/tests/set.sh index 63f1c52e7..d97c53150 100755 --- a/tests/set.sh +++ b/tests/set.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/statistics.sh b/tests/statistics.sh index 3c23495d0..7f1334b3d 100755 --- a/tests/statistics.sh +++ b/tests/statistics.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/step.sh b/tests/step.sh index c6994aca2..7217e5d46 100755 --- a/tests/step.sh +++ b/tests/step.sh @@ -64,13 +64,13 @@ ${tools_dir}grib_set -s step=78 $grib2File.p8tmp ${grib2File}.tmp set `${tools_dir}grib_get -p hourOfEndOfOverallTimeInterval,dayOfEndOfOverallTimeInterval ${grib2File}.tmp` hourEnd=$1; dayEnd=$2 [ "$hourEnd" = "18" ] -[ "$dayEnd" = "8" ] +[ "$dayEnd" = "8" ] ${tools_dir}grib_set -s step=12 $grib2File.p8tmp ${grib2File}.tmp set `${tools_dir}grib_get -p hourOfEndOfOverallTimeInterval,dayOfEndOfOverallTimeInterval ${grib2File}.tmp` hourEnd=$1; dayEnd=$2 [ "$hourEnd" = "0" ] -[ "$dayEnd" = "6" ] +[ "$dayEnd" = "6" ] rm -f $grib2File.p8tmp ${grib2File}.tmp | true diff --git a/tests/tigge_conversions.sh b/tests/tigge_conversions.sh index a4bc2300a..f7fb58b4b 100755 --- a/tests/tigge_conversions.sh +++ b/tests/tigge_conversions.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/tiny.sh b/tests/tiny.sh index 5c0aab586..d9ed7f566 100755 --- a/tests/tiny.sh +++ b/tests/tiny.sh @@ -3,7 +3,7 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # diff --git a/tests/unit_tests.c b/tests/unit_tests.c new file mode 100644 index 000000000..d0a32a53e --- /dev/null +++ b/tests/unit_tests.c @@ -0,0 +1,1307 @@ +#include +#include "grib_api.h" + +#define EPSILON 1e-6 + + +void test_gaussian_latitudes() +{ + int order = 640, ret = 0; + int num = 2 * order; + double* lats = (double*)malloc( sizeof(double)*num ); + ret = grib_get_gaussian_latitudes(order, lats); + assert(ret == GRIB_SUCCESS); + + assert( fabs(lats[0] - 89.892396) < EPSILON ); + assert( fabs(lats[1] - 89.753005) < EPSILON ); + assert( fabs(lats[2] - 89.612790) < EPSILON ); + assert( fabs(lats[3] - 89.472390) < EPSILON ); + assert( fabs(lats[4] - 89.331918) < EPSILON ); + assert( fabs(lats[5] - 89.191413) < EPSILON ); + assert( fabs(lats[6] - 89.050889) < EPSILON ); + assert( fabs(lats[7] - 88.910352) < EPSILON ); + assert( fabs(lats[8] - 88.769808) < EPSILON ); + assert( fabs(lats[9] - 88.629259) < EPSILON ); + assert( fabs(lats[10] - 88.488706) < EPSILON ); + assert( fabs(lats[11] - 88.348150) < EPSILON ); + assert( fabs(lats[12] - 88.207592) < EPSILON ); + assert( fabs(lats[13] - 88.067032) < EPSILON ); + assert( fabs(lats[14] - 87.926471) < EPSILON ); + assert( fabs(lats[15] - 87.785908) < EPSILON ); + assert( fabs(lats[16] - 87.645345) < EPSILON ); + assert( fabs(lats[17] - 87.504781) < EPSILON ); + assert( fabs(lats[18] - 87.364216) < EPSILON ); + assert( fabs(lats[19] - 87.223651) < EPSILON ); + assert( fabs(lats[20] - 87.083085) < EPSILON ); + assert( fabs(lats[21] - 86.942519) < EPSILON ); + assert( fabs(lats[22] - 86.801952) < EPSILON ); + assert( fabs(lats[23] - 86.661385) < EPSILON ); + assert( fabs(lats[24] - 86.520818) < EPSILON ); + assert( fabs(lats[25] - 86.380251) < EPSILON ); + assert( fabs(lats[26] - 86.239684) < EPSILON ); + assert( fabs(lats[27] - 86.099116) < EPSILON ); + assert( fabs(lats[28] - 85.958548) < EPSILON ); + assert( fabs(lats[29] - 85.817980) < EPSILON ); + assert( fabs(lats[30] - 85.677412) < EPSILON ); + assert( fabs(lats[31] - 85.536844) < EPSILON ); + assert( fabs(lats[32] - 85.396275) < EPSILON ); + assert( fabs(lats[33] - 85.255707) < EPSILON ); + assert( fabs(lats[34] - 85.115138) < EPSILON ); + assert( fabs(lats[35] - 84.974570) < EPSILON ); + assert( fabs(lats[36] - 84.834001) < EPSILON ); + assert( fabs(lats[37] - 84.693432) < EPSILON ); + assert( fabs(lats[38] - 84.552863) < EPSILON ); + assert( fabs(lats[39] - 84.412294) < EPSILON ); + assert( fabs(lats[40] - 84.271725) < EPSILON ); + assert( fabs(lats[41] - 84.131156) < EPSILON ); + assert( fabs(lats[42] - 83.990587) < EPSILON ); + assert( fabs(lats[43] - 83.850018) < EPSILON ); + assert( fabs(lats[44] - 83.709449) < EPSILON ); + assert( fabs(lats[45] - 83.568880) < EPSILON ); + assert( fabs(lats[46] - 83.428310) < EPSILON ); + assert( fabs(lats[47] - 83.287741) < EPSILON ); + assert( fabs(lats[48] - 83.147172) < EPSILON ); + assert( fabs(lats[49] - 83.006602) < EPSILON ); + assert( fabs(lats[50] - 82.866033) < EPSILON ); + assert( fabs(lats[51] - 82.725464) < EPSILON ); + assert( fabs(lats[52] - 82.584894) < EPSILON ); + assert( fabs(lats[53] - 82.444325) < EPSILON ); + assert( fabs(lats[54] - 82.303755) < EPSILON ); + assert( fabs(lats[55] - 82.163186) < EPSILON ); + assert( fabs(lats[56] - 82.022616) < EPSILON ); + assert( fabs(lats[57] - 81.882047) < EPSILON ); + assert( fabs(lats[58] - 81.741477) < EPSILON ); + assert( fabs(lats[59] - 81.600908) < EPSILON ); + assert( fabs(lats[60] - 81.460338) < EPSILON ); + assert( fabs(lats[61] - 81.319768) < EPSILON ); + assert( fabs(lats[62] - 81.179199) < EPSILON ); + assert( fabs(lats[63] - 81.038629) < EPSILON ); + assert( fabs(lats[64] - 80.898059) < EPSILON ); + assert( fabs(lats[65] - 80.757490) < EPSILON ); + assert( fabs(lats[66] - 80.616920) < EPSILON ); + assert( fabs(lats[67] - 80.476350) < EPSILON ); + assert( fabs(lats[68] - 80.335781) < EPSILON ); + assert( fabs(lats[69] - 80.195211) < EPSILON ); + assert( fabs(lats[70] - 80.054641) < EPSILON ); + assert( fabs(lats[71] - 79.914072) < EPSILON ); + assert( fabs(lats[72] - 79.773502) < EPSILON ); + assert( fabs(lats[73] - 79.632932) < EPSILON ); + assert( fabs(lats[74] - 79.492362) < EPSILON ); + assert( fabs(lats[75] - 79.351792) < EPSILON ); + assert( fabs(lats[76] - 79.211223) < EPSILON ); + assert( fabs(lats[77] - 79.070653) < EPSILON ); + assert( fabs(lats[78] - 78.930083) < EPSILON ); + assert( fabs(lats[79] - 78.789513) < EPSILON ); + assert( fabs(lats[80] - 78.648943) < EPSILON ); + assert( fabs(lats[81] - 78.508374) < EPSILON ); + assert( fabs(lats[82] - 78.367804) < EPSILON ); + assert( fabs(lats[83] - 78.227234) < EPSILON ); + assert( fabs(lats[84] - 78.086664) < EPSILON ); + assert( fabs(lats[85] - 77.946094) < EPSILON ); + assert( fabs(lats[86] - 77.805524) < EPSILON ); + assert( fabs(lats[87] - 77.664955) < EPSILON ); + assert( fabs(lats[88] - 77.524385) < EPSILON ); + assert( fabs(lats[89] - 77.383815) < EPSILON ); + assert( fabs(lats[90] - 77.243245) < EPSILON ); + assert( fabs(lats[91] - 77.102675) < EPSILON ); + assert( fabs(lats[92] - 76.962105) < EPSILON ); + assert( fabs(lats[93] - 76.821535) < EPSILON ); + assert( fabs(lats[94] - 76.680966) < EPSILON ); + assert( fabs(lats[95] - 76.540396) < EPSILON ); + assert( fabs(lats[96] - 76.399826) < EPSILON ); + assert( fabs(lats[97] - 76.259256) < EPSILON ); + assert( fabs(lats[98] - 76.118686) < EPSILON ); + assert( fabs(lats[99] - 75.978116) < EPSILON ); + assert( fabs(lats[100] - 75.837546) < EPSILON ); + assert( fabs(lats[101] - 75.696976) < EPSILON ); + assert( fabs(lats[102] - 75.556406) < EPSILON ); + assert( fabs(lats[103] - 75.415836) < EPSILON ); + assert( fabs(lats[104] - 75.275266) < EPSILON ); + assert( fabs(lats[105] - 75.134697) < EPSILON ); + assert( fabs(lats[106] - 74.994127) < EPSILON ); + assert( fabs(lats[107] - 74.853557) < EPSILON ); + assert( fabs(lats[108] - 74.712987) < EPSILON ); + assert( fabs(lats[109] - 74.572417) < EPSILON ); + assert( fabs(lats[110] - 74.431847) < EPSILON ); + assert( fabs(lats[111] - 74.291277) < EPSILON ); + assert( fabs(lats[112] - 74.150707) < EPSILON ); + assert( fabs(lats[113] - 74.010137) < EPSILON ); + assert( fabs(lats[114] - 73.869567) < EPSILON ); + assert( fabs(lats[115] - 73.728997) < EPSILON ); + assert( fabs(lats[116] - 73.588427) < EPSILON ); + assert( fabs(lats[117] - 73.447857) < EPSILON ); + assert( fabs(lats[118] - 73.307287) < EPSILON ); + assert( fabs(lats[119] - 73.166717) < EPSILON ); + assert( fabs(lats[120] - 73.026147) < EPSILON ); + assert( fabs(lats[121] - 72.885577) < EPSILON ); + assert( fabs(lats[122] - 72.745007) < EPSILON ); + assert( fabs(lats[123] - 72.604437) < EPSILON ); + assert( fabs(lats[124] - 72.463867) < EPSILON ); + assert( fabs(lats[125] - 72.323298) < EPSILON ); + assert( fabs(lats[126] - 72.182728) < EPSILON ); + assert( fabs(lats[127] - 72.042158) < EPSILON ); + assert( fabs(lats[128] - 71.901588) < EPSILON ); + assert( fabs(lats[129] - 71.761018) < EPSILON ); + assert( fabs(lats[130] - 71.620448) < EPSILON ); + assert( fabs(lats[131] - 71.479878) < EPSILON ); + assert( fabs(lats[132] - 71.339308) < EPSILON ); + assert( fabs(lats[133] - 71.198738) < EPSILON ); + assert( fabs(lats[134] - 71.058168) < EPSILON ); + assert( fabs(lats[135] - 70.917598) < EPSILON ); + assert( fabs(lats[136] - 70.777028) < EPSILON ); + assert( fabs(lats[137] - 70.636458) < EPSILON ); + assert( fabs(lats[138] - 70.495888) < EPSILON ); + assert( fabs(lats[139] - 70.355318) < EPSILON ); + assert( fabs(lats[140] - 70.214748) < EPSILON ); + assert( fabs(lats[141] - 70.074178) < EPSILON ); + assert( fabs(lats[142] - 69.933608) < EPSILON ); + assert( fabs(lats[143] - 69.793038) < EPSILON ); + assert( fabs(lats[144] - 69.652468) < EPSILON ); + assert( fabs(lats[145] - 69.511898) < EPSILON ); + assert( fabs(lats[146] - 69.371328) < EPSILON ); + assert( fabs(lats[147] - 69.230758) < EPSILON ); + assert( fabs(lats[148] - 69.090188) < EPSILON ); + assert( fabs(lats[149] - 68.949618) < EPSILON ); + assert( fabs(lats[150] - 68.809048) < EPSILON ); + assert( fabs(lats[151] - 68.668478) < EPSILON ); + assert( fabs(lats[152] - 68.527908) < EPSILON ); + assert( fabs(lats[153] - 68.387338) < EPSILON ); + assert( fabs(lats[154] - 68.246768) < EPSILON ); + assert( fabs(lats[155] - 68.106198) < EPSILON ); + assert( fabs(lats[156] - 67.965628) < EPSILON ); + assert( fabs(lats[157] - 67.825058) < EPSILON ); + assert( fabs(lats[158] - 67.684488) < EPSILON ); + assert( fabs(lats[159] - 67.543918) < EPSILON ); + assert( fabs(lats[160] - 67.403348) < EPSILON ); + assert( fabs(lats[161] - 67.262778) < EPSILON ); + assert( fabs(lats[162] - 67.122208) < EPSILON ); + assert( fabs(lats[163] - 66.981638) < EPSILON ); + assert( fabs(lats[164] - 66.841067) < EPSILON ); + assert( fabs(lats[165] - 66.700497) < EPSILON ); + assert( fabs(lats[166] - 66.559927) < EPSILON ); + assert( fabs(lats[167] - 66.419357) < EPSILON ); + assert( fabs(lats[168] - 66.278787) < EPSILON ); + assert( fabs(lats[169] - 66.138217) < EPSILON ); + assert( fabs(lats[170] - 65.997647) < EPSILON ); + assert( fabs(lats[171] - 65.857077) < EPSILON ); + assert( fabs(lats[172] - 65.716507) < EPSILON ); + assert( fabs(lats[173] - 65.575937) < EPSILON ); + assert( fabs(lats[174] - 65.435367) < EPSILON ); + assert( fabs(lats[175] - 65.294797) < EPSILON ); + assert( fabs(lats[176] - 65.154227) < EPSILON ); + assert( fabs(lats[177] - 65.013657) < EPSILON ); + assert( fabs(lats[178] - 64.873087) < EPSILON ); + assert( fabs(lats[179] - 64.732517) < EPSILON ); + assert( fabs(lats[180] - 64.591947) < EPSILON ); + assert( fabs(lats[181] - 64.451377) < EPSILON ); + assert( fabs(lats[182] - 64.310807) < EPSILON ); + assert( fabs(lats[183] - 64.170237) < EPSILON ); + assert( fabs(lats[184] - 64.029667) < EPSILON ); + assert( fabs(lats[185] - 63.889097) < EPSILON ); + assert( fabs(lats[186] - 63.748527) < EPSILON ); + assert( fabs(lats[187] - 63.607957) < EPSILON ); + assert( fabs(lats[188] - 63.467387) < EPSILON ); + assert( fabs(lats[189] - 63.326817) < EPSILON ); + assert( fabs(lats[190] - 63.186247) < EPSILON ); + assert( fabs(lats[191] - 63.045677) < EPSILON ); + assert( fabs(lats[192] - 62.905107) < EPSILON ); + assert( fabs(lats[193] - 62.764537) < EPSILON ); + assert( fabs(lats[194] - 62.623967) < EPSILON ); + assert( fabs(lats[195] - 62.483397) < EPSILON ); + assert( fabs(lats[196] - 62.342826) < EPSILON ); + assert( fabs(lats[197] - 62.202256) < EPSILON ); + assert( fabs(lats[198] - 62.061686) < EPSILON ); + assert( fabs(lats[199] - 61.921116) < EPSILON ); + assert( fabs(lats[200] - 61.780546) < EPSILON ); + assert( fabs(lats[201] - 61.639976) < EPSILON ); + assert( fabs(lats[202] - 61.499406) < EPSILON ); + assert( fabs(lats[203] - 61.358836) < EPSILON ); + assert( fabs(lats[204] - 61.218266) < EPSILON ); + assert( fabs(lats[205] - 61.077696) < EPSILON ); + assert( fabs(lats[206] - 60.937126) < EPSILON ); + assert( fabs(lats[207] - 60.796556) < EPSILON ); + assert( fabs(lats[208] - 60.655986) < EPSILON ); + assert( fabs(lats[209] - 60.515416) < EPSILON ); + assert( fabs(lats[210] - 60.374846) < EPSILON ); + assert( fabs(lats[211] - 60.234276) < EPSILON ); + assert( fabs(lats[212] - 60.093706) < EPSILON ); + assert( fabs(lats[213] - 59.953136) < EPSILON ); + assert( fabs(lats[214] - 59.812566) < EPSILON ); + assert( fabs(lats[215] - 59.671996) < EPSILON ); + assert( fabs(lats[216] - 59.531426) < EPSILON ); + assert( fabs(lats[217] - 59.390856) < EPSILON ); + assert( fabs(lats[218] - 59.250286) < EPSILON ); + assert( fabs(lats[219] - 59.109715) < EPSILON ); + assert( fabs(lats[220] - 58.969145) < EPSILON ); + assert( fabs(lats[221] - 58.828575) < EPSILON ); + assert( fabs(lats[222] - 58.688005) < EPSILON ); + assert( fabs(lats[223] - 58.547435) < EPSILON ); + assert( fabs(lats[224] - 58.406865) < EPSILON ); + assert( fabs(lats[225] - 58.266295) < EPSILON ); + assert( fabs(lats[226] - 58.125725) < EPSILON ); + assert( fabs(lats[227] - 57.985155) < EPSILON ); + assert( fabs(lats[228] - 57.844585) < EPSILON ); + assert( fabs(lats[229] - 57.704015) < EPSILON ); + assert( fabs(lats[230] - 57.563445) < EPSILON ); + assert( fabs(lats[231] - 57.422875) < EPSILON ); + assert( fabs(lats[232] - 57.282305) < EPSILON ); + assert( fabs(lats[233] - 57.141735) < EPSILON ); + assert( fabs(lats[234] - 57.001165) < EPSILON ); + assert( fabs(lats[235] - 56.860595) < EPSILON ); + assert( fabs(lats[236] - 56.720025) < EPSILON ); + assert( fabs(lats[237] - 56.579455) < EPSILON ); + assert( fabs(lats[238] - 56.438884) < EPSILON ); + assert( fabs(lats[239] - 56.298314) < EPSILON ); + assert( fabs(lats[240] - 56.157744) < EPSILON ); + assert( fabs(lats[241] - 56.017174) < EPSILON ); + assert( fabs(lats[242] - 55.876604) < EPSILON ); + assert( fabs(lats[243] - 55.736034) < EPSILON ); + assert( fabs(lats[244] - 55.595464) < EPSILON ); + assert( fabs(lats[245] - 55.454894) < EPSILON ); + assert( fabs(lats[246] - 55.314324) < EPSILON ); + assert( fabs(lats[247] - 55.173754) < EPSILON ); + assert( fabs(lats[248] - 55.033184) < EPSILON ); + assert( fabs(lats[249] - 54.892614) < EPSILON ); + assert( fabs(lats[250] - 54.752044) < EPSILON ); + assert( fabs(lats[251] - 54.611474) < EPSILON ); + assert( fabs(lats[252] - 54.470904) < EPSILON ); + assert( fabs(lats[253] - 54.330334) < EPSILON ); + assert( fabs(lats[254] - 54.189764) < EPSILON ); + assert( fabs(lats[255] - 54.049194) < EPSILON ); + assert( fabs(lats[256] - 53.908623) < EPSILON ); + assert( fabs(lats[257] - 53.768053) < EPSILON ); + assert( fabs(lats[258] - 53.627483) < EPSILON ); + assert( fabs(lats[259] - 53.486913) < EPSILON ); + assert( fabs(lats[260] - 53.346343) < EPSILON ); + assert( fabs(lats[261] - 53.205773) < EPSILON ); + assert( fabs(lats[262] - 53.065203) < EPSILON ); + assert( fabs(lats[263] - 52.924633) < EPSILON ); + assert( fabs(lats[264] - 52.784063) < EPSILON ); + assert( fabs(lats[265] - 52.643493) < EPSILON ); + assert( fabs(lats[266] - 52.502923) < EPSILON ); + assert( fabs(lats[267] - 52.362353) < EPSILON ); + assert( fabs(lats[268] - 52.221783) < EPSILON ); + assert( fabs(lats[269] - 52.081213) < EPSILON ); + assert( fabs(lats[270] - 51.940643) < EPSILON ); + assert( fabs(lats[271] - 51.800073) < EPSILON ); + assert( fabs(lats[272] - 51.659502) < EPSILON ); + assert( fabs(lats[273] - 51.518932) < EPSILON ); + assert( fabs(lats[274] - 51.378362) < EPSILON ); + assert( fabs(lats[275] - 51.237792) < EPSILON ); + assert( fabs(lats[276] - 51.097222) < EPSILON ); + assert( fabs(lats[277] - 50.956652) < EPSILON ); + assert( fabs(lats[278] - 50.816082) < EPSILON ); + assert( fabs(lats[279] - 50.675512) < EPSILON ); + assert( fabs(lats[280] - 50.534942) < EPSILON ); + assert( fabs(lats[281] - 50.394372) < EPSILON ); + assert( fabs(lats[282] - 50.253802) < EPSILON ); + assert( fabs(lats[283] - 50.113232) < EPSILON ); + assert( fabs(lats[284] - 49.972662) < EPSILON ); + assert( fabs(lats[285] - 49.832092) < EPSILON ); + assert( fabs(lats[286] - 49.691522) < EPSILON ); + assert( fabs(lats[287] - 49.550952) < EPSILON ); + assert( fabs(lats[288] - 49.410381) < EPSILON ); + assert( fabs(lats[289] - 49.269811) < EPSILON ); + assert( fabs(lats[290] - 49.129241) < EPSILON ); + assert( fabs(lats[291] - 48.988671) < EPSILON ); + assert( fabs(lats[292] - 48.848101) < EPSILON ); + assert( fabs(lats[293] - 48.707531) < EPSILON ); + assert( fabs(lats[294] - 48.566961) < EPSILON ); + assert( fabs(lats[295] - 48.426391) < EPSILON ); + assert( fabs(lats[296] - 48.285821) < EPSILON ); + assert( fabs(lats[297] - 48.145251) < EPSILON ); + assert( fabs(lats[298] - 48.004681) < EPSILON ); + assert( fabs(lats[299] - 47.864111) < EPSILON ); + assert( fabs(lats[300] - 47.723541) < EPSILON ); + assert( fabs(lats[301] - 47.582971) < EPSILON ); + assert( fabs(lats[302] - 47.442401) < EPSILON ); + assert( fabs(lats[303] - 47.301830) < EPSILON ); + assert( fabs(lats[304] - 47.161260) < EPSILON ); + assert( fabs(lats[305] - 47.020690) < EPSILON ); + assert( fabs(lats[306] - 46.880120) < EPSILON ); + assert( fabs(lats[307] - 46.739550) < EPSILON ); + assert( fabs(lats[308] - 46.598980) < EPSILON ); + assert( fabs(lats[309] - 46.458410) < EPSILON ); + assert( fabs(lats[310] - 46.317840) < EPSILON ); + assert( fabs(lats[311] - 46.177270) < EPSILON ); + assert( fabs(lats[312] - 46.036700) < EPSILON ); + assert( fabs(lats[313] - 45.896130) < EPSILON ); + assert( fabs(lats[314] - 45.755560) < EPSILON ); + assert( fabs(lats[315] - 45.614990) < EPSILON ); + assert( fabs(lats[316] - 45.474420) < EPSILON ); + assert( fabs(lats[317] - 45.333850) < EPSILON ); + assert( fabs(lats[318] - 45.193279) < EPSILON ); + assert( fabs(lats[319] - 45.052709) < EPSILON ); + assert( fabs(lats[320] - 44.912139) < EPSILON ); + assert( fabs(lats[321] - 44.771569) < EPSILON ); + assert( fabs(lats[322] - 44.630999) < EPSILON ); + assert( fabs(lats[323] - 44.490429) < EPSILON ); + assert( fabs(lats[324] - 44.349859) < EPSILON ); + assert( fabs(lats[325] - 44.209289) < EPSILON ); + assert( fabs(lats[326] - 44.068719) < EPSILON ); + assert( fabs(lats[327] - 43.928149) < EPSILON ); + assert( fabs(lats[328] - 43.787579) < EPSILON ); + assert( fabs(lats[329] - 43.647009) < EPSILON ); + assert( fabs(lats[330] - 43.506439) < EPSILON ); + assert( fabs(lats[331] - 43.365869) < EPSILON ); + assert( fabs(lats[332] - 43.225299) < EPSILON ); + assert( fabs(lats[333] - 43.084728) < EPSILON ); + assert( fabs(lats[334] - 42.944158) < EPSILON ); + assert( fabs(lats[335] - 42.803588) < EPSILON ); + assert( fabs(lats[336] - 42.663018) < EPSILON ); + assert( fabs(lats[337] - 42.522448) < EPSILON ); + assert( fabs(lats[338] - 42.381878) < EPSILON ); + assert( fabs(lats[339] - 42.241308) < EPSILON ); + assert( fabs(lats[340] - 42.100738) < EPSILON ); + assert( fabs(lats[341] - 41.960168) < EPSILON ); + assert( fabs(lats[342] - 41.819598) < EPSILON ); + assert( fabs(lats[343] - 41.679028) < EPSILON ); + assert( fabs(lats[344] - 41.538458) < EPSILON ); + assert( fabs(lats[345] - 41.397888) < EPSILON ); + assert( fabs(lats[346] - 41.257318) < EPSILON ); + assert( fabs(lats[347] - 41.116747) < EPSILON ); + assert( fabs(lats[348] - 40.976177) < EPSILON ); + assert( fabs(lats[349] - 40.835607) < EPSILON ); + assert( fabs(lats[350] - 40.695037) < EPSILON ); + assert( fabs(lats[351] - 40.554467) < EPSILON ); + assert( fabs(lats[352] - 40.413897) < EPSILON ); + assert( fabs(lats[353] - 40.273327) < EPSILON ); + assert( fabs(lats[354] - 40.132757) < EPSILON ); + assert( fabs(lats[355] - 39.992187) < EPSILON ); + assert( fabs(lats[356] - 39.851617) < EPSILON ); + assert( fabs(lats[357] - 39.711047) < EPSILON ); + assert( fabs(lats[358] - 39.570477) < EPSILON ); + assert( fabs(lats[359] - 39.429907) < EPSILON ); + assert( fabs(lats[360] - 39.289337) < EPSILON ); + assert( fabs(lats[361] - 39.148766) < EPSILON ); + assert( fabs(lats[362] - 39.008196) < EPSILON ); + assert( fabs(lats[363] - 38.867626) < EPSILON ); + assert( fabs(lats[364] - 38.727056) < EPSILON ); + assert( fabs(lats[365] - 38.586486) < EPSILON ); + assert( fabs(lats[366] - 38.445916) < EPSILON ); + assert( fabs(lats[367] - 38.305346) < EPSILON ); + assert( fabs(lats[368] - 38.164776) < EPSILON ); + assert( fabs(lats[369] - 38.024206) < EPSILON ); + assert( fabs(lats[370] - 37.883636) < EPSILON ); + assert( fabs(lats[371] - 37.743066) < EPSILON ); + assert( fabs(lats[372] - 37.602496) < EPSILON ); + assert( fabs(lats[373] - 37.461926) < EPSILON ); + assert( fabs(lats[374] - 37.321356) < EPSILON ); + assert( fabs(lats[375] - 37.180785) < EPSILON ); + assert( fabs(lats[376] - 37.040215) < EPSILON ); + assert( fabs(lats[377] - 36.899645) < EPSILON ); + assert( fabs(lats[378] - 36.759075) < EPSILON ); + assert( fabs(lats[379] - 36.618505) < EPSILON ); + assert( fabs(lats[380] - 36.477935) < EPSILON ); + assert( fabs(lats[381] - 36.337365) < EPSILON ); + assert( fabs(lats[382] - 36.196795) < EPSILON ); + assert( fabs(lats[383] - 36.056225) < EPSILON ); + assert( fabs(lats[384] - 35.915655) < EPSILON ); + assert( fabs(lats[385] - 35.775085) < EPSILON ); + assert( fabs(lats[386] - 35.634515) < EPSILON ); + assert( fabs(lats[387] - 35.493945) < EPSILON ); + assert( fabs(lats[388] - 35.353374) < EPSILON ); + assert( fabs(lats[389] - 35.212804) < EPSILON ); + assert( fabs(lats[390] - 35.072234) < EPSILON ); + assert( fabs(lats[391] - 34.931664) < EPSILON ); + assert( fabs(lats[392] - 34.791094) < EPSILON ); + assert( fabs(lats[393] - 34.650524) < EPSILON ); + assert( fabs(lats[394] - 34.509954) < EPSILON ); + assert( fabs(lats[395] - 34.369384) < EPSILON ); + assert( fabs(lats[396] - 34.228814) < EPSILON ); + assert( fabs(lats[397] - 34.088244) < EPSILON ); + assert( fabs(lats[398] - 33.947674) < EPSILON ); + assert( fabs(lats[399] - 33.807104) < EPSILON ); + assert( fabs(lats[400] - 33.666534) < EPSILON ); + assert( fabs(lats[401] - 33.525964) < EPSILON ); + assert( fabs(lats[402] - 33.385393) < EPSILON ); + assert( fabs(lats[403] - 33.244823) < EPSILON ); + assert( fabs(lats[404] - 33.104253) < EPSILON ); + assert( fabs(lats[405] - 32.963683) < EPSILON ); + assert( fabs(lats[406] - 32.823113) < EPSILON ); + assert( fabs(lats[407] - 32.682543) < EPSILON ); + assert( fabs(lats[408] - 32.541973) < EPSILON ); + assert( fabs(lats[409] - 32.401403) < EPSILON ); + assert( fabs(lats[410] - 32.260833) < EPSILON ); + assert( fabs(lats[411] - 32.120263) < EPSILON ); + assert( fabs(lats[412] - 31.979693) < EPSILON ); + assert( fabs(lats[413] - 31.839123) < EPSILON ); + assert( fabs(lats[414] - 31.698553) < EPSILON ); + assert( fabs(lats[415] - 31.557982) < EPSILON ); + assert( fabs(lats[416] - 31.417412) < EPSILON ); + assert( fabs(lats[417] - 31.276842) < EPSILON ); + assert( fabs(lats[418] - 31.136272) < EPSILON ); + assert( fabs(lats[419] - 30.995702) < EPSILON ); + assert( fabs(lats[420] - 30.855132) < EPSILON ); + assert( fabs(lats[421] - 30.714562) < EPSILON ); + assert( fabs(lats[422] - 30.573992) < EPSILON ); + assert( fabs(lats[423] - 30.433422) < EPSILON ); + assert( fabs(lats[424] - 30.292852) < EPSILON ); + assert( fabs(lats[425] - 30.152282) < EPSILON ); + assert( fabs(lats[426] - 30.011712) < EPSILON ); + assert( fabs(lats[427] - 29.871142) < EPSILON ); + assert( fabs(lats[428] - 29.730572) < EPSILON ); + assert( fabs(lats[429] - 29.590001) < EPSILON ); + assert( fabs(lats[430] - 29.449431) < EPSILON ); + assert( fabs(lats[431] - 29.308861) < EPSILON ); + assert( fabs(lats[432] - 29.168291) < EPSILON ); + assert( fabs(lats[433] - 29.027721) < EPSILON ); + assert( fabs(lats[434] - 28.887151) < EPSILON ); + assert( fabs(lats[435] - 28.746581) < EPSILON ); + assert( fabs(lats[436] - 28.606011) < EPSILON ); + assert( fabs(lats[437] - 28.465441) < EPSILON ); + assert( fabs(lats[438] - 28.324871) < EPSILON ); + assert( fabs(lats[439] - 28.184301) < EPSILON ); + assert( fabs(lats[440] - 28.043731) < EPSILON ); + assert( fabs(lats[441] - 27.903161) < EPSILON ); + assert( fabs(lats[442] - 27.762590) < EPSILON ); + assert( fabs(lats[443] - 27.622020) < EPSILON ); + assert( fabs(lats[444] - 27.481450) < EPSILON ); + assert( fabs(lats[445] - 27.340880) < EPSILON ); + assert( fabs(lats[446] - 27.200310) < EPSILON ); + assert( fabs(lats[447] - 27.059740) < EPSILON ); + assert( fabs(lats[448] - 26.919170) < EPSILON ); + assert( fabs(lats[449] - 26.778600) < EPSILON ); + assert( fabs(lats[450] - 26.638030) < EPSILON ); + assert( fabs(lats[451] - 26.497460) < EPSILON ); + assert( fabs(lats[452] - 26.356890) < EPSILON ); + assert( fabs(lats[453] - 26.216320) < EPSILON ); + assert( fabs(lats[454] - 26.075750) < EPSILON ); + assert( fabs(lats[455] - 25.935179) < EPSILON ); + assert( fabs(lats[456] - 25.794609) < EPSILON ); + assert( fabs(lats[457] - 25.654039) < EPSILON ); + assert( fabs(lats[458] - 25.513469) < EPSILON ); + assert( fabs(lats[459] - 25.372899) < EPSILON ); + assert( fabs(lats[460] - 25.232329) < EPSILON ); + assert( fabs(lats[461] - 25.091759) < EPSILON ); + assert( fabs(lats[462] - 24.951189) < EPSILON ); + assert( fabs(lats[463] - 24.810619) < EPSILON ); + assert( fabs(lats[464] - 24.670049) < EPSILON ); + assert( fabs(lats[465] - 24.529479) < EPSILON ); + assert( fabs(lats[466] - 24.388909) < EPSILON ); + assert( fabs(lats[467] - 24.248339) < EPSILON ); + assert( fabs(lats[468] - 24.107768) < EPSILON ); + assert( fabs(lats[469] - 23.967198) < EPSILON ); + assert( fabs(lats[470] - 23.826628) < EPSILON ); + assert( fabs(lats[471] - 23.686058) < EPSILON ); + assert( fabs(lats[472] - 23.545488) < EPSILON ); + assert( fabs(lats[473] - 23.404918) < EPSILON ); + assert( fabs(lats[474] - 23.264348) < EPSILON ); + assert( fabs(lats[475] - 23.123778) < EPSILON ); + assert( fabs(lats[476] - 22.983208) < EPSILON ); + assert( fabs(lats[477] - 22.842638) < EPSILON ); + assert( fabs(lats[478] - 22.702068) < EPSILON ); + assert( fabs(lats[479] - 22.561498) < EPSILON ); + assert( fabs(lats[480] - 22.420928) < EPSILON ); + assert( fabs(lats[481] - 22.280357) < EPSILON ); + assert( fabs(lats[482] - 22.139787) < EPSILON ); + assert( fabs(lats[483] - 21.999217) < EPSILON ); + assert( fabs(lats[484] - 21.858647) < EPSILON ); + assert( fabs(lats[485] - 21.718077) < EPSILON ); + assert( fabs(lats[486] - 21.577507) < EPSILON ); + assert( fabs(lats[487] - 21.436937) < EPSILON ); + assert( fabs(lats[488] - 21.296367) < EPSILON ); + assert( fabs(lats[489] - 21.155797) < EPSILON ); + assert( fabs(lats[490] - 21.015227) < EPSILON ); + assert( fabs(lats[491] - 20.874657) < EPSILON ); + assert( fabs(lats[492] - 20.734087) < EPSILON ); + assert( fabs(lats[493] - 20.593517) < EPSILON ); + assert( fabs(lats[494] - 20.452946) < EPSILON ); + assert( fabs(lats[495] - 20.312376) < EPSILON ); + assert( fabs(lats[496] - 20.171806) < EPSILON ); + assert( fabs(lats[497] - 20.031236) < EPSILON ); + assert( fabs(lats[498] - 19.890666) < EPSILON ); + assert( fabs(lats[499] - 19.750096) < EPSILON ); + assert( fabs(lats[500] - 19.609526) < EPSILON ); + assert( fabs(lats[501] - 19.468956) < EPSILON ); + assert( fabs(lats[502] - 19.328386) < EPSILON ); + assert( fabs(lats[503] - 19.187816) < EPSILON ); + assert( fabs(lats[504] - 19.047246) < EPSILON ); + assert( fabs(lats[505] - 18.906676) < EPSILON ); + assert( fabs(lats[506] - 18.766106) < EPSILON ); + assert( fabs(lats[507] - 18.625535) < EPSILON ); + assert( fabs(lats[508] - 18.484965) < EPSILON ); + assert( fabs(lats[509] - 18.344395) < EPSILON ); + assert( fabs(lats[510] - 18.203825) < EPSILON ); + assert( fabs(lats[511] - 18.063255) < EPSILON ); + assert( fabs(lats[512] - 17.922685) < EPSILON ); + assert( fabs(lats[513] - 17.782115) < EPSILON ); + assert( fabs(lats[514] - 17.641545) < EPSILON ); + assert( fabs(lats[515] - 17.500975) < EPSILON ); + assert( fabs(lats[516] - 17.360405) < EPSILON ); + assert( fabs(lats[517] - 17.219835) < EPSILON ); + assert( fabs(lats[518] - 17.079265) < EPSILON ); + assert( fabs(lats[519] - 16.938694) < EPSILON ); + assert( fabs(lats[520] - 16.798124) < EPSILON ); + assert( fabs(lats[521] - 16.657554) < EPSILON ); + assert( fabs(lats[522] - 16.516984) < EPSILON ); + assert( fabs(lats[523] - 16.376414) < EPSILON ); + assert( fabs(lats[524] - 16.235844) < EPSILON ); + assert( fabs(lats[525] - 16.095274) < EPSILON ); + assert( fabs(lats[526] - 15.954704) < EPSILON ); + assert( fabs(lats[527] - 15.814134) < EPSILON ); + assert( fabs(lats[528] - 15.673564) < EPSILON ); + assert( fabs(lats[529] - 15.532994) < EPSILON ); + assert( fabs(lats[530] - 15.392424) < EPSILON ); + assert( fabs(lats[531] - 15.251854) < EPSILON ); + assert( fabs(lats[532] - 15.111283) < EPSILON ); + assert( fabs(lats[533] - 14.970713) < EPSILON ); + assert( fabs(lats[534] - 14.830143) < EPSILON ); + assert( fabs(lats[535] - 14.689573) < EPSILON ); + assert( fabs(lats[536] - 14.549003) < EPSILON ); + assert( fabs(lats[537] - 14.408433) < EPSILON ); + assert( fabs(lats[538] - 14.267863) < EPSILON ); + assert( fabs(lats[539] - 14.127293) < EPSILON ); + assert( fabs(lats[540] - 13.986723) < EPSILON ); + assert( fabs(lats[541] - 13.846153) < EPSILON ); + assert( fabs(lats[542] - 13.705583) < EPSILON ); + assert( fabs(lats[543] - 13.565013) < EPSILON ); + assert( fabs(lats[544] - 13.424443) < EPSILON ); + assert( fabs(lats[545] - 13.283872) < EPSILON ); + assert( fabs(lats[546] - 13.143302) < EPSILON ); + assert( fabs(lats[547] - 13.002732) < EPSILON ); + assert( fabs(lats[548] - 12.862162) < EPSILON ); + assert( fabs(lats[549] - 12.721592) < EPSILON ); + assert( fabs(lats[550] - 12.581022) < EPSILON ); + assert( fabs(lats[551] - 12.440452) < EPSILON ); + assert( fabs(lats[552] - 12.299882) < EPSILON ); + assert( fabs(lats[553] - 12.159312) < EPSILON ); + assert( fabs(lats[554] - 12.018742) < EPSILON ); + assert( fabs(lats[555] - 11.878172) < EPSILON ); + assert( fabs(lats[556] - 11.737602) < EPSILON ); + assert( fabs(lats[557] - 11.597032) < EPSILON ); + assert( fabs(lats[558] - 11.456461) < EPSILON ); + assert( fabs(lats[559] - 11.315891) < EPSILON ); + assert( fabs(lats[560] - 11.175321) < EPSILON ); + assert( fabs(lats[561] - 11.034751) < EPSILON ); + assert( fabs(lats[562] - 10.894181) < EPSILON ); + assert( fabs(lats[563] - 10.753611) < EPSILON ); + assert( fabs(lats[564] - 10.613041) < EPSILON ); + assert( fabs(lats[565] - 10.472471) < EPSILON ); + assert( fabs(lats[566] - 10.331901) < EPSILON ); + assert( fabs(lats[567] - 10.191331) < EPSILON ); + assert( fabs(lats[568] - 10.050761) < EPSILON ); + assert( fabs(lats[569] - 9.910191) < EPSILON ); + assert( fabs(lats[570] - 9.769620) < EPSILON ); + assert( fabs(lats[571] - 9.629050) < EPSILON ); + assert( fabs(lats[572] - 9.488480) < EPSILON ); + assert( fabs(lats[573] - 9.347910) < EPSILON ); + assert( fabs(lats[574] - 9.207340) < EPSILON ); + assert( fabs(lats[575] - 9.066770) < EPSILON ); + assert( fabs(lats[576] - 8.926200) < EPSILON ); + assert( fabs(lats[577] - 8.785630) < EPSILON ); + assert( fabs(lats[578] - 8.645060) < EPSILON ); + assert( fabs(lats[579] - 8.504490) < EPSILON ); + assert( fabs(lats[580] - 8.363920) < EPSILON ); + assert( fabs(lats[581] - 8.223350) < EPSILON ); + assert( fabs(lats[582] - 8.082780) < EPSILON ); + assert( fabs(lats[583] - 7.942209) < EPSILON ); + assert( fabs(lats[584] - 7.801639) < EPSILON ); + assert( fabs(lats[585] - 7.661069) < EPSILON ); + assert( fabs(lats[586] - 7.520499) < EPSILON ); + assert( fabs(lats[587] - 7.379929) < EPSILON ); + assert( fabs(lats[588] - 7.239359) < EPSILON ); + assert( fabs(lats[589] - 7.098789) < EPSILON ); + assert( fabs(lats[590] - 6.958219) < EPSILON ); + assert( fabs(lats[591] - 6.817649) < EPSILON ); + assert( fabs(lats[592] - 6.677079) < EPSILON ); + assert( fabs(lats[593] - 6.536509) < EPSILON ); + assert( fabs(lats[594] - 6.395939) < EPSILON ); + assert( fabs(lats[595] - 6.255369) < EPSILON ); + assert( fabs(lats[596] - 6.114798) < EPSILON ); + assert( fabs(lats[597] - 5.974228) < EPSILON ); + assert( fabs(lats[598] - 5.833658) < EPSILON ); + assert( fabs(lats[599] - 5.693088) < EPSILON ); + assert( fabs(lats[600] - 5.552518) < EPSILON ); + assert( fabs(lats[601] - 5.411948) < EPSILON ); + assert( fabs(lats[602] - 5.271378) < EPSILON ); + assert( fabs(lats[603] - 5.130808) < EPSILON ); + assert( fabs(lats[604] - 4.990238) < EPSILON ); + assert( fabs(lats[605] - 4.849668) < EPSILON ); + assert( fabs(lats[606] - 4.709098) < EPSILON ); + assert( fabs(lats[607] - 4.568528) < EPSILON ); + assert( fabs(lats[608] - 4.427957) < EPSILON ); + assert( fabs(lats[609] - 4.287387) < EPSILON ); + assert( fabs(lats[610] - 4.146817) < EPSILON ); + assert( fabs(lats[611] - 4.006247) < EPSILON ); + assert( fabs(lats[612] - 3.865677) < EPSILON ); + assert( fabs(lats[613] - 3.725107) < EPSILON ); + assert( fabs(lats[614] - 3.584537) < EPSILON ); + assert( fabs(lats[615] - 3.443967) < EPSILON ); + assert( fabs(lats[616] - 3.303397) < EPSILON ); + assert( fabs(lats[617] - 3.162827) < EPSILON ); + assert( fabs(lats[618] - 3.022257) < EPSILON ); + assert( fabs(lats[619] - 2.881687) < EPSILON ); + assert( fabs(lats[620] - 2.741117) < EPSILON ); + assert( fabs(lats[621] - 2.600546) < EPSILON ); + assert( fabs(lats[622] - 2.459976) < EPSILON ); + assert( fabs(lats[623] - 2.319406) < EPSILON ); + assert( fabs(lats[624] - 2.178836) < EPSILON ); + assert( fabs(lats[625] - 2.038266) < EPSILON ); + assert( fabs(lats[626] - 1.897696) < EPSILON ); + assert( fabs(lats[627] - 1.757126) < EPSILON ); + assert( fabs(lats[628] - 1.616556) < EPSILON ); + assert( fabs(lats[629] - 1.475986) < EPSILON ); + assert( fabs(lats[630] - 1.335416) < EPSILON ); + assert( fabs(lats[631] - 1.194846) < EPSILON ); + assert( fabs(lats[632] - 1.054276) < EPSILON ); + assert( fabs(lats[633] - 0.913706) < EPSILON ); + assert( fabs(lats[634] - 0.773135) < EPSILON ); + assert( fabs(lats[635] - 0.632565) < EPSILON ); + assert( fabs(lats[636] - 0.491995) < EPSILON ); + assert( fabs(lats[637] - 0.351425) < EPSILON ); + assert( fabs(lats[638] - 0.210855) < EPSILON ); + assert( fabs(lats[639] - 0.070285) < EPSILON ); + assert( fabs(lats[640] - -0.070285) < EPSILON ); + assert( fabs(lats[641] - -0.210855) < EPSILON ); + assert( fabs(lats[642] - -0.351425) < EPSILON ); + assert( fabs(lats[643] - -0.491995) < EPSILON ); + assert( fabs(lats[644] - -0.632565) < EPSILON ); + assert( fabs(lats[645] - -0.773135) < EPSILON ); + assert( fabs(lats[646] - -0.913706) < EPSILON ); + assert( fabs(lats[647] - -1.054276) < EPSILON ); + assert( fabs(lats[648] - -1.194846) < EPSILON ); + assert( fabs(lats[649] - -1.335416) < EPSILON ); + assert( fabs(lats[650] - -1.475986) < EPSILON ); + assert( fabs(lats[651] - -1.616556) < EPSILON ); + assert( fabs(lats[652] - -1.757126) < EPSILON ); + assert( fabs(lats[653] - -1.897696) < EPSILON ); + assert( fabs(lats[654] - -2.038266) < EPSILON ); + assert( fabs(lats[655] - -2.178836) < EPSILON ); + assert( fabs(lats[656] - -2.319406) < EPSILON ); + assert( fabs(lats[657] - -2.459976) < EPSILON ); + assert( fabs(lats[658] - -2.600546) < EPSILON ); + assert( fabs(lats[659] - -2.741117) < EPSILON ); + assert( fabs(lats[660] - -2.881687) < EPSILON ); + assert( fabs(lats[661] - -3.022257) < EPSILON ); + assert( fabs(lats[662] - -3.162827) < EPSILON ); + assert( fabs(lats[663] - -3.303397) < EPSILON ); + assert( fabs(lats[664] - -3.443967) < EPSILON ); + assert( fabs(lats[665] - -3.584537) < EPSILON ); + assert( fabs(lats[666] - -3.725107) < EPSILON ); + assert( fabs(lats[667] - -3.865677) < EPSILON ); + assert( fabs(lats[668] - -4.006247) < EPSILON ); + assert( fabs(lats[669] - -4.146817) < EPSILON ); + assert( fabs(lats[670] - -4.287387) < EPSILON ); + assert( fabs(lats[671] - -4.427957) < EPSILON ); + assert( fabs(lats[672] - -4.568528) < EPSILON ); + assert( fabs(lats[673] - -4.709098) < EPSILON ); + assert( fabs(lats[674] - -4.849668) < EPSILON ); + assert( fabs(lats[675] - -4.990238) < EPSILON ); + assert( fabs(lats[676] - -5.130808) < EPSILON ); + assert( fabs(lats[677] - -5.271378) < EPSILON ); + assert( fabs(lats[678] - -5.411948) < EPSILON ); + assert( fabs(lats[679] - -5.552518) < EPSILON ); + assert( fabs(lats[680] - -5.693088) < EPSILON ); + assert( fabs(lats[681] - -5.833658) < EPSILON ); + assert( fabs(lats[682] - -5.974228) < EPSILON ); + assert( fabs(lats[683] - -6.114798) < EPSILON ); + assert( fabs(lats[684] - -6.255369) < EPSILON ); + assert( fabs(lats[685] - -6.395939) < EPSILON ); + assert( fabs(lats[686] - -6.536509) < EPSILON ); + assert( fabs(lats[687] - -6.677079) < EPSILON ); + assert( fabs(lats[688] - -6.817649) < EPSILON ); + assert( fabs(lats[689] - -6.958219) < EPSILON ); + assert( fabs(lats[690] - -7.098789) < EPSILON ); + assert( fabs(lats[691] - -7.239359) < EPSILON ); + assert( fabs(lats[692] - -7.379929) < EPSILON ); + assert( fabs(lats[693] - -7.520499) < EPSILON ); + assert( fabs(lats[694] - -7.661069) < EPSILON ); + assert( fabs(lats[695] - -7.801639) < EPSILON ); + assert( fabs(lats[696] - -7.942209) < EPSILON ); + assert( fabs(lats[697] - -8.082780) < EPSILON ); + assert( fabs(lats[698] - -8.223350) < EPSILON ); + assert( fabs(lats[699] - -8.363920) < EPSILON ); + assert( fabs(lats[700] - -8.504490) < EPSILON ); + assert( fabs(lats[701] - -8.645060) < EPSILON ); + assert( fabs(lats[702] - -8.785630) < EPSILON ); + assert( fabs(lats[703] - -8.926200) < EPSILON ); + assert( fabs(lats[704] - -9.066770) < EPSILON ); + assert( fabs(lats[705] - -9.207340) < EPSILON ); + assert( fabs(lats[706] - -9.347910) < EPSILON ); + assert( fabs(lats[707] - -9.488480) < EPSILON ); + assert( fabs(lats[708] - -9.629050) < EPSILON ); + assert( fabs(lats[709] - -9.769620) < EPSILON ); + assert( fabs(lats[710] - -9.910191) < EPSILON ); + assert( fabs(lats[711] - -10.050761) < EPSILON ); + assert( fabs(lats[712] - -10.191331) < EPSILON ); + assert( fabs(lats[713] - -10.331901) < EPSILON ); + assert( fabs(lats[714] - -10.472471) < EPSILON ); + assert( fabs(lats[715] - -10.613041) < EPSILON ); + assert( fabs(lats[716] - -10.753611) < EPSILON ); + assert( fabs(lats[717] - -10.894181) < EPSILON ); + assert( fabs(lats[718] - -11.034751) < EPSILON ); + assert( fabs(lats[719] - -11.175321) < EPSILON ); + assert( fabs(lats[720] - -11.315891) < EPSILON ); + assert( fabs(lats[721] - -11.456461) < EPSILON ); + assert( fabs(lats[722] - -11.597032) < EPSILON ); + assert( fabs(lats[723] - -11.737602) < EPSILON ); + assert( fabs(lats[724] - -11.878172) < EPSILON ); + assert( fabs(lats[725] - -12.018742) < EPSILON ); + assert( fabs(lats[726] - -12.159312) < EPSILON ); + assert( fabs(lats[727] - -12.299882) < EPSILON ); + assert( fabs(lats[728] - -12.440452) < EPSILON ); + assert( fabs(lats[729] - -12.581022) < EPSILON ); + assert( fabs(lats[730] - -12.721592) < EPSILON ); + assert( fabs(lats[731] - -12.862162) < EPSILON ); + assert( fabs(lats[732] - -13.002732) < EPSILON ); + assert( fabs(lats[733] - -13.143302) < EPSILON ); + assert( fabs(lats[734] - -13.283872) < EPSILON ); + assert( fabs(lats[735] - -13.424443) < EPSILON ); + assert( fabs(lats[736] - -13.565013) < EPSILON ); + assert( fabs(lats[737] - -13.705583) < EPSILON ); + assert( fabs(lats[738] - -13.846153) < EPSILON ); + assert( fabs(lats[739] - -13.986723) < EPSILON ); + assert( fabs(lats[740] - -14.127293) < EPSILON ); + assert( fabs(lats[741] - -14.267863) < EPSILON ); + assert( fabs(lats[742] - -14.408433) < EPSILON ); + assert( fabs(lats[743] - -14.549003) < EPSILON ); + assert( fabs(lats[744] - -14.689573) < EPSILON ); + assert( fabs(lats[745] - -14.830143) < EPSILON ); + assert( fabs(lats[746] - -14.970713) < EPSILON ); + assert( fabs(lats[747] - -15.111283) < EPSILON ); + assert( fabs(lats[748] - -15.251854) < EPSILON ); + assert( fabs(lats[749] - -15.392424) < EPSILON ); + assert( fabs(lats[750] - -15.532994) < EPSILON ); + assert( fabs(lats[751] - -15.673564) < EPSILON ); + assert( fabs(lats[752] - -15.814134) < EPSILON ); + assert( fabs(lats[753] - -15.954704) < EPSILON ); + assert( fabs(lats[754] - -16.095274) < EPSILON ); + assert( fabs(lats[755] - -16.235844) < EPSILON ); + assert( fabs(lats[756] - -16.376414) < EPSILON ); + assert( fabs(lats[757] - -16.516984) < EPSILON ); + assert( fabs(lats[758] - -16.657554) < EPSILON ); + assert( fabs(lats[759] - -16.798124) < EPSILON ); + assert( fabs(lats[760] - -16.938694) < EPSILON ); + assert( fabs(lats[761] - -17.079265) < EPSILON ); + assert( fabs(lats[762] - -17.219835) < EPSILON ); + assert( fabs(lats[763] - -17.360405) < EPSILON ); + assert( fabs(lats[764] - -17.500975) < EPSILON ); + assert( fabs(lats[765] - -17.641545) < EPSILON ); + assert( fabs(lats[766] - -17.782115) < EPSILON ); + assert( fabs(lats[767] - -17.922685) < EPSILON ); + assert( fabs(lats[768] - -18.063255) < EPSILON ); + assert( fabs(lats[769] - -18.203825) < EPSILON ); + assert( fabs(lats[770] - -18.344395) < EPSILON ); + assert( fabs(lats[771] - -18.484965) < EPSILON ); + assert( fabs(lats[772] - -18.625535) < EPSILON ); + assert( fabs(lats[773] - -18.766106) < EPSILON ); + assert( fabs(lats[774] - -18.906676) < EPSILON ); + assert( fabs(lats[775] - -19.047246) < EPSILON ); + assert( fabs(lats[776] - -19.187816) < EPSILON ); + assert( fabs(lats[777] - -19.328386) < EPSILON ); + assert( fabs(lats[778] - -19.468956) < EPSILON ); + assert( fabs(lats[779] - -19.609526) < EPSILON ); + assert( fabs(lats[780] - -19.750096) < EPSILON ); + assert( fabs(lats[781] - -19.890666) < EPSILON ); + assert( fabs(lats[782] - -20.031236) < EPSILON ); + assert( fabs(lats[783] - -20.171806) < EPSILON ); + assert( fabs(lats[784] - -20.312376) < EPSILON ); + assert( fabs(lats[785] - -20.452946) < EPSILON ); + assert( fabs(lats[786] - -20.593517) < EPSILON ); + assert( fabs(lats[787] - -20.734087) < EPSILON ); + assert( fabs(lats[788] - -20.874657) < EPSILON ); + assert( fabs(lats[789] - -21.015227) < EPSILON ); + assert( fabs(lats[790] - -21.155797) < EPSILON ); + assert( fabs(lats[791] - -21.296367) < EPSILON ); + assert( fabs(lats[792] - -21.436937) < EPSILON ); + assert( fabs(lats[793] - -21.577507) < EPSILON ); + assert( fabs(lats[794] - -21.718077) < EPSILON ); + assert( fabs(lats[795] - -21.858647) < EPSILON ); + assert( fabs(lats[796] - -21.999217) < EPSILON ); + assert( fabs(lats[797] - -22.139787) < EPSILON ); + assert( fabs(lats[798] - -22.280357) < EPSILON ); + assert( fabs(lats[799] - -22.420928) < EPSILON ); + assert( fabs(lats[800] - -22.561498) < EPSILON ); + assert( fabs(lats[801] - -22.702068) < EPSILON ); + assert( fabs(lats[802] - -22.842638) < EPSILON ); + assert( fabs(lats[803] - -22.983208) < EPSILON ); + assert( fabs(lats[804] - -23.123778) < EPSILON ); + assert( fabs(lats[805] - -23.264348) < EPSILON ); + assert( fabs(lats[806] - -23.404918) < EPSILON ); + assert( fabs(lats[807] - -23.545488) < EPSILON ); + assert( fabs(lats[808] - -23.686058) < EPSILON ); + assert( fabs(lats[809] - -23.826628) < EPSILON ); + assert( fabs(lats[810] - -23.967198) < EPSILON ); + assert( fabs(lats[811] - -24.107768) < EPSILON ); + assert( fabs(lats[812] - -24.248339) < EPSILON ); + assert( fabs(lats[813] - -24.388909) < EPSILON ); + assert( fabs(lats[814] - -24.529479) < EPSILON ); + assert( fabs(lats[815] - -24.670049) < EPSILON ); + assert( fabs(lats[816] - -24.810619) < EPSILON ); + assert( fabs(lats[817] - -24.951189) < EPSILON ); + assert( fabs(lats[818] - -25.091759) < EPSILON ); + assert( fabs(lats[819] - -25.232329) < EPSILON ); + assert( fabs(lats[820] - -25.372899) < EPSILON ); + assert( fabs(lats[821] - -25.513469) < EPSILON ); + assert( fabs(lats[822] - -25.654039) < EPSILON ); + assert( fabs(lats[823] - -25.794609) < EPSILON ); + assert( fabs(lats[824] - -25.935179) < EPSILON ); + assert( fabs(lats[825] - -26.075750) < EPSILON ); + assert( fabs(lats[826] - -26.216320) < EPSILON ); + assert( fabs(lats[827] - -26.356890) < EPSILON ); + assert( fabs(lats[828] - -26.497460) < EPSILON ); + assert( fabs(lats[829] - -26.638030) < EPSILON ); + assert( fabs(lats[830] - -26.778600) < EPSILON ); + assert( fabs(lats[831] - -26.919170) < EPSILON ); + assert( fabs(lats[832] - -27.059740) < EPSILON ); + assert( fabs(lats[833] - -27.200310) < EPSILON ); + assert( fabs(lats[834] - -27.340880) < EPSILON ); + assert( fabs(lats[835] - -27.481450) < EPSILON ); + assert( fabs(lats[836] - -27.622020) < EPSILON ); + assert( fabs(lats[837] - -27.762590) < EPSILON ); + assert( fabs(lats[838] - -27.903161) < EPSILON ); + assert( fabs(lats[839] - -28.043731) < EPSILON ); + assert( fabs(lats[840] - -28.184301) < EPSILON ); + assert( fabs(lats[841] - -28.324871) < EPSILON ); + assert( fabs(lats[842] - -28.465441) < EPSILON ); + assert( fabs(lats[843] - -28.606011) < EPSILON ); + assert( fabs(lats[844] - -28.746581) < EPSILON ); + assert( fabs(lats[845] - -28.887151) < EPSILON ); + assert( fabs(lats[846] - -29.027721) < EPSILON ); + assert( fabs(lats[847] - -29.168291) < EPSILON ); + assert( fabs(lats[848] - -29.308861) < EPSILON ); + assert( fabs(lats[849] - -29.449431) < EPSILON ); + assert( fabs(lats[850] - -29.590001) < EPSILON ); + assert( fabs(lats[851] - -29.730572) < EPSILON ); + assert( fabs(lats[852] - -29.871142) < EPSILON ); + assert( fabs(lats[853] - -30.011712) < EPSILON ); + assert( fabs(lats[854] - -30.152282) < EPSILON ); + assert( fabs(lats[855] - -30.292852) < EPSILON ); + assert( fabs(lats[856] - -30.433422) < EPSILON ); + assert( fabs(lats[857] - -30.573992) < EPSILON ); + assert( fabs(lats[858] - -30.714562) < EPSILON ); + assert( fabs(lats[859] - -30.855132) < EPSILON ); + assert( fabs(lats[860] - -30.995702) < EPSILON ); + assert( fabs(lats[861] - -31.136272) < EPSILON ); + assert( fabs(lats[862] - -31.276842) < EPSILON ); + assert( fabs(lats[863] - -31.417412) < EPSILON ); + assert( fabs(lats[864] - -31.557982) < EPSILON ); + assert( fabs(lats[865] - -31.698553) < EPSILON ); + assert( fabs(lats[866] - -31.839123) < EPSILON ); + assert( fabs(lats[867] - -31.979693) < EPSILON ); + assert( fabs(lats[868] - -32.120263) < EPSILON ); + assert( fabs(lats[869] - -32.260833) < EPSILON ); + assert( fabs(lats[870] - -32.401403) < EPSILON ); + assert( fabs(lats[871] - -32.541973) < EPSILON ); + assert( fabs(lats[872] - -32.682543) < EPSILON ); + assert( fabs(lats[873] - -32.823113) < EPSILON ); + assert( fabs(lats[874] - -32.963683) < EPSILON ); + assert( fabs(lats[875] - -33.104253) < EPSILON ); + assert( fabs(lats[876] - -33.244823) < EPSILON ); + assert( fabs(lats[877] - -33.385393) < EPSILON ); + assert( fabs(lats[878] - -33.525964) < EPSILON ); + assert( fabs(lats[879] - -33.666534) < EPSILON ); + assert( fabs(lats[880] - -33.807104) < EPSILON ); + assert( fabs(lats[881] - -33.947674) < EPSILON ); + assert( fabs(lats[882] - -34.088244) < EPSILON ); + assert( fabs(lats[883] - -34.228814) < EPSILON ); + assert( fabs(lats[884] - -34.369384) < EPSILON ); + assert( fabs(lats[885] - -34.509954) < EPSILON ); + assert( fabs(lats[886] - -34.650524) < EPSILON ); + assert( fabs(lats[887] - -34.791094) < EPSILON ); + assert( fabs(lats[888] - -34.931664) < EPSILON ); + assert( fabs(lats[889] - -35.072234) < EPSILON ); + assert( fabs(lats[890] - -35.212804) < EPSILON ); + assert( fabs(lats[891] - -35.353374) < EPSILON ); + assert( fabs(lats[892] - -35.493945) < EPSILON ); + assert( fabs(lats[893] - -35.634515) < EPSILON ); + assert( fabs(lats[894] - -35.775085) < EPSILON ); + assert( fabs(lats[895] - -35.915655) < EPSILON ); + assert( fabs(lats[896] - -36.056225) < EPSILON ); + assert( fabs(lats[897] - -36.196795) < EPSILON ); + assert( fabs(lats[898] - -36.337365) < EPSILON ); + assert( fabs(lats[899] - -36.477935) < EPSILON ); + assert( fabs(lats[900] - -36.618505) < EPSILON ); + assert( fabs(lats[901] - -36.759075) < EPSILON ); + assert( fabs(lats[902] - -36.899645) < EPSILON ); + assert( fabs(lats[903] - -37.040215) < EPSILON ); + assert( fabs(lats[904] - -37.180785) < EPSILON ); + assert( fabs(lats[905] - -37.321356) < EPSILON ); + assert( fabs(lats[906] - -37.461926) < EPSILON ); + assert( fabs(lats[907] - -37.602496) < EPSILON ); + assert( fabs(lats[908] - -37.743066) < EPSILON ); + assert( fabs(lats[909] - -37.883636) < EPSILON ); + assert( fabs(lats[910] - -38.024206) < EPSILON ); + assert( fabs(lats[911] - -38.164776) < EPSILON ); + assert( fabs(lats[912] - -38.305346) < EPSILON ); + assert( fabs(lats[913] - -38.445916) < EPSILON ); + assert( fabs(lats[914] - -38.586486) < EPSILON ); + assert( fabs(lats[915] - -38.727056) < EPSILON ); + assert( fabs(lats[916] - -38.867626) < EPSILON ); + assert( fabs(lats[917] - -39.008196) < EPSILON ); + assert( fabs(lats[918] - -39.148766) < EPSILON ); + assert( fabs(lats[919] - -39.289337) < EPSILON ); + assert( fabs(lats[920] - -39.429907) < EPSILON ); + assert( fabs(lats[921] - -39.570477) < EPSILON ); + assert( fabs(lats[922] - -39.711047) < EPSILON ); + assert( fabs(lats[923] - -39.851617) < EPSILON ); + assert( fabs(lats[924] - -39.992187) < EPSILON ); + assert( fabs(lats[925] - -40.132757) < EPSILON ); + assert( fabs(lats[926] - -40.273327) < EPSILON ); + assert( fabs(lats[927] - -40.413897) < EPSILON ); + assert( fabs(lats[928] - -40.554467) < EPSILON ); + assert( fabs(lats[929] - -40.695037) < EPSILON ); + assert( fabs(lats[930] - -40.835607) < EPSILON ); + assert( fabs(lats[931] - -40.976177) < EPSILON ); + assert( fabs(lats[932] - -41.116747) < EPSILON ); + assert( fabs(lats[933] - -41.257318) < EPSILON ); + assert( fabs(lats[934] - -41.397888) < EPSILON ); + assert( fabs(lats[935] - -41.538458) < EPSILON ); + assert( fabs(lats[936] - -41.679028) < EPSILON ); + assert( fabs(lats[937] - -41.819598) < EPSILON ); + assert( fabs(lats[938] - -41.960168) < EPSILON ); + assert( fabs(lats[939] - -42.100738) < EPSILON ); + assert( fabs(lats[940] - -42.241308) < EPSILON ); + assert( fabs(lats[941] - -42.381878) < EPSILON ); + assert( fabs(lats[942] - -42.522448) < EPSILON ); + assert( fabs(lats[943] - -42.663018) < EPSILON ); + assert( fabs(lats[944] - -42.803588) < EPSILON ); + assert( fabs(lats[945] - -42.944158) < EPSILON ); + assert( fabs(lats[946] - -43.084728) < EPSILON ); + assert( fabs(lats[947] - -43.225299) < EPSILON ); + assert( fabs(lats[948] - -43.365869) < EPSILON ); + assert( fabs(lats[949] - -43.506439) < EPSILON ); + assert( fabs(lats[950] - -43.647009) < EPSILON ); + assert( fabs(lats[951] - -43.787579) < EPSILON ); + assert( fabs(lats[952] - -43.928149) < EPSILON ); + assert( fabs(lats[953] - -44.068719) < EPSILON ); + assert( fabs(lats[954] - -44.209289) < EPSILON ); + assert( fabs(lats[955] - -44.349859) < EPSILON ); + assert( fabs(lats[956] - -44.490429) < EPSILON ); + assert( fabs(lats[957] - -44.630999) < EPSILON ); + assert( fabs(lats[958] - -44.771569) < EPSILON ); + assert( fabs(lats[959] - -44.912139) < EPSILON ); + assert( fabs(lats[960] - -45.052709) < EPSILON ); + assert( fabs(lats[961] - -45.193279) < EPSILON ); + assert( fabs(lats[962] - -45.333850) < EPSILON ); + assert( fabs(lats[963] - -45.474420) < EPSILON ); + assert( fabs(lats[964] - -45.614990) < EPSILON ); + assert( fabs(lats[965] - -45.755560) < EPSILON ); + assert( fabs(lats[966] - -45.896130) < EPSILON ); + assert( fabs(lats[967] - -46.036700) < EPSILON ); + assert( fabs(lats[968] - -46.177270) < EPSILON ); + assert( fabs(lats[969] - -46.317840) < EPSILON ); + assert( fabs(lats[970] - -46.458410) < EPSILON ); + assert( fabs(lats[971] - -46.598980) < EPSILON ); + assert( fabs(lats[972] - -46.739550) < EPSILON ); + assert( fabs(lats[973] - -46.880120) < EPSILON ); + assert( fabs(lats[974] - -47.020690) < EPSILON ); + assert( fabs(lats[975] - -47.161260) < EPSILON ); + assert( fabs(lats[976] - -47.301830) < EPSILON ); + assert( fabs(lats[977] - -47.442401) < EPSILON ); + assert( fabs(lats[978] - -47.582971) < EPSILON ); + assert( fabs(lats[979] - -47.723541) < EPSILON ); + assert( fabs(lats[980] - -47.864111) < EPSILON ); + assert( fabs(lats[981] - -48.004681) < EPSILON ); + assert( fabs(lats[982] - -48.145251) < EPSILON ); + assert( fabs(lats[983] - -48.285821) < EPSILON ); + assert( fabs(lats[984] - -48.426391) < EPSILON ); + assert( fabs(lats[985] - -48.566961) < EPSILON ); + assert( fabs(lats[986] - -48.707531) < EPSILON ); + assert( fabs(lats[987] - -48.848101) < EPSILON ); + assert( fabs(lats[988] - -48.988671) < EPSILON ); + assert( fabs(lats[989] - -49.129241) < EPSILON ); + assert( fabs(lats[990] - -49.269811) < EPSILON ); + assert( fabs(lats[991] - -49.410381) < EPSILON ); + assert( fabs(lats[992] - -49.550952) < EPSILON ); + assert( fabs(lats[993] - -49.691522) < EPSILON ); + assert( fabs(lats[994] - -49.832092) < EPSILON ); + assert( fabs(lats[995] - -49.972662) < EPSILON ); + assert( fabs(lats[996] - -50.113232) < EPSILON ); + assert( fabs(lats[997] - -50.253802) < EPSILON ); + assert( fabs(lats[998] - -50.394372) < EPSILON ); + assert( fabs(lats[999] - -50.534942) < EPSILON ); + assert( fabs(lats[1000] - -50.675512) < EPSILON ); + assert( fabs(lats[1001] - -50.816082) < EPSILON ); + assert( fabs(lats[1002] - -50.956652) < EPSILON ); + assert( fabs(lats[1003] - -51.097222) < EPSILON ); + assert( fabs(lats[1004] - -51.237792) < EPSILON ); + assert( fabs(lats[1005] - -51.378362) < EPSILON ); + assert( fabs(lats[1006] - -51.518932) < EPSILON ); + assert( fabs(lats[1007] - -51.659502) < EPSILON ); + assert( fabs(lats[1008] - -51.800073) < EPSILON ); + assert( fabs(lats[1009] - -51.940643) < EPSILON ); + assert( fabs(lats[1010] - -52.081213) < EPSILON ); + assert( fabs(lats[1011] - -52.221783) < EPSILON ); + assert( fabs(lats[1012] - -52.362353) < EPSILON ); + assert( fabs(lats[1013] - -52.502923) < EPSILON ); + assert( fabs(lats[1014] - -52.643493) < EPSILON ); + assert( fabs(lats[1015] - -52.784063) < EPSILON ); + assert( fabs(lats[1016] - -52.924633) < EPSILON ); + assert( fabs(lats[1017] - -53.065203) < EPSILON ); + assert( fabs(lats[1018] - -53.205773) < EPSILON ); + assert( fabs(lats[1019] - -53.346343) < EPSILON ); + assert( fabs(lats[1020] - -53.486913) < EPSILON ); + assert( fabs(lats[1021] - -53.627483) < EPSILON ); + assert( fabs(lats[1022] - -53.768053) < EPSILON ); + assert( fabs(lats[1023] - -53.908623) < EPSILON ); + assert( fabs(lats[1024] - -54.049194) < EPSILON ); + assert( fabs(lats[1025] - -54.189764) < EPSILON ); + assert( fabs(lats[1026] - -54.330334) < EPSILON ); + assert( fabs(lats[1027] - -54.470904) < EPSILON ); + assert( fabs(lats[1028] - -54.611474) < EPSILON ); + assert( fabs(lats[1029] - -54.752044) < EPSILON ); + assert( fabs(lats[1030] - -54.892614) < EPSILON ); + assert( fabs(lats[1031] - -55.033184) < EPSILON ); + assert( fabs(lats[1032] - -55.173754) < EPSILON ); + assert( fabs(lats[1033] - -55.314324) < EPSILON ); + assert( fabs(lats[1034] - -55.454894) < EPSILON ); + assert( fabs(lats[1035] - -55.595464) < EPSILON ); + assert( fabs(lats[1036] - -55.736034) < EPSILON ); + assert( fabs(lats[1037] - -55.876604) < EPSILON ); + assert( fabs(lats[1038] - -56.017174) < EPSILON ); + assert( fabs(lats[1039] - -56.157744) < EPSILON ); + assert( fabs(lats[1040] - -56.298314) < EPSILON ); + assert( fabs(lats[1041] - -56.438884) < EPSILON ); + assert( fabs(lats[1042] - -56.579455) < EPSILON ); + assert( fabs(lats[1043] - -56.720025) < EPSILON ); + assert( fabs(lats[1044] - -56.860595) < EPSILON ); + assert( fabs(lats[1045] - -57.001165) < EPSILON ); + assert( fabs(lats[1046] - -57.141735) < EPSILON ); + assert( fabs(lats[1047] - -57.282305) < EPSILON ); + assert( fabs(lats[1048] - -57.422875) < EPSILON ); + assert( fabs(lats[1049] - -57.563445) < EPSILON ); + assert( fabs(lats[1050] - -57.704015) < EPSILON ); + assert( fabs(lats[1051] - -57.844585) < EPSILON ); + assert( fabs(lats[1052] - -57.985155) < EPSILON ); + assert( fabs(lats[1053] - -58.125725) < EPSILON ); + assert( fabs(lats[1054] - -58.266295) < EPSILON ); + assert( fabs(lats[1055] - -58.406865) < EPSILON ); + assert( fabs(lats[1056] - -58.547435) < EPSILON ); + assert( fabs(lats[1057] - -58.688005) < EPSILON ); + assert( fabs(lats[1058] - -58.828575) < EPSILON ); + assert( fabs(lats[1059] - -58.969145) < EPSILON ); + assert( fabs(lats[1060] - -59.109715) < EPSILON ); + assert( fabs(lats[1061] - -59.250286) < EPSILON ); + assert( fabs(lats[1062] - -59.390856) < EPSILON ); + assert( fabs(lats[1063] - -59.531426) < EPSILON ); + assert( fabs(lats[1064] - -59.671996) < EPSILON ); + assert( fabs(lats[1065] - -59.812566) < EPSILON ); + assert( fabs(lats[1066] - -59.953136) < EPSILON ); + assert( fabs(lats[1067] - -60.093706) < EPSILON ); + assert( fabs(lats[1068] - -60.234276) < EPSILON ); + assert( fabs(lats[1069] - -60.374846) < EPSILON ); + assert( fabs(lats[1070] - -60.515416) < EPSILON ); + assert( fabs(lats[1071] - -60.655986) < EPSILON ); + assert( fabs(lats[1072] - -60.796556) < EPSILON ); + assert( fabs(lats[1073] - -60.937126) < EPSILON ); + assert( fabs(lats[1074] - -61.077696) < EPSILON ); + assert( fabs(lats[1075] - -61.218266) < EPSILON ); + assert( fabs(lats[1076] - -61.358836) < EPSILON ); + assert( fabs(lats[1077] - -61.499406) < EPSILON ); + assert( fabs(lats[1078] - -61.639976) < EPSILON ); + assert( fabs(lats[1079] - -61.780546) < EPSILON ); + assert( fabs(lats[1080] - -61.921116) < EPSILON ); + assert( fabs(lats[1081] - -62.061686) < EPSILON ); + assert( fabs(lats[1082] - -62.202256) < EPSILON ); + assert( fabs(lats[1083] - -62.342826) < EPSILON ); + assert( fabs(lats[1084] - -62.483397) < EPSILON ); + assert( fabs(lats[1085] - -62.623967) < EPSILON ); + assert( fabs(lats[1086] - -62.764537) < EPSILON ); + assert( fabs(lats[1087] - -62.905107) < EPSILON ); + assert( fabs(lats[1088] - -63.045677) < EPSILON ); + assert( fabs(lats[1089] - -63.186247) < EPSILON ); + assert( fabs(lats[1090] - -63.326817) < EPSILON ); + assert( fabs(lats[1091] - -63.467387) < EPSILON ); + assert( fabs(lats[1092] - -63.607957) < EPSILON ); + assert( fabs(lats[1093] - -63.748527) < EPSILON ); + assert( fabs(lats[1094] - -63.889097) < EPSILON ); + assert( fabs(lats[1095] - -64.029667) < EPSILON ); + assert( fabs(lats[1096] - -64.170237) < EPSILON ); + assert( fabs(lats[1097] - -64.310807) < EPSILON ); + assert( fabs(lats[1098] - -64.451377) < EPSILON ); + assert( fabs(lats[1099] - -64.591947) < EPSILON ); + assert( fabs(lats[1100] - -64.732517) < EPSILON ); + assert( fabs(lats[1101] - -64.873087) < EPSILON ); + assert( fabs(lats[1102] - -65.013657) < EPSILON ); + assert( fabs(lats[1103] - -65.154227) < EPSILON ); + assert( fabs(lats[1104] - -65.294797) < EPSILON ); + assert( fabs(lats[1105] - -65.435367) < EPSILON ); + assert( fabs(lats[1106] - -65.575937) < EPSILON ); + assert( fabs(lats[1107] - -65.716507) < EPSILON ); + assert( fabs(lats[1108] - -65.857077) < EPSILON ); + assert( fabs(lats[1109] - -65.997647) < EPSILON ); + assert( fabs(lats[1110] - -66.138217) < EPSILON ); + assert( fabs(lats[1111] - -66.278787) < EPSILON ); + assert( fabs(lats[1112] - -66.419357) < EPSILON ); + assert( fabs(lats[1113] - -66.559927) < EPSILON ); + assert( fabs(lats[1114] - -66.700497) < EPSILON ); + assert( fabs(lats[1115] - -66.841067) < EPSILON ); + assert( fabs(lats[1116] - -66.981638) < EPSILON ); + assert( fabs(lats[1117] - -67.122208) < EPSILON ); + assert( fabs(lats[1118] - -67.262778) < EPSILON ); + assert( fabs(lats[1119] - -67.403348) < EPSILON ); + assert( fabs(lats[1120] - -67.543918) < EPSILON ); + assert( fabs(lats[1121] - -67.684488) < EPSILON ); + assert( fabs(lats[1122] - -67.825058) < EPSILON ); + assert( fabs(lats[1123] - -67.965628) < EPSILON ); + assert( fabs(lats[1124] - -68.106198) < EPSILON ); + assert( fabs(lats[1125] - -68.246768) < EPSILON ); + assert( fabs(lats[1126] - -68.387338) < EPSILON ); + assert( fabs(lats[1127] - -68.527908) < EPSILON ); + assert( fabs(lats[1128] - -68.668478) < EPSILON ); + assert( fabs(lats[1129] - -68.809048) < EPSILON ); + assert( fabs(lats[1130] - -68.949618) < EPSILON ); + assert( fabs(lats[1131] - -69.090188) < EPSILON ); + assert( fabs(lats[1132] - -69.230758) < EPSILON ); + assert( fabs(lats[1133] - -69.371328) < EPSILON ); + assert( fabs(lats[1134] - -69.511898) < EPSILON ); + assert( fabs(lats[1135] - -69.652468) < EPSILON ); + assert( fabs(lats[1136] - -69.793038) < EPSILON ); + assert( fabs(lats[1137] - -69.933608) < EPSILON ); + assert( fabs(lats[1138] - -70.074178) < EPSILON ); + assert( fabs(lats[1139] - -70.214748) < EPSILON ); + assert( fabs(lats[1140] - -70.355318) < EPSILON ); + assert( fabs(lats[1141] - -70.495888) < EPSILON ); + assert( fabs(lats[1142] - -70.636458) < EPSILON ); + assert( fabs(lats[1143] - -70.777028) < EPSILON ); + assert( fabs(lats[1144] - -70.917598) < EPSILON ); + assert( fabs(lats[1145] - -71.058168) < EPSILON ); + assert( fabs(lats[1146] - -71.198738) < EPSILON ); + assert( fabs(lats[1147] - -71.339308) < EPSILON ); + assert( fabs(lats[1148] - -71.479878) < EPSILON ); + assert( fabs(lats[1149] - -71.620448) < EPSILON ); + assert( fabs(lats[1150] - -71.761018) < EPSILON ); + assert( fabs(lats[1151] - -71.901588) < EPSILON ); + assert( fabs(lats[1152] - -72.042158) < EPSILON ); + assert( fabs(lats[1153] - -72.182728) < EPSILON ); + assert( fabs(lats[1154] - -72.323298) < EPSILON ); + assert( fabs(lats[1155] - -72.463867) < EPSILON ); + assert( fabs(lats[1156] - -72.604437) < EPSILON ); + assert( fabs(lats[1157] - -72.745007) < EPSILON ); + assert( fabs(lats[1158] - -72.885577) < EPSILON ); + assert( fabs(lats[1159] - -73.026147) < EPSILON ); + assert( fabs(lats[1160] - -73.166717) < EPSILON ); + assert( fabs(lats[1161] - -73.307287) < EPSILON ); + assert( fabs(lats[1162] - -73.447857) < EPSILON ); + assert( fabs(lats[1163] - -73.588427) < EPSILON ); + assert( fabs(lats[1164] - -73.728997) < EPSILON ); + assert( fabs(lats[1165] - -73.869567) < EPSILON ); + assert( fabs(lats[1166] - -74.010137) < EPSILON ); + assert( fabs(lats[1167] - -74.150707) < EPSILON ); + assert( fabs(lats[1168] - -74.291277) < EPSILON ); + assert( fabs(lats[1169] - -74.431847) < EPSILON ); + assert( fabs(lats[1170] - -74.572417) < EPSILON ); + assert( fabs(lats[1171] - -74.712987) < EPSILON ); + assert( fabs(lats[1172] - -74.853557) < EPSILON ); + assert( fabs(lats[1173] - -74.994127) < EPSILON ); + assert( fabs(lats[1174] - -75.134697) < EPSILON ); + assert( fabs(lats[1175] - -75.275266) < EPSILON ); + assert( fabs(lats[1176] - -75.415836) < EPSILON ); + assert( fabs(lats[1177] - -75.556406) < EPSILON ); + assert( fabs(lats[1178] - -75.696976) < EPSILON ); + assert( fabs(lats[1179] - -75.837546) < EPSILON ); + assert( fabs(lats[1180] - -75.978116) < EPSILON ); + assert( fabs(lats[1181] - -76.118686) < EPSILON ); + assert( fabs(lats[1182] - -76.259256) < EPSILON ); + assert( fabs(lats[1183] - -76.399826) < EPSILON ); + assert( fabs(lats[1184] - -76.540396) < EPSILON ); + assert( fabs(lats[1185] - -76.680966) < EPSILON ); + assert( fabs(lats[1186] - -76.821535) < EPSILON ); + assert( fabs(lats[1187] - -76.962105) < EPSILON ); + assert( fabs(lats[1188] - -77.102675) < EPSILON ); + assert( fabs(lats[1189] - -77.243245) < EPSILON ); + assert( fabs(lats[1190] - -77.383815) < EPSILON ); + assert( fabs(lats[1191] - -77.524385) < EPSILON ); + assert( fabs(lats[1192] - -77.664955) < EPSILON ); + assert( fabs(lats[1193] - -77.805524) < EPSILON ); + assert( fabs(lats[1194] - -77.946094) < EPSILON ); + assert( fabs(lats[1195] - -78.086664) < EPSILON ); + assert( fabs(lats[1196] - -78.227234) < EPSILON ); + assert( fabs(lats[1197] - -78.367804) < EPSILON ); + assert( fabs(lats[1198] - -78.508374) < EPSILON ); + assert( fabs(lats[1199] - -78.648943) < EPSILON ); + assert( fabs(lats[1200] - -78.789513) < EPSILON ); + assert( fabs(lats[1201] - -78.930083) < EPSILON ); + assert( fabs(lats[1202] - -79.070653) < EPSILON ); + assert( fabs(lats[1203] - -79.211223) < EPSILON ); + assert( fabs(lats[1204] - -79.351792) < EPSILON ); + assert( fabs(lats[1205] - -79.492362) < EPSILON ); + assert( fabs(lats[1206] - -79.632932) < EPSILON ); + assert( fabs(lats[1207] - -79.773502) < EPSILON ); + assert( fabs(lats[1208] - -79.914072) < EPSILON ); + assert( fabs(lats[1209] - -80.054641) < EPSILON ); + assert( fabs(lats[1210] - -80.195211) < EPSILON ); + assert( fabs(lats[1211] - -80.335781) < EPSILON ); + assert( fabs(lats[1212] - -80.476350) < EPSILON ); + assert( fabs(lats[1213] - -80.616920) < EPSILON ); + assert( fabs(lats[1214] - -80.757490) < EPSILON ); + assert( fabs(lats[1215] - -80.898059) < EPSILON ); + assert( fabs(lats[1216] - -81.038629) < EPSILON ); + assert( fabs(lats[1217] - -81.179199) < EPSILON ); + assert( fabs(lats[1218] - -81.319768) < EPSILON ); + assert( fabs(lats[1219] - -81.460338) < EPSILON ); + assert( fabs(lats[1220] - -81.600908) < EPSILON ); + assert( fabs(lats[1221] - -81.741477) < EPSILON ); + assert( fabs(lats[1222] - -81.882047) < EPSILON ); + assert( fabs(lats[1223] - -82.022616) < EPSILON ); + assert( fabs(lats[1224] - -82.163186) < EPSILON ); + assert( fabs(lats[1225] - -82.303755) < EPSILON ); + assert( fabs(lats[1226] - -82.444325) < EPSILON ); + assert( fabs(lats[1227] - -82.584894) < EPSILON ); + assert( fabs(lats[1228] - -82.725464) < EPSILON ); + assert( fabs(lats[1229] - -82.866033) < EPSILON ); + assert( fabs(lats[1230] - -83.006602) < EPSILON ); + assert( fabs(lats[1231] - -83.147172) < EPSILON ); + assert( fabs(lats[1232] - -83.287741) < EPSILON ); + assert( fabs(lats[1233] - -83.428310) < EPSILON ); + assert( fabs(lats[1234] - -83.568880) < EPSILON ); + assert( fabs(lats[1235] - -83.709449) < EPSILON ); + assert( fabs(lats[1236] - -83.850018) < EPSILON ); + assert( fabs(lats[1237] - -83.990587) < EPSILON ); + assert( fabs(lats[1238] - -84.131156) < EPSILON ); + assert( fabs(lats[1239] - -84.271725) < EPSILON ); + assert( fabs(lats[1240] - -84.412294) < EPSILON ); + assert( fabs(lats[1241] - -84.552863) < EPSILON ); + assert( fabs(lats[1242] - -84.693432) < EPSILON ); + assert( fabs(lats[1243] - -84.834001) < EPSILON ); + assert( fabs(lats[1244] - -84.974570) < EPSILON ); + assert( fabs(lats[1245] - -85.115138) < EPSILON ); + assert( fabs(lats[1246] - -85.255707) < EPSILON ); + assert( fabs(lats[1247] - -85.396275) < EPSILON ); + assert( fabs(lats[1248] - -85.536844) < EPSILON ); + assert( fabs(lats[1249] - -85.677412) < EPSILON ); + assert( fabs(lats[1250] - -85.817980) < EPSILON ); + assert( fabs(lats[1251] - -85.958548) < EPSILON ); + assert( fabs(lats[1252] - -86.099116) < EPSILON ); + assert( fabs(lats[1253] - -86.239684) < EPSILON ); + assert( fabs(lats[1254] - -86.380251) < EPSILON ); + assert( fabs(lats[1255] - -86.520818) < EPSILON ); + assert( fabs(lats[1256] - -86.661385) < EPSILON ); + assert( fabs(lats[1257] - -86.801952) < EPSILON ); + assert( fabs(lats[1258] - -86.942519) < EPSILON ); + assert( fabs(lats[1259] - -87.083085) < EPSILON ); + assert( fabs(lats[1260] - -87.223651) < EPSILON ); + assert( fabs(lats[1261] - -87.364216) < EPSILON ); + assert( fabs(lats[1262] - -87.504781) < EPSILON ); + assert( fabs(lats[1263] - -87.645345) < EPSILON ); + assert( fabs(lats[1264] - -87.785908) < EPSILON ); + assert( fabs(lats[1265] - -87.926471) < EPSILON ); + assert( fabs(lats[1266] - -88.067032) < EPSILON ); + assert( fabs(lats[1267] - -88.207592) < EPSILON ); + assert( fabs(lats[1268] - -88.348150) < EPSILON ); + assert( fabs(lats[1269] - -88.488706) < EPSILON ); + assert( fabs(lats[1270] - -88.629259) < EPSILON ); + assert( fabs(lats[1271] - -88.769808) < EPSILON ); + assert( fabs(lats[1272] - -88.910352) < EPSILON ); + assert( fabs(lats[1273] - -89.050889) < EPSILON ); + assert( fabs(lats[1274] - -89.191413) < EPSILON ); + assert( fabs(lats[1275] - -89.331918) < EPSILON ); + assert( fabs(lats[1276] - -89.472390) < EPSILON ); + assert( fabs(lats[1277] - -89.612790) < EPSILON ); + assert( fabs(lats[1278] - -89.753005) < EPSILON ); + assert( fabs(lats[1279] - -89.892396) < EPSILON ); + + free(lats); +} + +int main(int argc, char** argv) +{ + /*printf("Doing test gauss... GRIB API version = %ld\n", grib_get_api_version());*/ + + test_gaussian_latitudes(); + + return 0; +} + diff --git a/tests/unit_tests.sh b/tests/unit_tests.sh new file mode 100755 index 000000000..f0fc2b685 --- /dev/null +++ b/tests/unit_tests.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Copyright 2005-2012 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + + +. ./include.sh +${test_dir}/unit_tests + diff --git a/tigge/jma.pl b/tigge/jma.pl index a5e317b9a..19e4c6a3b 100755 --- a/tigge/jma.pl +++ b/tigge/jma.pl @@ -3,10 +3,10 @@ # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# +# # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. -# + #!/usr/bin/perl -I/usr/local/lib/metaps/lib/grib_api/current/perl use lib qw(/home/ma/mab/grib/api/lib); diff --git a/tools/Makefile.am b/tools/Makefile.am index 5691ca5dc..18711e665 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -75,4 +75,6 @@ grib1to2$(EXEEXT): grib1to2.txt sed "s:toolsdir:$(bindir):" grib1to2.txt > grib1to2 chmod +x grib1to2 -noinst_HEADERS = grib_tools.h +# wingetopt files are for Microsoft Windows Visual Studio support +noinst_HEADERS = grib_tools.h wingetopt.h wingetopt.c + diff --git a/tools/big2gribex.c b/tools/big2gribex.c index 6f34d9a06..78f70b84a 100644 --- a/tools/big2gribex.c +++ b/tools/big2gribex.c @@ -13,9 +13,6 @@ * * Description: * - * - * - * */ #include diff --git a/tools/gg_sub_area_check.c b/tools/gg_sub_area_check.c index d10978140..394622304 100644 --- a/tools/gg_sub_area_check.c +++ b/tools/gg_sub_area_check.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api.h" #include "math.h" diff --git a/tools/grib_cmp.c b/tools/grib_cmp.c index 380e51f04..19c9ea1a6 100644 --- a/tools/grib_cmp.c +++ b/tools/grib_cmp.c @@ -13,9 +13,6 @@ * * Description: Binary comparison between two files * - * - * - * */ #include "grib_api_internal.h" diff --git a/tools/grib_convert.c b/tools/grib_convert.c index 23b711197..5d05ae598 100644 --- a/tools/grib_convert.c +++ b/tools/grib_convert.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_convert * - * - * */ #include "grib_tools.h" diff --git a/tools/grib_copy.c b/tools/grib_copy.c index 7169866bb..9f3876b73 100644 --- a/tools/grib_copy.c +++ b/tools/grib_copy.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_copy * - * - * */ #include "grib_tools.h" @@ -52,63 +50,63 @@ grib_option grib_options[]={ int grib_options_count=sizeof(grib_options)/sizeof(grib_option); int main(int argc, char *argv[]) { - int ret=grib_tool(argc,argv); - return ret; + int ret=grib_tool(argc,argv); + return ret; } int grib_tool_before_getopt(grib_runtime_options* options) { - return 0; + return 0; } int grib_tool_init(grib_runtime_options* options) { #if 0 - if (options->outfile && options->outfile->name) { - options->outfile->file = fopen(options->outfile->name,"w"); - if(!options->outfile->file) { - perror(options->outfile->name); - exit(1); - } - } + if (options->outfile && options->outfile->name) { + options->outfile->file = fopen(options->outfile->name,"w"); + if(!options->outfile->file) { + perror(options->outfile->name); + exit(1); + } + } #endif - return 0; + return 0; } int grib_tool_new_filename_action(grib_runtime_options* options,const char* file) { - return 0; + return 0; } int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* file) { - return 0; + return 0; } int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { - double* v; - size_t size=0; - if ( options->repack ) { - GRIB_CHECK_NOLINE(grib_get_size(h,"values",&size),0); + double* v; + size_t size=0; + if ( options->repack ) { + GRIB_CHECK_NOLINE(grib_get_size(h,"values",&size),0); - v = (double*)calloc(size,sizeof(double)); - if(!v) { - fprintf(stderr,"failed to allocate %ld bytes\n",(long)(size*sizeof(double))); - exit(1); - } + v = (double*)calloc(size,sizeof(double)); + if(!v) { + fprintf(stderr,"failed to allocate %ld bytes\n",(long)(size*sizeof(double))); + exit(1); + } - GRIB_CHECK_NOLINE(grib_get_double_array(h,"values",v,&size),0); - GRIB_CHECK_NOLINE(grib_set_double_array(h,"values",v,size),0); - free(v); - } - grib_tools_write_message(options,h); - return 0; + GRIB_CHECK_NOLINE(grib_get_double_array(h,"values",v,&size),0); + GRIB_CHECK_NOLINE(grib_set_double_array(h,"values",v,size),0); + free(v); + } + grib_tools_write_message(options,h); + return 0; } int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h) { - grib_handle_delete(h); - return 0; + grib_handle_delete(h); + return 0; } void grib_tool_print_key_values(grib_runtime_options* options,grib_handle* h) { - grib_print_key_values(options,h); + grib_print_key_values(options,h); } int grib_tool_finalise_action(grib_runtime_options* options) @@ -118,8 +116,8 @@ int grib_tool_finalise_action(grib_runtime_options* options) if (err != GRIB_SUCCESS) { perror(grib_tool_name); exit(err); - } + } /* if (options->outfile->file) fclose(options->outfile->file); */ - return 0; + return 0; } diff --git a/tools/grib_corruption_check.c b/tools/grib_corruption_check.c index 2a252bf47..279b4ee4a 100644 --- a/tools/grib_corruption_check.c +++ b/tools/grib_corruption_check.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api.h" void usage(char* prog) { diff --git a/tools/grib_count.c b/tools/grib_count.c index bb014d8d3..e65b566a5 100644 --- a/tools/grib_count.c +++ b/tools/grib_count.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api_internal.h" void usage(char* prog) { @@ -8,12 +18,13 @@ void usage(char* prog) { static int check_file(FILE* in,long *count) { void* mesg=NULL; size_t size=0; + off_t offset=0; int err=0; grib_context* c=grib_context_get_default(); if (!in) return 1; - while ( (err=grib_read_any_from_file_alloc (c, in, &mesg , &size))==GRIB_SUCCESS) { + while ( (mesg=wmo_read_any_from_file_malloc ( in,0, &size,&offset,&err))!=NULL && err==GRIB_SUCCESS) { grib_context_free(c,mesg); (*count)++; } diff --git a/tools/grib_debug.c b/tools/grib_debug.c index 62ce634ae..1ae7a8615 100644 --- a/tools/grib_debug.c +++ b/tools/grib_debug.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_debug * - * - * */ diff --git a/tools/grib_dump.c b/tools/grib_dump.c index d9619a2d0..8f6a77aa5 100644 --- a/tools/grib_dump.c +++ b/tools/grib_dump.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_dump * - * - * */ #include "grib_tools.h" @@ -32,7 +30,8 @@ grib_option grib_options[]={ {"T:",0,0,0,1,0}, {"7",0,0,0,1,0}, {"V",0,0,0,1,0}, - {"q",0,0,1,0,0} + {"q",0,0,1,0,0}, + {"x",0,0,0,1,0} }; char* grib_tool_description="Dump the content of a grib file in different formats."; @@ -120,7 +119,8 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { char identifier[100]; size_t idlen=100; int i; - GRIB_CHECK_NOLINE(grib_get_long(h,"totalLength",&length),0); + if (grib_get_long(h,"totalLength",&length) != GRIB_SUCCESS) + length=-9999; for (i=0;iprint_keys_count;i++) grib_set_flag(h,options->print_keys[i].name,GRIB_ACCESSOR_FLAG_DUMP); diff --git a/tools/grib_filter.c b/tools/grib_filter.c index 0c13c48d6..4d2a69f1d 100644 --- a/tools/grib_filter.c +++ b/tools/grib_filter.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_filter * - * - * */ #include "grib_tools.h" @@ -45,54 +43,54 @@ int grib_options_count=sizeof(grib_options)/sizeof(grib_option); int main(int argc, char *argv[]) { return grib_tool(argc,argv);} int grib_tool_before_getopt(grib_runtime_options* options) { - return 0; + return 0; } int grib_tool_init(grib_runtime_options* options) { - options->action = grib_action_from_filter(options->infile_extra->name); - if (!options->action) { - fprintf(stderr,"%s: error unable to create action\n",options->infile_extra->name); - exit(1); - } + options->action = grib_action_from_filter(options->infile_extra->name); + if (!options->action) { + fprintf(stderr,"%s: error unable to create action\n",options->infile_extra->name); + exit(1); + } - if ( options->outfile && options->outfile->name ) - options->action->context->outfilename=options->outfile->name; + if ( options->outfile && options->outfile->name ) + options->action->context->outfilename=options->outfile->name; - return 0; + return 0; } int grib_tool_new_filename_action(grib_runtime_options* options,const char* file) { - return 0; + return 0; } int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* file) { - return 0; + return 0; } int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { - int err=0; - - if (options->current_infile->name) { - size_t len=strlen(options->current_infile->name); - grib_set_string(h,"file",options->current_infile->name,&len); - } + int err=0; - err=grib_handle_apply_action(h,options->action); - if (err != GRIB_SUCCESS && options->fail) { - printf("ERROR: %s\n",grib_get_error_message(err)); - exit(err); - } - return 0; + if (options->current_infile->name) { + size_t len=strlen(options->current_infile->name); + grib_set_string(h,"file",options->current_infile->name,&len); + } + + err=grib_handle_apply_action(h,options->action); + if (err != GRIB_SUCCESS && options->fail) { + printf("ERROR: %s\n",grib_get_error_message(err)); + exit(err); + } + return 0; } int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h) { - grib_handle_delete(h); - return 0; + grib_handle_delete(h); + return 0; } void grib_tool_print_key_values(grib_runtime_options* options,grib_handle* h) { - grib_print_key_values(options,h); + grib_print_key_values(options,h); } int grib_tool_finalise_action(grib_runtime_options* options) @@ -104,6 +102,6 @@ int grib_tool_finalise_action(grib_runtime_options* options) exit(err); } - grib_file_pool_clean(); - return 0; + grib_file_pool_clean(); + return 0; } diff --git a/tools/grib_gen.c b/tools/grib_gen.c index 5eb8a75d9..95c25700f 100644 --- a/tools/grib_gen.c +++ b/tools/grib_gen.c @@ -13,9 +13,6 @@ * * Description: * - * - * - * */ #include diff --git a/tools/grib_get.c b/tools/grib_get.c index 7b8230402..edccd0f79 100644 --- a/tools/grib_get.c +++ b/tools/grib_get.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_get * - * - * */ #include "grib_tools.h" diff --git a/tools/grib_get_data.c b/tools/grib_get_data.c index f0cafb8bd..3976ee171 100644 --- a/tools/grib_get_data.c +++ b/tools/grib_get_data.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_get_data * - * - * */ #include "grib_tools.h" diff --git a/tools/grib_index_build.c b/tools/grib_index_build.c index 61bef5d53..fce57c59f 100644 --- a/tools/grib_index_build.c +++ b/tools/grib_index_build.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_copy * - * - * */ #include "grib_tools.h" diff --git a/tools/grib_info.c b/tools/grib_info.c index fa01b3d8d..6c22ad1d8 100644 --- a/tools/grib_info.c +++ b/tools/grib_info.c @@ -13,9 +13,6 @@ * * Description: * - * - * - * */ #include "grib_tools.h" diff --git a/tools/grib_keys.c b/tools/grib_keys.c index aa2dfe4fd..f1cc9881a 100644 --- a/tools/grib_keys.c +++ b/tools/grib_keys.c @@ -69,8 +69,15 @@ static void print_files_in_dir(const char* dir, const char* extension) int main(int argc, char *argv[]) { return grib_tool(argc,argv);} -#define SAMPLES_PATH_DELIMITER_CHAR ':' -#define SAMPLES_PATH_DELIMITER_STR ":" +/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */ +/* in order to have multiple samples directories */ +#ifdef _WIN32 +# define SAMPLES_PATH_DELIMITER_CHAR ';' +# define SAMPLES_PATH_DELIMITER_STR ";" +#else +# define SAMPLES_PATH_DELIMITER_CHAR ':' +# define SAMPLES_PATH_DELIMITER_STR ":" +#endif int grib_tool_before_getopt(grib_runtime_options* options) { grib_context *c=grib_context_get_default( ); diff --git a/tools/grib_ls.c b/tools/grib_ls.c index af42cd7a5..3ea4d17e8 100644 --- a/tools/grib_ls.c +++ b/tools/grib_ls.c @@ -11,8 +11,6 @@ /* * C Implementation: grib_ls * - * - * */ #include "grib_tools.h" @@ -60,10 +58,20 @@ grib_nearest* n=NULL; int main(int argc, char *argv[]) { return grib_tool(argc,argv);} +/* +This is executed before processing the options with i +getopt and therfore it is the right place for hacking +the arguments if needed +*/ int grib_tool_before_getopt(grib_runtime_options* options) { return 0; } +/* +The options have been parsed and the structure +grib_runtime_options* options has been loaded. +Initialization and startup can be done here +*/ int grib_tool_init(grib_runtime_options* options) { char *theEnd = NULL, *end1=NULL; size_t size=4; @@ -154,6 +162,11 @@ int grib_tool_init(grib_runtime_options* options) { return 0; } + +/* +A new file is being parsed. The file name is file. This function is called every time +a new input file name is processed, before opening the file. +*/ int grib_tool_new_filename_action(grib_runtime_options* options,const char* file) { return 0; } @@ -204,6 +217,10 @@ static void print_key_values(grib_runtime_options* options,grib_handle* h) { printf("}"); } +/* A new handle is available from the current input file and can be processed here. +The handle available in this function is in the set of messages satisfying the constrant of the +-w option. They are not to be skipped. +*/ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { size_t size=4; double v=0; @@ -282,15 +299,19 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { return 0; } +/* A new handle to skip is available. At this point something can be done +with the message to be skipped before deleting the handle. */ int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h) { grib_handle_delete(h); return 0; } +/* key values can be printed in this function. Headers are already printed if requested.*/ void grib_tool_print_key_values(grib_runtime_options* options,grib_handle* h) { grib_print_key_values(options,h); } +/* this is executed after the last message in the last file is processed */ int grib_tool_finalise_action(grib_runtime_options* options) { int i=0; if (options->latlon && options->verbose) { diff --git a/tools/grib_moments.c b/tools/grib_moments.c index ebea26c6d..7a4931777 100644 --- a/tools/grib_moments.c +++ b/tools/grib_moments.c @@ -1,3 +1,13 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + #include "grib_api_internal.h" void usage(char* prog) {printf("usage: %s split order interpolated.grib original.grib\n",prog);exit(1);} diff --git a/tools/grib_nearest_land.c b/tools/grib_nearest_land.c index 82f15f89e..3990e0477 100644 --- a/tools/grib_nearest_land.c +++ b/tools/grib_nearest_land.c @@ -11,10 +11,6 @@ /* * C Implementation: points * - * - * - * - * */ #include diff --git a/tools/grib_options.c b/tools/grib_options.c index fbb955197..b5d5f2e91 100644 --- a/tools/grib_options.c +++ b/tools/grib_options.c @@ -11,12 +11,14 @@ /* * C Implementation: grib_options * - * - * */ - #include "grib_tools.h" +#ifdef _WIN32 +/* Microsoft Windows Visual Studio support */ +#include "wingetopt.h" +#endif + char* names[]={"parameter","vertical","geography","data","mars","local"}; int names_count=6; @@ -102,6 +104,23 @@ grib_options_help grib_options_help_list[] ={ int grib_options_help_count=sizeof(grib_options_help_list)/sizeof(grib_options_help); + +void usage() { + int i=0; + printf("\nNAME \t%s\n\n",grib_tool_name); + printf("DESCRIPTION\n\t%s\n\n",grib_tool_description); + printf("USAGE \n\t%s %s\n\n",grib_tool_name,grib_tool_usage); + printf("OPTIONS\n"); + for (i=0;iorderby=grib_options_get_option("B:"); - if (grib_options_on("x")) options->mode=MODE_HEADERS_ONLY; + if (grib_options_on("x")) options->headers_only=1; + else options->headers_only=0; + if (grib_options_on("T:")) { char* x=grib_options_get_option("T:"); if ( *x == 'T' ) options->mode=MODE_GTS; @@ -261,10 +282,11 @@ int grib_process_runtime_options(grib_context* context,int argc,char** argv,grib options->requested_print_keys_count=MAX_KEYS; ret = parse_keyval_string(grib_tool_name,karg,0,GRIB_TYPE_UNDEFINED, - options->requested_print_keys,&(options->requested_print_keys_count)); + options->requested_print_keys,&(options->requested_print_keys_count)); if (ret == GRIB_INVALID_ARGUMENT) usage(); GRIB_CHECK_NOLINE(ret,0); + options->strict=grib_options_on("S"); if (grib_options_on("M")) grib_multi_support_off(context); @@ -282,14 +304,14 @@ int grib_process_runtime_options(grib_context* context,int argc,char** argv,grib if (grib_options_on("s:")) { sarg=grib_options_get_option("s:"); options->set_values_count=MAX_KEYS; - ret=parse_keyval_string(grib_tool_name,sarg,1,GRIB_TYPE_UNDEFINED,options->set_values,&(options->set_values_count)); + ret=parse_keyval_string(grib_tool_name, sarg,1,GRIB_TYPE_UNDEFINED,options->set_values,&(options->set_values_count)); if (ret == GRIB_INVALID_ARGUMENT) usage(); } if (grib_options_on("R:")) { sarg=grib_options_get_option("R:"); options->tolerance_count=MAX_KEYS; - ret=parse_keyval_string(grib_tool_name,sarg,1,GRIB_TYPE_DOUBLE,options->tolerance,&(options->tolerance_count)); + ret=parse_keyval_string(grib_tool_name, sarg,1,GRIB_TYPE_DOUBLE,options->tolerance,&(options->tolerance_count)); if (ret == GRIB_INVALID_ARGUMENT) usage(); } @@ -325,6 +347,7 @@ int grib_process_runtime_options(grib_context* context,int argc,char** argv,grib return GRIB_SUCCESS; } + char* grib_options_get_help(char* id) { int i=0; char msg[]="ERROR: help not found for option "; @@ -366,22 +389,6 @@ char* grib_options_get_args(char* id) { return err; } -void usage() { - int i=0; - printf("\nNAME \t%s\n\n",grib_tool_name); - printf("DESCRIPTION\n\t%s\n\n",grib_tool_description); - printf("USAGE \n\t%s %s\n\n",grib_tool_name,grib_tool_usage); - printf("OPTIONS\n"); - for (i=0;iskip_all && ((h = grib_handle_new_from_file_x(c,infile->file,options->mode,&err)) + while(!options->skip_all && ((h = grib_handle_new_from_file_x(c,infile->file,options->mode, + options->headers_only,&err)) != NULL || err != GRIB_SUCCESS ) ) { infile->handle_count++; options->handle_count++; @@ -483,6 +482,7 @@ static int grib_tool_index(grib_runtime_options* options) { return 0; } +#ifndef _WIN32 static int scan(grib_context* c,grib_runtime_options* options,const char* dir) { struct dirent *s; DIR *d; @@ -503,13 +503,53 @@ static int scan(grib_context* c,grib_runtime_options* options,const char* dir) { } return 0; } +#else +static int isWinDir(const struct _finddata_t *fileinfo) +{ + if((fileinfo->attrib & 16) == 16) + return 1; + return 0; +} +static void doProcessing(grib_context* c,grib_runtime_options* options,const char* dir, const struct _finddata_t *fileinfo) +{ + if(isWinDir(fileinfo)) + { + if(strcmp(fileinfo->name, ".") != 0 && strcmp(fileinfo->name,"..") != 0) { + char buf[1024]; + sprintf(buf,"%s/%s",dir,fileinfo->name); + process(c,options,buf); + } + } +} +static int scan(grib_context* c,grib_runtime_options* options,const char* dir) { + struct _finddata_t fileinfo; + intptr_t handle; + if((handle = _findfirst(dir, &fileinfo)) != -1) + doProcessing(c, options, dir, &fileinfo); + else + { + grib_context_log(c,(GRIB_LOG_ERROR) | (GRIB_LOG_PERROR) , "opendir %s",dir); + return GRIB_IO_PROBLEM; + } + while(!_findnext(handle, &fileinfo)) + doProcessing(c, options, dir, &fileinfo); + return 0; +} +#endif static int process(grib_context* c,grib_runtime_options* options,const char* path) { struct stat s; - int err=0; + int stat_val=0; int ioerr=0; - if ( (err = lstat(path,&s)) ) { + +#ifndef _WIN32 + stat_val = lstat(path,&s); +#else + stat_val = stat(path,&s); +#endif + + if ( stat_val != 0 ) { ioerr=errno; grib_context_log(c,(GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),"Cannot stat %s",path); return GRIB_IO_PROBLEM; @@ -637,77 +677,77 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle } static int to_skip(grib_handle* h,grib_values* v,int *err) { - double dvalue=0; - int ret=0; - long lvalue=0; - char value[MAX_STRING_LEN]={0,}; - size_t len=MAX_STRING_LEN; - *err=0; - - switch (v->type) { - case GRIB_TYPE_STRING: - *err=grib_get_string( h,v->name,value,&len); - ret = v->equal ? grib_inline_strcmp(value,v->string_value) : !grib_inline_strcmp(value,v->string_value); - break; - case GRIB_TYPE_DOUBLE: - *err=grib_get_double( h,v->name,&dvalue); - ret = v->equal ? (dvalue != v->double_value) : (dvalue == v->double_value); - break; - case GRIB_TYPE_LONG: - *err=grib_get_long( h,v->name,&lvalue); - ret = v->equal ? (lvalue != v->long_value) : (lvalue == v->long_value); - break; - case GRIB_TYPE_MISSING: - lvalue=grib_is_missing( h,v->name,err); - ret = (lvalue == v->equal) ? 0 : 1; - break; + double dvalue=0; + int ret=0; + long lvalue=0; + char value[MAX_STRING_LEN]={0,}; + size_t len=MAX_STRING_LEN; + *err=0; + + switch (v->type) { + case GRIB_TYPE_STRING: + *err=grib_get_string( h,v->name,value,&len); + ret = v->equal ? grib_inline_strcmp(value,v->string_value) : !grib_inline_strcmp(value,v->string_value); + break; + case GRIB_TYPE_DOUBLE: + *err=grib_get_double( h,v->name,&dvalue); + ret = v->equal ? (dvalue != v->double_value) : (dvalue == v->double_value); + break; + case GRIB_TYPE_LONG: + *err=grib_get_long( h,v->name,&lvalue); + ret = v->equal ? (lvalue != v->long_value) : (lvalue == v->long_value); + break; + case GRIB_TYPE_MISSING: + lvalue=grib_is_missing( h,v->name,err); + ret = (lvalue == v->equal) ? 0 : 1; + break; default: - fprintf(dump_file,"invalid type for %s\n",v->name); - exit(1); + fprintf(dump_file,"invalid type for %s\n",v->name); + exit(1); - } + } - return ret; + return ret; } void grib_skip_check(grib_runtime_options* options,grib_handle* h) { int i,ret=0; - grib_values* v=NULL; - for (i=0;i < options->constraints_count ;i++) { - v=&(options->constraints[i]); - if (v->equal) { - options->skip=1; - while (v) { - if (!to_skip(h,v,&ret)) { - if (!strcmp(v->name,"count") && !v->next) - options->skip_all=1; - options->skip=0; - break; - } - if (ret != GRIB_SUCCESS && options->fail) { - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to get \"%s\" (%s)", - v->name,grib_get_error_message(ret)); - exit(ret); - } - v=v->next; - } - } else { - options->skip=0; - while (v) { - if (to_skip(h,v,&ret)) { - options->skip=1; - break; - } - if (ret != GRIB_SUCCESS && options->fail) { - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to get \"%s\" (%s)", - v->name,grib_get_error_message(ret)); - exit(ret); - } - v=v->next; - } - } - if (options->skip==1) - break; + grib_values* v=NULL; + for (i=0;i < options->constraints_count ;i++) { + v=&(options->constraints[i]); + if (v->equal) { + options->skip=1; + while (v) { + if (!to_skip(h,v,&ret)) { + if (!strcmp(v->name,"count") && !v->next) + options->skip_all=1; + options->skip=0; + break; + } + if (ret != GRIB_SUCCESS && options->fail) { + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to get \"%s\" (%s)", + v->name,grib_get_error_message(ret)); + exit(ret); + } + v=v->next; + } + } else { + options->skip=0; + while (v) { + if (to_skip(h,v,&ret)) { + options->skip=1; + break; + } + if (ret != GRIB_SUCCESS && options->fail) { + grib_context_log(h->context,GRIB_LOG_ERROR,"unable to get \"%s\" (%s)", + v->name,grib_get_error_message(ret)); + exit(ret); + } + v=v->next; + } + } + if (options->skip==1) + break; } if (!options->skip) { @@ -867,54 +907,67 @@ void grib_print_file_statistics(grib_runtime_options* options,grib_tools_file* f } void grib_tools_write_message(grib_runtime_options* options, grib_handle* h) { - const void *buffer; size_t size; - grib_file* of=NULL; - int err=0; - int ioerr=0; - char filename[1024]={0,}; + const void *buffer; + size_t size; + grib_file* of = NULL; + int err = 0; + int ioerr = 0; + char filename[1024] = { 0, }; Assert(options->outfile!=NULL && options->outfile->name!=NULL); - if (options->error == GRIB_WRONG_LENGTH) return; + if (options->error == GRIB_WRONG_LENGTH) + return; - if ((err=grib_get_message(h,&buffer,&size))!= GRIB_SUCCESS) { - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to get binary message\n"); + if ((err = grib_get_message(h, &buffer, &size)) != GRIB_SUCCESS) { + grib_context_log(h->context, GRIB_LOG_ERROR,"unable to get binary message\n"); exit(err); } - err = grib_recompose_name(h,NULL,options->outfile->name,filename,0); + err = grib_recompose_name(h, NULL, options->outfile->name, filename, 0); - of=grib_file_open(filename,"w",&err); + of = grib_file_open(filename, "w", &err); if (!of || !of->handle) { - ioerr=errno; - grib_context_log(h->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR), - "unable to open file %s\n",filename); - exit(GRIB_IO_PROBLEM); - } - - if (options->gts && h->gts_header) - fwrite(h->gts_header,1,h->gts_header_len,of->handle); - - if(fwrite(buffer,1,size,of->handle) != size) { - ioerr=errno; - grib_context_log(h->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR), - "Error writing to %s",filename); + ioerr = errno; + grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), + "unable to open file %s\n", filename); exit(GRIB_IO_PROBLEM); } if (options->gts && h->gts_header) { - char gts_trailer[4]={'\x0D','\x0D','\x0A','\x03'}; - fwrite(gts_trailer,1,4,of->handle); + if (fwrite(h->gts_header, 1, h->gts_header_len, of->handle) != h->gts_header_len) { + ioerr = errno; + grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), + "Error writing GTS header to %s", filename); + exit(GRIB_IO_PROBLEM); + } } - grib_file_close(filename,&err); + if (fwrite(buffer, 1, size, of->handle) != size) { + ioerr = errno; + grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), + "Error writing to %s", filename); + exit(GRIB_IO_PROBLEM); + } + + if (options->gts && h->gts_header) { + char gts_trailer[4] = { '\x0D', '\x0D', '\x0A', '\x03' }; + if (fwrite(gts_trailer, 1, 4, of->handle) != 4) { + ioerr = errno; + grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), + "Error writing GTS trailer to %s", filename); + exit(GRIB_IO_PROBLEM); + } + } + + grib_file_close(filename, &err); if (err != GRIB_SUCCESS) { - grib_context_log(h->context,GRIB_LOG_ERROR,"unable to write message\n"); + grib_context_log(h->context, GRIB_LOG_ERROR,"unable to write message\n"); exit(err); } - options->outfile->file=NULL; + options->outfile->file = NULL; #if 0 if (!options->outfile->file) { diff --git a/tools/grib_tools.h b/tools/grib_tools.h index 156d6be0f..b6ea9f142 100644 --- a/tools/grib_tools.h +++ b/tools/grib_tools.h @@ -10,7 +10,9 @@ #include "grib_api_internal.h" #include -#include +#ifndef _WIN32 +# include +#endif #include #ifndef GRIB_TOOLS_H @@ -34,9 +36,8 @@ #define MAX_CONSTRAINT_VALUES 500 #define MODE_GRIB 0 -#define MODE_HEADERS_ONLY 1 -#define MODE_GTS 2 -#define MODE_BUFR 3 +#define MODE_GTS 1 +#define MODE_BUFR 2 typedef union grib_typed_value { long* long_value; @@ -151,6 +152,7 @@ typedef struct grib_runtime_options { grib_context* context; int stop; int mode; + int headers_only; int skip_all; grib_values tolerance[MAX_KEYS]; } grib_runtime_options; diff --git a/tools/wingetopt.c b/tools/wingetopt.c new file mode 100644 index 000000000..5bc6f6f33 --- /dev/null +++ b/tools/wingetopt.c @@ -0,0 +1,85 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + +#ifdef _WIN32 +/* Microsoft Windows Visual Studio support */ + +#include "string.h" +#include "wingetopt.h" + +char *optarg; /* global argument pointer */ +int optind = 0; /* global argv index */ +int opterr = 0; +int getopt(int argc, char *argv[], const char *optstring) +{ + static char *next = 0; + char c; + char *cp; + if (optind == 0) + next = 0; + + optarg = 0; + + if (next == 0 || *next == '\0') + { + if (optind == 0) + optind++; + + if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') + { + optarg = 0; + if (optind < argc) + optarg = argv[optind]; + return -1; + } + + if (strcmp(argv[optind], "--") == 0) + { + optind++; + optarg = NULL; + if (optind < argc) + optarg = argv[optind]; + return -1; + } + + next = argv[optind]; + next++; /* skip past - */ + optind++; + } + + c = *next++; + cp = strrchr(optstring, c); + + if (cp == 0 || c == ':') + return '?'; + + cp++; + if (*cp == ':') + { + if (*next != '\0') + { + optarg = next; + next = 0; + } + else if (optind < argc) + { + optarg = argv[optind]; + optind++; + } + else + { + return '?'; + } + } + + return c; +} +#endif + diff --git a/tools/wingetopt.h b/tools/wingetopt.h new file mode 100644 index 000000000..6bc6c5093 --- /dev/null +++ b/tools/wingetopt.h @@ -0,0 +1,22 @@ +/* + * Copyright 2005-2012 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ + +#ifndef WINGETOPT_H +#define WINGETOPT_H + +#ifdef _WIN32 +/* Microsoft Windows Visual Studio support */ +extern int optind, opterr; +extern char *optarg; +int getopt(int argc, char *argv[], const char *optstring); +#endif + +#endif + diff --git a/tools/xref.pl b/tools/xref.pl index 6f2069699..9afd15803 100755 --- a/tools/xref.pl +++ b/tools/xref.pl @@ -6,9 +6,9 @@ use DBI; use strict; -my $host="wrep-metadata-devel.ecmwf.int"; -my $user="max"; -my $pass="max"; +my $host="wrep-db-misc-prod"; +my $user="ecmwf"; +my $pass=""; my $dbh = DBI->connect("dbi:mysql:;host=$host",$user,$pass) or die $DBI::errstr; diff --git a/version.sh b/version.sh index 015d200e0..8c3bc6d58 100644 --- a/version.sh +++ b/version.sh @@ -1,12 +1,18 @@ +# Copyright 2005-2012 ECMWF. # -# Package name and versioning information for +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# +# Package name and versioning information # # # Package base name PACKAGE_NAME='grib_api' # Package version -GRIB_API_MAJOR_VERSION=1 -GRIB_API_MINOR_VERSION=10 -GRIB_API_REVISION_VERSION=4 +GRIB_API_MAJOR_VERSION=2 +GRIB_API_MINOR_VERSION=0 +GRIB_API_REVISION_VERSION=0