Merge branch 'develop' into feature/mtg2_timeproc

This commit is contained in:
Sebastien Villaume 2024-08-07 17:11:36 +01:00
commit 94533dde1f
171 changed files with 2739 additions and 59221 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
set -e
set -eu
# We do not want to come across the ecCodes tools in the toolbox
module unload ecmwf-toolbox
@ -14,12 +14,17 @@ module load python3
version=$(cat $TMPDIR/eccodes/VERSION)
# regression_suite_dir=$TMPDIR/eccodes-regression-tests
# mkdir -p $regression_suite_dir
# git clone git@github.com:ecmwf/eccodes-regression-tests.git $regression_suite_dir
# cd $regression_suite_dir
# Note:
# The environment variable "GH_TOKEN" needs to be there for the clone to succeed
#
cd ~masn/REGRESSION_TESTING/ecCodes
regression_suite_dir=$TMPDIR/eccodes-regression-tests
mkdir -p $regression_suite_dir
git clone https://${GH_TOKEN}@github.com/ecmwf/eccodes-regression-tests.git $regression_suite_dir
cd $regression_suite_dir
# Launch the regression tests in parallel (This script uses GNU parallel)
# cd ~masn/REGRESSION_TESTING/ecCodes
./par-suite.sh -w $TMPDIR/install/eccodes/$version
# For debugging specific test(s)

18
.github/nightly-ci-hpc-config.yml vendored Normal file
View File

@ -0,0 +1,18 @@
build:
modules:
- ecbuild
- ninja
- aec
- netcdf4
parallel: 64
cmake_options:
- -DENABLE_EXTRA_TESTS=1
- -DENABLE_PNG=1
- -DENABLE_NETCDF=1
force_build: true
post_script: .github/ci-nightly-test.sh
env:
- GH_TOKEN=${GH_TOKEN}
compiler_cc: gcc
compiler_cxx: g++
compiler_fc: gfortran

View File

@ -5,15 +5,21 @@ on:
# Run at 20:00 UTC every day (on default branch)
schedule:
- cron: '0 20 * * *'
- cron: "0 20 * * *"
jobs:
test-hpc:
uses: ./.github/workflows/reusable-ci-hpc.yml
with:
eccodes: ecmwf/eccodes@${{ github.event.pull_request.head.sha || github.sha }}
nightly_test: true
secrets: inherit
runs-on: [self-hosted, linux, hpc]
env:
GH_TOKEN: ${{ secrets.GH_REPO_READ_TOKEN }}
steps:
- uses: ecmwf-actions/reusable-workflows/ci-hpc@v2
with:
github_user: ${{ secrets.BUILD_PACKAGE_HPC_GITHUB_USER }}
github_token: ${{ secrets.GH_REPO_READ_TOKEN }}
troika_user: ${{ secrets.HPC_CI_SSH_USER }}
repository: ecmwf/eccodes@${{ github.event.pull_request.head.sha || github.sha }}
build_config: .github/nightly-ci-hpc-config.yml
test-macos:
strategy:

View File

@ -1,33 +0,0 @@
name: reusable-ci-hpc
on:
workflow_call:
inputs:
eccodes:
required: false
type: string
nightly_test:
required: false
type: boolean
default: false
jobs:
ci-hpc:
name: ci-hpc
uses: ecmwf-actions/reusable-workflows/.github/workflows/ci-hpc.yml@v2
with:
name-prefix: eccodes-
build-inputs: |
--package: ${{ inputs.eccodes || 'ecmwf/eccodes@develop' }}
--modules: |
ecbuild
ninja
aec
netcdf4
--parallel: 64
--cmake-options: |
-DENABLE_EXTRA_TESTS=1
${{ inputs.nightly_test && '-DENABLE_PNG=1,-DENABLE_NETCDF=1' || '' }}
${{ inputs.nightly_test && '--post-script: .github/ci-nightly-test.sh' || '' }}
${{ inputs.nightly_test && '--force-build: true' || '' }}
secrets: inherit

View File

@ -1,30 +0,0 @@
name: reusable-ci
on:
workflow_call:
inputs:
eccodes:
required: false
type: string
codecov:
required: false
type: boolean
default: false
jobs:
ci:
name: eccodes-ci
uses: ecmwf-actions/reusable-workflows/.github/workflows/ci.yml@v2
with:
repository: ${{ inputs.eccodes || 'ecmwf/eccodes@develop' }}
name_prefix: eccodes-
codecov_upload: ${{ inputs.codecov }}
build_package_inputs: |
repository: ${{ inputs.eccodes || 'ecmwf/eccodes@develop' }}
self_coverage: true
dependencies: |
ecmwf/ecbuild
MathisRosenhauer/libaec@master
dependency_branch: develop
parallelism_factor: 8
secrets: inherit

View File

@ -91,4 +91,4 @@ mercator.grib2
run_length_packing.grib2
boustrophedonic.grib1
reduced_gaussian_sub_area.legacy.grib1
grid_complex_spatial_differencing.grib2

View File

@ -1,4 +1,7 @@
Will set values...
values=2 2 2 2
max=2 min=2 average=2
max=2 min=2 average=2
Will set values...
values=2 5 2 2
max=5 min=2 average=2.75

View File

@ -106,12 +106,12 @@ is_deeply(\%name_map, \%paramId_map, 'Check name and paramId are the same');
is_deeply(\%name_map, \%shortName_map, 'Check name and shortName are the same');
is_deeply(\%name_map, \%units_map, 'Check name and units are the same');
if (-f "cfVarName.def") {
my %cfVar_map = process("cfVarName.def");
is_deeply(\%name_map, \%cfVar_map, 'Check name and cfVarName are the same');
} else {
print "\n\tINFO: Did not find a cfVarName.def file!!!\n\n";
}
#if (-f "cfVarName.def") {
# my %cfVar_map = process("cfVarName.def");
# is_deeply(\%name_map, \%cfVar_map, 'Check name and cfVarName are the same');
#} else {
# print "\n\tINFO: Did not find a cfVarName.def file!!!\n\n";
#}
done_testing();

View File

@ -183,6 +183,93 @@ EOF
close(TAR);
}
# See ECC-1886
sub create_cfVarName {
my $p; my %seen;
my ($key) =@_;
my $field=$key;
#if ($key =~ /paramId/) { $field="param.id"; }
#if ($key =~ /name/) { $field="param.name"; }
#if ($key =~ /units/) { $field="units.name"; }
if ($key =~ /cfVarName/) { $field="cfVarName"; }
my $query= <<"EOF";
select $field,force128,edition,
centre.abbreviation,param_id,attribute.name,attribute_value,param.name,param.shortName
from param,grib_encoding,grib,attribute,centre,units where
param.hide_def=0 and
grib_encoding.id=grib.encoding_id and
param.id=grib_encoding.param_id and
attribute.id=grib.attribute_id and
centre.id=grib_encoding.centre_id and
units.id=param.units_id
and cfVarName IS NOT NULL
order by edition,centre_id,param.o,param.id,grib_encoding.param_version,attribute.o;
EOF
my $qh=$dbh->prepare($query);
$qh->execute();
# file containing the list of grib api parameters files we want to tar and
# distribute to users for them to download and update their list of parameter
# to the latest
#open(TAR,$tarfilesflag ? ">>" : ">","tarfiles.txt") or die "Count not open file tarfiles.txt: $!";
#$tarfilesflag=1;
while (my ($keyval,$force128,$edition,$centre,$paramId,$attribute,$value,$name,$shortName)=$qh->fetchrow_array )
{
if ($centre eq "wmo" ) { $conceptDir=""; }
else { $conceptDir="/localConcepts/$centre"; }
#if ($key =~ /paramId/ && $force128==1 && $keyval >1000) {
# $keyval= $keyval % 1000;
#}
if ($filebase ne "$basedir/grib$edition$conceptDir") {
if ($filebase) {
print $out "}\n";
close $out;
}
$filebase="$basedir/grib$edition$conceptDir";
mkpath($filebase);
#copy("$filebase/$key.def","$filebase/$key.def.bkp")
# or die ("unable to copy $filebase/$key.def");
print TAR "grib$edition$conceptDir/$key.def\n";
#system("cp -f $filebase/$key.def $filebase/$key.def.orig");
open($out,"> $filebase/$key.def")
or die "unable to open $filebase/$key.def";
print $out "# Automatically generated by $0, do not edit\n";
$p=();
}
if ($p ne $paramId || exists($seen{$attribute}) ) {
if ($p) { print $out "\t}\n"; }
print $out "#$name\n" ;
print $out "\'".$keyval."\' = {\n" ;
$p=$paramId;
%seen=();
}
$seen{$attribute}=1;
print "($key=$keyval) $edition,$centre,$shortName,$paramId,$name,$attribute,$value\n";
# we need to allow strings in the attribute_value field
# for the moment we apply a patch here
if ($attribute =~ /stepType/ ) {
$value="\"accum\"";
}
if ($value eq '') {
$value="missing()";
}
print $out "\t $attribute = $value ;\n" ;
}
if ($filebase) {
print $out "}\n";
close $out;
}
close(TAR);
}
sub create_paramId_def {
my $p; my %seen;
@ -270,6 +357,9 @@ create_def("paramId");
create_def("shortName");
create_def("name");
create_def("units");
# Note: The cfVarName.def files are smaller than the rest. We only store the
# minimum set necessary. See ECC-1886
create_cfVarName("cfVarName");
create_cfName("cfName");
# #create_paramId_def();

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,12 @@
unsigned[2] Ni : can_be_missing,dump;
alias numberOfPointsAlongAParallel= Ni ;
alias Nx =Ni;
alias geography.Ni=Ni;
signed[2] Nj : dump;
alias numberOfPointsAlongAMeridian=Nj;
alias Ny=Nj;
alias geography.Nj=Nj;
# Latitudes and Longitudes of the first and the last points
# Resolution and component flags

View File

@ -2,11 +2,13 @@ unsigned[2] Ni : can_be_missing,dump;
alias numberOfPointsAlongAParallel=Ni;
alias numberOfPointsAlongXAxis=Ni;
alias Nx = Ni;
alias geography.Ni=Ni;
unsigned[2] Nj : can_be_missing,dump;
alias numberOfPointsAlongAMeridian=Nj;
alias numberOfPointsAlongYAxis= Nj;
alias Ny = Nj;
alias geography.Nj=Nj;
# Latitudes and Longitudes of the first and the last points
# Resolution and component flags

View File

@ -32,5 +32,5 @@ constant secondsOfAnalysis = 0;
meta dateOfAnalysis g1date(centuryOfAnalysis,yearOfAnalysis,monthOfAnalysis,dayOfAnalysis) : dump;
meta timeOfAnalysis time(hourOfAnalysis,minuteOfAnalysis,secondsOfAnalysis) : dump;
alias date = dateOfAnalysis;
alias time = timeOfAnalysis;
alias mars.date = dateOfAnalysis;
alias mars.time = timeOfAnalysis;

File diff suppressed because it is too large Load Diff

View File

@ -1,120 +1,9 @@
# Automatically generated by ./create_def.pl, do not edit
#Stream function
'strf' = {
table2Version = 200 ;
indicatorOfParameter = 35 ;
}
#Velocity potential
'vp' = {
table2Version = 200 ;
indicatorOfParameter = 36 ;
}
#Potential temperature
'pt' = {
table2Version = 200 ;
indicatorOfParameter = 13 ;
}
#Wind speed
'ws' = {
table2Version = 200 ;
indicatorOfParameter = 32 ;
}
#Sea ice area fraction
'ci' = {
'siconc' = {
table2Version = 200 ;
indicatorOfParameter = 91 ;
}
#Montgomery potential
'mont' = {
table2Version = 200 ;
indicatorOfParameter = 37 ;
}
#Pressure
'pres' = {
table2Version = 200 ;
indicatorOfParameter = 1 ;
}
#Potential vorticity
'pv' = {
table2Version = 200 ;
indicatorOfParameter = 4 ;
}
#Total column cloud liquid water
'tclw' = {
table2Version = 200 ;
indicatorOfParameter = 227 ;
}
#Total column cloud ice water
'tciw' = {
table2Version = 200 ;
indicatorOfParameter = 58 ;
}
#Geopotential
'z' = {
table2Version = 200 ;
indicatorOfParameter = 6 ;
}
#Temperature
't' = {
table2Version = 200 ;
indicatorOfParameter = 11 ;
}
#U component of wind
'u' = {
table2Version = 200 ;
indicatorOfParameter = 33 ;
}
#V component of wind
'v' = {
table2Version = 200 ;
indicatorOfParameter = 34 ;
}
#Specific humidity
'q' = {
table2Version = 200 ;
indicatorOfParameter = 51 ;
}
#Surface pressure
'sp' = {
table2Version = 200 ;
indicatorOfParameter = 1 ;
indicatorOfTypeOfLevel = 1 ;
}
#Vertical velocity
'w' = {
table2Version = 200 ;
indicatorOfParameter = 39 ;
}
#Total column vertically-integrated water vapour
'tcwv' = {
table2Version = 200 ;
indicatorOfParameter = 54 ;
}
#Vorticity (relative)
'vo' = {
table2Version = 200 ;
indicatorOfParameter = 43 ;
}
#Mean sea level pressure
'msl' = {
table2Version = 200 ;
indicatorOfParameter = 2 ;
}
#Divergence
'd' = {
table2Version = 200 ;
indicatorOfParameter = 44 ;
}
#Geopotential height
'gh' = {
table2Version = 200 ;
indicatorOfParameter = 7 ;
}
#Relative humidity
'r' = {
table2Version = 200 ;
indicatorOfParameter = 52 ;
}
#10 metre U wind component
'u10' = {
table2Version = 200 ;
@ -136,71 +25,6 @@
indicatorOfTypeOfLevel = 105 ;
level = 2 ;
}
#Land-sea mask
'lsm' = {
table2Version = 200 ;
indicatorOfParameter = 81 ;
}
#Surface roughness (climatological)
'sr' = {
table2Version = 200 ;
indicatorOfParameter = 83 ;
}
#Brightness temperature
'btmp' = {
table2Version = 200 ;
indicatorOfParameter = 118 ;
}
#Specific cloud ice water content
'ciwc' = {
table2Version = 200 ;
indicatorOfParameter = 229 ;
}
#Snow depth
'sde' = {
table2Version = 200 ;
indicatorOfParameter = 66 ;
}
#Convective cloud cover
'ccc' = {
table2Version = 200 ;
indicatorOfParameter = 72 ;
}
#Low cloud cover
'lcc' = {
table2Version = 200 ;
indicatorOfParameter = 73 ;
}
#Medium cloud cover
'mcc' = {
table2Version = 200 ;
indicatorOfParameter = 74 ;
}
#High cloud cover
'hcc' = {
table2Version = 200 ;
indicatorOfParameter = 75 ;
}
#Large scale snow
'lssf' = {
table2Version = 200 ;
indicatorOfParameter = 79 ;
}
#Latent heat flux
'lhf' = {
table2Version = 200 ;
indicatorOfParameter = 121 ;
}
#Sensible heat flux
'shf' = {
table2Version = 200 ;
indicatorOfParameter = 122 ;
}
#Boundary layer dissipation
'bld' = {
table2Version = 200 ;
indicatorOfParameter = 123 ;
}
#2 metre specific humidity
'sh2' = {
table2Version = 200 ;
@ -208,745 +32,10 @@
indicatorOfTypeOfLevel = 105 ;
level = 2 ;
}
#Convective snow
'snoc' = {
table2Version = 200 ;
indicatorOfParameter = 78 ;
}
#Maximum wind speed
'maxgust' = {
table2Version = 200 ;
indicatorOfParameter = 219 ;
}
#Downward short-wave radiation flux
'dswrf' = {
table2Version = 200 ;
indicatorOfParameter = 204 ;
}
#Upward short-wave radiation flux
'uswrf' = {
table2Version = 200 ;
indicatorOfParameter = 211 ;
}
#Downward long-wave radiation flux
'dlwrf' = {
table2Version = 200 ;
indicatorOfParameter = 205 ;
}
#Upward long-wave radiation flux
'ulwrf' = {
table2Version = 200 ;
indicatorOfParameter = 212 ;
}
#Cloud water
'cwat' = {
table2Version = 200 ;
indicatorOfParameter = 76 ;
}
#Cloud work function
'cwork' = {
table2Version = 200 ;
indicatorOfParameter = 146 ;
}
#Total column integrated ozone
'tcioz' = {
table2Version = 200 ;
indicatorOfParameter = 10 ;
}
#Ground heat flux
'gflux' = {
table2Version = 200 ;
indicatorOfParameter = 155 ;
}
#2 metre relative humidity
'r2' = {
table2Version = 200 ;
indicatorOfParameter = 52 ;
indicatorOfTypeOfLevel = 105 ;
level = 2 ;
}
#Clear Sky Downward Solar Flux
'csdsf' = {
table2Version = 200 ;
indicatorOfParameter = 161 ;
}
#Clear Sky Upward Solar Flux
'csusf' = {
table2Version = 200 ;
indicatorOfParameter = 160 ;
}
#Clear Sky Upward Long Wave Flux
'csulf' = {
table2Version = 200 ;
indicatorOfParameter = 162 ;
}
#Clear Sky Downward Long Wave Flux
'csdlf' = {
table2Version = 200 ;
indicatorOfParameter = 163 ;
}
#Forecast albedo
'al' = {
table2Version = 200 ;
indicatorOfParameter = 84 ;
}
#Mean evaporation
'evpsfc' = {
table2Version = 200 ;
indicatorOfParameter = 57 ;
}
#Mean total precipitation
'tpratsfc' = {
table2Version = 200 ;
indicatorOfParameter = 61 ;
}
#Mean large scale precipitation
'lpratsfc' = {
table2Version = 200 ;
indicatorOfParameter = 62 ;
}
#Mean convective precipitation
'cpratsfc' = {
table2Version = 200 ;
indicatorOfParameter = 63 ;
}
#Mean snowfall rate water equivalent
'srweqsfc' = {
table2Version = 200 ;
indicatorOfParameter = 64 ;
}
#Mean surface water runoff
'rofsfc' = {
table2Version = 200 ;
indicatorOfParameter = 90 ;
}
#Square of Brunt-Vaisala frequency
'bvf2tht' = {
table2Version = 200 ;
indicatorOfParameter = 132 ;
}
#Adiabatic zonal acceleration
'aduahbl' = {
table2Version = 200 ;
indicatorOfParameter = 151 ;
}
#Adiabatic meridional acceleration
'advaprs' = {
table2Version = 200 ;
indicatorOfParameter = 165 ;
}
#Mean frequency of deep convection
'frcvsfc' = {
table2Version = 200 ;
indicatorOfParameter = 170 ;
}
#Mean frequency of shallow convection
'frcvssfc' = {
table2Version = 200 ;
indicatorOfParameter = 171 ;
}
#Mean frequency of stratocumulus parameterisation
'frscsfc' = {
table2Version = 200 ;
indicatorOfParameter = 172 ;
}
#Gravity wave zonal acceleration
'gwduahbl' = {
table2Version = 200 ;
indicatorOfParameter = 173 ;
}
#Gravity wave meridional acceleration
'gwdvahbl' = {
table2Version = 200 ;
indicatorOfParameter = 174 ;
}
#Mean evapotranspiration
'ltrssfc' = {
table2Version = 200 ;
indicatorOfParameter = 202 ;
}
#Adiabatic heating rate
'adhrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 222 ;
}
#Moisture storage on canopy
'mscsfc' = {
table2Version = 200 ;
indicatorOfParameter = 223 ;
}
#Moisture storage on ground or cover
'msgsfc' = {
table2Version = 200 ;
indicatorOfParameter = 224 ;
}
#Mass concentration of condensed water in soil
'smcugl' = {
table2Version = 200 ;
indicatorOfParameter = 226 ;
}
#Upward mass flux at cloud base
'mflxbhbl' = {
table2Version = 200 ;
indicatorOfParameter = 230 ;
}
#Upward mass flux
'mfluxhbl' = {
table2Version = 200 ;
indicatorOfParameter = 231 ;
}
#Adiabatic moistening rate
'admrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 236 ;
}
#Ozone mixing ratio
'ozonehbl' = {
table2Version = 200 ;
indicatorOfParameter = 237 ;
}
#Convective zonal acceleration
'cnvuahbl' = {
table2Version = 200 ;
indicatorOfParameter = 239 ;
}
#Mean zonal momentum flux by long gravity wave
'fglusfc' = {
table2Version = 200 ;
indicatorOfParameter = 147 ;
}
#Mean meridional momentum flux by long gravity wave
'fglvsfc' = {
table2Version = 200 ;
indicatorOfParameter = 148 ;
}
#Mean meridional momentum flux by short gravity wave
'fgsvsfc' = {
table2Version = 200 ;
indicatorOfParameter = 154 ;
}
#Mean zonal momentum flux by short gravity wave
'fgsusfc' = {
table2Version = 200 ;
indicatorOfParameter = 159 ;
}
#Convective meridional acceleration
'cnvvahbl' = {
table2Version = 200 ;
indicatorOfParameter = 240 ;
}
#Large scale condensation heating rate
'lrghrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 241 ;
}
#Convective heating rate
'cnvhrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 242 ;
}
#Convective moistening rate
'cnvmrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 243 ;
}
#Vertical diffusion heating rate
'vdfhrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 246 ;
}
#Vertical diffusion zonal acceleration
'vdfuahbl' = {
table2Version = 200 ;
indicatorOfParameter = 247 ;
}
#Vertical diffusion meridional acceleration
'vdfvahbl' = {
table2Version = 200 ;
indicatorOfParameter = 248 ;
}
#Vertical diffusion moistening rate
'vdfmrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 249 ;
}
#Solar radiative heating rate
'swhrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 250 ;
}
#Long wave radiative heating rate
'lwhrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 251 ;
}
#Large scale moistening rate
'lrgmrhbl' = {
table2Version = 200 ;
indicatorOfParameter = 253 ;
}
#Type of vegetation
'tovg' = {
table2Version = 200 ;
indicatorOfParameter = 252 ;
}
#Virtual temperature
'vtmp' = {
table2Version = 200 ;
indicatorOfParameter = 12 ;
}
#Vertical velocity
'omg2' = {
table2Version = 200 ;
indicatorOfParameter = 40 ;
}
#Interception loss
'pitp' = {
table2Version = 200 ;
indicatorOfParameter = 203 ;
}
#Soil wetness of surface
'ussl' = {
table2Version = 200 ;
indicatorOfParameter = 225 ;
}
#Temperature at canopy
'ctmp' = {
table2Version = 200 ;
indicatorOfParameter = 144 ;
}
#Ground/surface cover temperature
'tgsc' = {
table2Version = 200 ;
indicatorOfParameter = 145 ;
}
#Pressure tendency
'ptend' = {
table2Version = 200 ;
indicatorOfParameter = 3 ;
}
#ICAO Standard Atmosphere reference height
'icaht' = {
table2Version = 200 ;
indicatorOfParameter = 5 ;
}
#Geometrical height
'h' = {
table2Version = 200 ;
indicatorOfParameter = 8 ;
}
#Standard deviation of height
'hstdv' = {
table2Version = 200 ;
indicatorOfParameter = 9 ;
}
#Pseudo-adiabatic potential temperature
'papt' = {
table2Version = 200 ;
indicatorOfParameter = 14 ;
}
#Maximum temperature
'tmax' = {
table2Version = 200 ;
indicatorOfParameter = 15 ;
}
#Minimum temperature
'tmin' = {
table2Version = 200 ;
indicatorOfParameter = 16 ;
}
#Dew point temperature
'dpt' = {
table2Version = 200 ;
indicatorOfParameter = 17 ;
}
#Dew point depression (or deficit)
'depr' = {
table2Version = 200 ;
indicatorOfParameter = 18 ;
}
#Lapse rate
'lapr' = {
table2Version = 200 ;
indicatorOfParameter = 19 ;
}
#Visibility
'vis' = {
table2Version = 200 ;
indicatorOfParameter = 20 ;
}
#Radar spectra (1)
'rdsp1' = {
table2Version = 200 ;
indicatorOfParameter = 21 ;
}
#Radar spectra (2)
'rdsp2' = {
table2Version = 200 ;
indicatorOfParameter = 22 ;
}
#Radar spectra (3)
'rdsp3' = {
table2Version = 200 ;
indicatorOfParameter = 23 ;
}
#Parcel lifted index (to 500 hPa)
'pli' = {
table2Version = 200 ;
indicatorOfParameter = 24 ;
}
#Temperature anomaly
'ta' = {
table2Version = 200 ;
indicatorOfParameter = 25 ;
}
#Pressure anomaly
'presa' = {
table2Version = 200 ;
indicatorOfParameter = 26 ;
}
#Geopotential height anomaly
'gpa' = {
table2Version = 200 ;
indicatorOfParameter = 27 ;
}
#Wave spectra (1)
'wvsp1' = {
table2Version = 200 ;
indicatorOfParameter = 28 ;
}
#Wave spectra (2)
'wvsp2' = {
table2Version = 200 ;
indicatorOfParameter = 29 ;
}
#Wave spectra (3)
'wvsp3' = {
table2Version = 200 ;
indicatorOfParameter = 30 ;
}
#Wind direction
'wdir' = {
table2Version = 200 ;
indicatorOfParameter = 31 ;
}
#Sigma coordinate vertical velocity
'sgcvv' = {
table2Version = 200 ;
indicatorOfParameter = 38 ;
}
#Absolute vorticity
'absv' = {
table2Version = 200 ;
indicatorOfParameter = 41 ;
}
#Absolute divergence
'absd' = {
table2Version = 200 ;
indicatorOfParameter = 42 ;
}
#Vertical u-component shear
'vucsh' = {
table2Version = 200 ;
indicatorOfParameter = 45 ;
}
#Vertical v-component shear
'vvcsh' = {
table2Version = 200 ;
indicatorOfParameter = 46 ;
}
#Direction of current
'dirc' = {
table2Version = 200 ;
indicatorOfParameter = 47 ;
}
#Speed of current
'spc' = {
table2Version = 200 ;
indicatorOfParameter = 48 ;
}
#Humidity mixing ratio
'mixr' = {
table2Version = 200 ;
indicatorOfParameter = 53 ;
}
#Vapour pressure
'vp' = {
table2Version = 200 ;
indicatorOfParameter = 55 ;
}
#Saturation deficit
'satd' = {
table2Version = 200 ;
indicatorOfParameter = 56 ;
}
#Precipitation rate
'prate' = {
table2Version = 200 ;
indicatorOfParameter = 59 ;
}
#Thunderstorm probability
'tstm' = {
table2Version = 200 ;
indicatorOfParameter = 60 ;
}
#Mixed layer depth
'mld' = {
table2Version = 200 ;
indicatorOfParameter = 67 ;
}
#Transient thermocline depth
'tthdp' = {
table2Version = 200 ;
indicatorOfParameter = 68 ;
}
#Main thermocline depth
'mthd' = {
table2Version = 200 ;
indicatorOfParameter = 69 ;
}
#Main thermocline anomaly
'mtha' = {
table2Version = 200 ;
indicatorOfParameter = 70 ;
}
#Best lifted index (to 500 hPa)
'bli' = {
table2Version = 200 ;
indicatorOfParameter = 77 ;
}
#Water temperature
'wtmp' = {
table2Version = 200 ;
indicatorOfParameter = 80 ;
}
#Deviation of sea-level from mean
'dslm' = {
table2Version = 200 ;
indicatorOfParameter = 82 ;
}
#Soil moisture content
'ssw' = {
table2Version = 200 ;
indicatorOfParameter = 86 ;
}
#Salinity
's' = {
table2Version = 200 ;
indicatorOfParameter = 88 ;
}
#Density
'den' = {
table2Version = 200 ;
indicatorOfParameter = 89 ;
}
#Ice thickness
'icetk' = {
table2Version = 200 ;
indicatorOfParameter = 92 ;
}
#Direction of ice drift
'diced' = {
table2Version = 200 ;
indicatorOfParameter = 93 ;
}
#Speed of ice drift
'siced' = {
table2Version = 200 ;
indicatorOfParameter = 94 ;
}
#U-component of ice drift
'uice' = {
table2Version = 200 ;
indicatorOfParameter = 95 ;
}
#V-component of ice drift
'vice' = {
table2Version = 200 ;
indicatorOfParameter = 96 ;
}
#Ice growth rate
'iceg' = {
table2Version = 200 ;
indicatorOfParameter = 97 ;
}
#Ice divergence
'iced' = {
table2Version = 200 ;
indicatorOfParameter = 98 ;
}
#Snowmelt
'snom' = {
table2Version = 200 ;
indicatorOfParameter = 99 ;
}
#Signific.height,combined wind waves+swell
'swh' = {
table2Version = 200 ;
indicatorOfParameter = 100 ;
}
#Mean direction of wind waves
'mdww' = {
table2Version = 200 ;
indicatorOfParameter = 101 ;
}
#Significant height of wind waves
'shww' = {
table2Version = 200 ;
indicatorOfParameter = 102 ;
}
#Mean period of wind waves
'mpww' = {
table2Version = 200 ;
indicatorOfParameter = 103 ;
}
#Direction of swell waves
'swdir' = {
table2Version = 200 ;
indicatorOfParameter = 104 ;
}
#Significant height of swell waves
'swell' = {
table2Version = 200 ;
indicatorOfParameter = 105 ;
}
#Mean period of swell waves
'swper' = {
table2Version = 200 ;
indicatorOfParameter = 106 ;
}
#Primary wave direction
'mdps' = {
table2Version = 200 ;
indicatorOfParameter = 107 ;
}
#Primary wave mean period
'mpps' = {
table2Version = 200 ;
indicatorOfParameter = 108 ;
}
#Secondary wave direction
'dirsw' = {
table2Version = 200 ;
indicatorOfParameter = 109 ;
}
#Secondary wave mean period
'swp' = {
table2Version = 200 ;
indicatorOfParameter = 110 ;
}
#Net short-wave radiation flux (surface)
'nswrs' = {
table2Version = 200 ;
indicatorOfParameter = 111 ;
}
#Net long-wave radiation flux (surface)
'nlwrs' = {
table2Version = 200 ;
indicatorOfParameter = 112 ;
}
#Net short-wave radiation flux(atmosph.top)
'nswrt' = {
table2Version = 200 ;
indicatorOfParameter = 113 ;
}
#Net long-wave radiation flux(atmosph.top)
'nlwrt' = {
table2Version = 200 ;
indicatorOfParameter = 114 ;
}
#Long wave radiation flux
'lwavr' = {
table2Version = 200 ;
indicatorOfParameter = 115 ;
}
#Short wave radiation flux
'swavr' = {
table2Version = 200 ;
indicatorOfParameter = 116 ;
}
#Global radiation flux
'grad' = {
table2Version = 200 ;
indicatorOfParameter = 117 ;
}
#Radiance (with respect to wave number)
'lwrad' = {
table2Version = 200 ;
indicatorOfParameter = 119 ;
}
#Radiance (with respect to wave length)
'swrad' = {
table2Version = 200 ;
indicatorOfParameter = 120 ;
}
#Momentum flux, u-component
'uflx' = {
table2Version = 200 ;
indicatorOfParameter = 124 ;
}
#Momentum flux, v-component
'vflx' = {
table2Version = 200 ;
indicatorOfParameter = 125 ;
}
#Wind mixing energy
'wmixe' = {
table2Version = 200 ;
indicatorOfParameter = 126 ;
}
#Image data
'imgd' = {
table2Version = 200 ;
indicatorOfParameter = 127 ;
}
#Cloud liquid water
'clw' = {
table2Version = 200 ;
indicatorOfParameter = 228 ;
}
#Percentage of vegetation
'vegrea' = {
table2Version = 200 ;
indicatorOfParameter = 87 ;
}
#Vertical integral of eastward heat flux
'vithee' = {
table2Version = 200 ;
indicatorOfParameter = 190 ;
}
#Vertical integral of northward heat flux
'vithen' = {
table2Version = 200 ;
indicatorOfParameter = 191 ;
}
#Vertical integral of eastward water vapour flux
'viwve' = {
table2Version = 200 ;
indicatorOfParameter = 157 ;
}
#Vertical integral of northward water vapour flux
'viwvn' = {
table2Version = 200 ;
indicatorOfParameter = 152 ;
}
#specific cloud water content
'qc' = {
table2Version = 200 ;
indicatorOfParameter = 221 ;
}
#Soil temperature
'st' = {
table2Version = 200 ;
indicatorOfParameter = 85 ;
}
#Snow depth water equivalent
'sd' = {
table2Version = 200 ;
indicatorOfParameter = 65 ;
}
#Total Cloud Cover
'tcc' = {
table2Version = 200 ;
indicatorOfParameter = 71 ;
}

View File

@ -158,8 +158,11 @@ concept paramId (paramIdECMF,"paramId.def",conceptsDir2,conceptsDir1): long_type
concept cfNameECMF(defaultName,"cfName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,read_only;
concept cfName(cfNameECMF,"cfName.def",conceptsDir2,conceptsDir1) : dump,no_copy,read_only;
concept cfVarNameECMF(defaultName,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,read_only;
concept cfVarName(cfVarNameECMF,"cfVarName.def",conceptsDir2,conceptsDir1) : dump,no_copy,read_only;
#concept cfVarNameECMF(defaultName,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,read_only;
#concept cfVarName(cfVarNameECMF,"cfVarName.def",conceptsDir2,conceptsDir1) : dump,no_copy,read_only;
# See ECC-1886
meta defaultCfVarName cf_var_name(shortName) : hidden, read_only;
concept cfVarName(defaultCfVarName,"cfVarName.def",conceptsDir2,conceptsDir1) : dump,no_copy,read_only;
concept unitsECMF(defaultName,"units.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,read_only;
concept units(unitsECMF,"units.def",conceptsDir2,conceptsDir1) : dump,no_copy,read_only;

File diff suppressed because it is too large Load Diff

View File

@ -1,188 +0,0 @@
#Volumetric soil moisture content
'soilw' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 9 ;
}
#Upper layer soil temperature
'uplst' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 1 ;
}
#Upper layer soil moisture
'uplsm' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 2 ;
}
#Lower layer soil moisture
'lowlsm' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 3 ;
}
#Bottom layer soil temperature
'botlst' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 4 ;
}
#Liquid volumetric soil moisture (non-frozen)
'soill' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 5 ;
}
#Transpiration stress-onset (soil moisture)
'smref' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 7 ;
}
#Direct evaporation cease (soil moisture)
'smdry' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 8 ;
}
#Soil porosity
'poros' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 9 ;
}
#Instantaneous eastward turbulent surface stress
'iews' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 38 ;
typeOfFirstFixedSurface = 1 ;
}
#Instantaneous northward turbulent surface stress
'inss' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 37 ;
typeOfFirstFixedSurface = 1 ;
}
#Evaporation in the last 6 hours
'eva06' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 79 ;
typeOfFirstFixedSurface = 1 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 1 ;
lengthOfTimeRange = 6 ;
}
#Time-mean evapotranspiration rate in the last 24h
'avg_et24' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 39 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 0 ;
lengthOfTimeRange = 24 ;
}
#Time-integrated potential evapotranspiration rate in the last 24h
'acc_pet24' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 40 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 1 ;
lengthOfTimeRange = 24 ;
}
#Time-mean potential evapotranspiration rate in the last 24h
'avg_pet24' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 40 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 0 ;
lengthOfTimeRange = 24 ;
}
#Time-mean volumetric soil moisture
'avg_swv24' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 25 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 0 ;
lengthOfTimeRange = 24 ;
}
#Time-integrated water runoff and drainage rate in the last 24h
'acc_rod24' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 42 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 1 ;
lengthOfTimeRange = 24 ;
}
#Time-mean water runoff and drainage rate in the last 24h
'avg_rod24' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 42 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 0 ;
lengthOfTimeRange = 24 ;
}
#Time-mean snow depth water equivalent
'avg_sd24' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 60 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 0 ;
lengthOfTimeRange = 24 ;
}
#Time-mean skin temperature
'avg_skt24' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 17 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 0 ;
lengthOfTimeRange = 24 ;
}
#Time-integrated snow melt rate in the last 24h
'acc_smr24' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 41 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 1 ;
lengthOfTimeRange = 24 ;
}
#Upward sea water velocity
'wo' = {
discipline = 10 ;
parameterCategory = 4 ;
parameterNumber = 27 ;
typeOfFirstFixedSurface = 168 ;
typeOfSecondFixedSurface = 168 ;
}
#Time-mean upward sea water velocity
'avg_wo' = {
discipline = 10 ;
parameterCategory = 4 ;
parameterNumber = 27 ;
typeOfFirstFixedSurface = 168 ;
typeOfSecondFixedSurface = 168 ;
typeOfStatisticalProcessing = 0 ;
}
#Maximum individual wave height
'hmax' = {
discipline = 10 ;
parameterCategory = 0 ;
parameterNumber = 24 ;
}
#Soil temperature
'st' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 2 ;
}

View File

@ -15,5 +15,5 @@ constant secondsOfAnalysis = 0;
meta dateOfAnalysis g2date(yearOfAnalysis,monthOfAnalysis,dayOfAnalysis) : dump;
meta timeOfAnalysis time(hourOfAnalysis,minuteOfAnalysis,secondsOfAnalysis) : dump;
alias date = dateOfAnalysis;
alias time = timeOfAnalysis;
alias mars.date = dateOfAnalysis;
alias mars.time = timeOfAnalysis;

View File

@ -1,22 +1,4 @@
# Automatically generated by ./create_def.pl, do not edit
#Surface runoff
'sro' = {
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 202 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Sub-surface runoff
'ssro' = {
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 204 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Maximum temperature at 2 metres in the last 24 hours
'mx2t24' = {
discipline = 0 ;
@ -40,233 +22,4 @@
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 3 ;
lengthOfTimeRange = 24 ;
}
#Snow depth
'sd' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 254 ;
}
#Large-scale precipitation
'lsp' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 196 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Convective precipitation
'cp' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 195 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Snowfall
'sf' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 198 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Total cloud cover
'tcc' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 6 ;
parameterNumber = 192 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
}
#Evaporation
'e' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 199 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Low cloud cover
'lcc' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 6 ;
parameterNumber = 193 ;
}
#Runoff
'ro' = {
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 201 ;
typeOfStatisticalProcessing = 1 ;
}
#Total precipitation
'tp' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 193 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 255 ;
typeOfStatisticalProcessing = 1 ;
}
#Forecast albedo
'fal' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 193 ;
}
#Mean surface runoff rate
'msror' = {
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 202 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean sub-surface runoff rate
'mssror' = {
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 204 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Potential evaporation
'pev' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 200 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Time-mean snow depth
'avg_sde' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 11 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean snow cover
'avg_snowc' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 42 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean snow depth
'avg_sd_m' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 254 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean low cloud cover
'avg_lcc_frac' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 6 ;
parameterNumber = 193 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean medium cloud cover
'avg_mcc_frac' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 6 ;
parameterNumber = 194 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean high cloud cover
'avg_hcc_frac' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 6 ;
parameterNumber = 195 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean forecast albedo
'avg_fal_frac' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 193 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean large-scale precipitation rate
'mlsprt' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 196 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean convective precipitation rate
'cprate' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 195 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean total snowfall rate
'mtsfr' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 198 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Evaporation
'erate' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 199 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean runoff rate
'mrort' = {
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 201 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean total precipitation rate
'tprate' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 193 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean total cloud cover
'meantcc' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 6 ;
parameterNumber = 192 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 0 ;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,19 @@
# Automatically generated by ./create_def.pl, do not edit
#Sea ice area fraction
'ci' = {
'siconc' = {
discipline = 10 ;
parameterCategory = 2 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 1 ;
}
#Sea ice area fraction
'ci' = {
'siconc' = {
discipline = 10 ;
parameterCategory = 2 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Snow density
'rsn' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 61 ;
typeOfStatisticalProcessing = 0 ;
}
#Sea surface temperature
'sst' = {
discipline = 10 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Maximum temperature at 2 metres in the last 6 hours
'mx2t6' = {
discipline = 0 ;
@ -53,15 +38,6 @@
typeOfStatisticalProcessing = 3 ;
lengthOfTimeRange = 6 ;
}
#Total column water
'tcw' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 51 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 0 ;
}
#2 metre temperature
't2m' = {
discipline = 0 ;
@ -101,7 +77,7 @@
scaleFactorOfFirstFixedSurface = 1 ;
}
#2 metre dewpoint temperature
'd2' = {
'd2m' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 6 ;
@ -110,123 +86,8 @@
scaleFactorOfFirstFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-integrated eastward turbulent surface stress
'ewss' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 38 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Time-integrated northward turbulent surface stress
'nsss' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 37 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Skin temperature
'skt' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 17 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean sea water potential temperature in the upper 300 m
'mswpt300m' = {
discipline = 10 ;
parameterCategory = 4 ;
parameterNumber = 18 ;
typeOfFirstFixedSurface = 160 ;
typeOfSecondFixedSurface = 160 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 300 ;
scaleFactorOfSecondFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Sea surface practical salinity
'sos' = {
discipline = 10 ;
parameterCategory = 3 ;
parameterNumber = 3 ;
typeOfFirstFixedSurface = 160 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
typeOfStatisticalProcessing = 0 ;
}
#Ocean mixed layer thickness defined by sigma theta 0.01 kg/m3
'mlotst010' = {
discipline = 10 ;
parameterCategory = 4 ;
parameterNumber = 14 ;
typeOfFirstFixedSurface = 169 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = 1 ;
scaleFactorOfFirstFixedSurface = 2 ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
typeOfStatisticalProcessing = 0 ;
}
#Soil moisture top 20 cm
'sm20' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 22 ;
typeOfFirstFixedSurface = 106 ;
typeOfSecondFixedSurface = 106 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 2 ;
scaleFactorOfSecondFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Soil moisture top 100 cm
'sm100' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 22 ;
typeOfFirstFixedSurface = 106 ;
typeOfSecondFixedSurface = 106 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 10 ;
scaleFactorOfSecondFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Soil temperature top 20 cm
'st20' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 2 ;
typeOfFirstFixedSurface = 106 ;
typeOfSecondFixedSurface = 106 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 2 ;
scaleFactorOfSecondFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Soil temperature top 100 cm
'st100' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 2 ;
typeOfFirstFixedSurface = 106 ;
typeOfSecondFixedSurface = 106 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 10 ;
scaleFactorOfSecondFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Eastward surface sea water velocity
'ocu' = {
'uoe' = {
discipline = 10 ;
parameterCategory = 1 ;
parameterNumber = 2 ;
@ -234,69 +95,10 @@
typeOfStatisticalProcessing = 0 ;
}
#Northward surface sea water velocity
'ocv' = {
'von' = {
discipline = 10 ;
parameterCategory = 1 ;
parameterNumber = 3 ;
typeOfFirstFixedSurface = 160 ;
typeOfStatisticalProcessing = 0 ;
}
#Sea surface height
'zos' = {
discipline = 10 ;
parameterCategory = 3 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 160 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
typeOfStatisticalProcessing = 0 ;
}
#Depth of 20C isotherm
't20d' = {
discipline = 10 ;
parameterCategory = 4 ;
parameterNumber = 14 ;
typeOfFirstFixedSurface = 20 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = 29315 ;
scaleFactorOfFirstFixedSurface = 2 ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
typeOfStatisticalProcessing = 0 ;
}
#Average sea water practical salinity in the upper 300m
'sav300' = {
discipline = 10 ;
parameterCategory = 4 ;
parameterNumber = 21 ;
typeOfFirstFixedSurface = 160 ;
typeOfSecondFixedSurface = 160 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 300 ;
scaleFactorOfSecondFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Sea-ice thickness
'sithick' = {
discipline = 10 ;
parameterCategory = 2 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 160 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
typeOfStatisticalProcessing = 0 ;
}
#Snow depth water equivalent
'sd' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 60 ;
typeOfStatisticalProcessing = 0 ;
}

View File

@ -1,67 +1,43 @@
# Automatically generated by ./create_def.pl, do not edit
#Maximum temperature at 2 metres in the last 6 hours
'mx2t6' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 103 ;
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 15 ;
scaleFactorOfFirstFixedSurface = 1 ;
indicatorOfUnitForTimeRange = 1 ;
scaleFactorOfFirstFixedSurface = 1 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 2 ;
lengthOfTimeRange = 6 ;
}
lengthOfTimeRange = 6 ;
}
#Minimum temperature at 2 metres in the last 6 hours
'mn2t6' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 103 ;
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 15 ;
scaleFactorOfFirstFixedSurface = 1 ;
indicatorOfUnitForTimeRange = 1 ;
scaleFactorOfFirstFixedSurface = 1 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 3 ;
lengthOfTimeRange = 6 ;
}
lengthOfTimeRange = 6 ;
}
#2 metre temperature
't2m' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 15 ;
scaleFactorOfFirstFixedSurface = 1 ;
}
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 15 ;
scaleFactorOfFirstFixedSurface = 1 ;
}
#2 metre dewpoint temperature
'd2m' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 6 ;
typeOfFirstFixedSurface = 103 ;
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 6 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 15 ;
scaleFactorOfFirstFixedSurface = 1 ;
}
#Soil moisture
'sm' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 22 ;
typeOfFirstFixedSurface = 106 ;
typeOfSecondFixedSurface = 106 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 2 ;
scaleFactorOfSecondFixedSurface = 1 ;
}
#Soil temperature
'st' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 2 ;
typeOfFirstFixedSurface = 106 ;
typeOfSecondFixedSurface = 106 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = 2 ;
scaleFactorOfSecondFixedSurface = 1 ;
}
scaleFactorOfFirstFixedSurface = 1 ;
}

View File

@ -1,72 +1,12 @@
# Automatically generated by ./create_def.pl, do not edit
#Wind speed
'ws' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 100 ;
scaleFactorOfFirstFixedSurface = 0 ;
}
#Wind speed
'ws' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 200 ;
scaleFactorOfFirstFixedSurface = 0 ;
}
#Wind speed
'ws' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Wind speed
'ws' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 100 ;
scaleFactorOfFirstFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Wind speed
'ws' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 103 ;
scaledValueOfFirstFixedSurface = 200 ;
scaleFactorOfFirstFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Sea ice area fraction
'ci' = {
'siconc' = {
discipline = 10 ;
parameterCategory = 2 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Snow density
'rsn' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 61 ;
typeOfStatisticalProcessing = 0 ;
}
#Sea surface temperature
'sst' = {
discipline = 10 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Maximum 10 metre wind gust since previous post-processing
'fg10' = {
discipline = 0 ;
@ -102,110 +42,6 @@
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 2 ;
}
#Pressure
'pres' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Potential vorticity
'pv' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 14 ;
typeOfStatisticalProcessing = 0 ;
}
#Specific rain water content
'crwc' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 85 ;
typeOfStatisticalProcessing = 0 ;
}
#Specific snow water content
'cswc' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 86 ;
typeOfStatisticalProcessing = 0 ;
}
#Total column cloud liquid water
'tclw' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 69 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 0 ;
}
#Total column cloud ice water
'tciw' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 70 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 0 ;
}
#Geopotential
'z' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 4 ;
typeOfStatisticalProcessing = 0 ;
}
#Temperature
't' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#U component of wind
'u' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 2 ;
typeOfStatisticalProcessing = 0 ;
}
#V component of wind
'v' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 3 ;
typeOfStatisticalProcessing = 0 ;
}
#Specific humidity
'q' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Surface pressure
'sp' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Mean sea level pressure
'msl' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 101 ;
typeOfStatisticalProcessing = 0 ;
}
#Relative humidity
'r' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#10 metre U wind component
'u10' = {
discipline = 0 ;
@ -245,21 +81,6 @@
scaleFactorOfFirstFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Surface roughness (climatological)
'sr' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 1 ;
}
#Top net short-wave (solar) radiation
'tsr' = {
discipline = 0 ;
parameterCategory = 4 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 8 ;
typeOfStatisticalProcessing = 1 ;
}
#Maximum temperature at 2 metres since previous post-processing
'mx2t' = {
discipline = 0 ;
@ -334,28 +155,6 @@
scaleFactorOfFirstFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Skin temperature
'skt' = {
discipline = 0 ;
parameterCategory = 0 ;
parameterNumber = 17 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 0 ;
}
#Specific cloud liquid water content
'clwc' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 83 ;
typeOfStatisticalProcessing = 0 ;
}
#Specific cloud ice water content
'ciwc' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 84 ;
typeOfStatisticalProcessing = 0 ;
}
#2 metre specific humidity
'sh2' = {
discipline = 0 ;
@ -367,61 +166,6 @@
scaleFactorOfFirstFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Precipitation type
'ptype' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 19 ;
typeOfStatisticalProcessing = 0 ;
}
#Total column integrated water vapour
'tciwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
}
#Total column integrated water vapour
'tciwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 0 ;
}
#Momentum flux, u component
'uflx' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 17 ;
}
#Momentum flux, v component
'vflx' = {
discipline = 0 ;
parameterCategory = 2 ;
parameterNumber = 18 ;
}
#Standard deviation of sub-grid scale orography
'sdsgso' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 20 ;
}
#Cloud base
'cdcb' = {
discipline = 0 ;
parameterCategory = 6 ;
parameterNumber = 11 ;
}
#Volumetric soil moisture
'vsw' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 25 ;
typeOfStatisticalProcessing = 0 ;
}
#2 metre relative humidity
'r2' = {
discipline = 0 ;
@ -440,104 +184,4 @@
scaledValueOfFirstFixedSurface = 2 ;
scaleFactorOfFirstFixedSurface = 0 ;
typeOfStatisticalProcessing = 0 ;
}
#Evaporation
'eva' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 79 ;
typeOfFirstFixedSurface = 1 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 1 ;
lengthOfTimeRange = 6 ;
}
#Evaporation
'eva' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 79 ;
typeOfFirstFixedSurface = 1 ;
indicatorOfUnitForTimeRange = 1 ;
typeOfStatisticalProcessing = 1 ;
lengthOfTimeRange = 24 ;
}
#Time-integrated surface direct short wave radiation flux
'tidirswrf' = {
discipline = 0 ;
parameterCategory = 4 ;
parameterNumber = 13 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Fraction of snow cover
'fscov' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 121 ;
typeOfStatisticalProcessing = 0 ;
}
#Accumulated surface downward short-wave radiation flux, clear sky
'adswrf_cs' = {
discipline = 0 ;
parameterCategory = 4 ;
parameterNumber = 52 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Accumulated surface downward long-wave radiation flux, clear sky
'adlwrf_cs' = {
discipline = 0 ;
parameterCategory = 5 ;
parameterNumber = 8 ;
typeOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 1 ;
}
#Sea ice surface temperature
'sist' = {
discipline = 10 ;
parameterCategory = 2 ;
parameterNumber = 8 ;
typeOfFirstFixedSurface = 174 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = missing() ;
scaleFactorOfFirstFixedSurface = missing() ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
}
#Snow on ice total depth
'sitd' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 11 ;
typeOfFirstFixedSurface = 174 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = missing() ;
scaleFactorOfFirstFixedSurface = missing() ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
}
#Snowmelt
'snom' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 16 ;
}
#Sea-ice thickness
'sithick' = {
discipline = 10 ;
parameterCategory = 2 ;
parameterNumber = 1 ;
typeOfFirstFixedSurface = 160 ;
typeOfSecondFixedSurface = 255 ;
scaledValueOfFirstFixedSurface = 0 ;
scaleFactorOfFirstFixedSurface = 0 ;
scaledValueOfSecondFixedSurface = missing() ;
scaleFactorOfSecondFixedSurface = missing() ;
}
#Snow depth water equivalent
'sd' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 60 ;
typeOfStatisticalProcessing = 0 ;
}

View File

@ -22,9 +22,12 @@ concept cfNameLegacyECMF(defaultShortName,"cfName.legacy.def",conceptsMasterDir,
concept cfNameECMF(cfNameLegacyECMF,"cfName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy;
concept cfName(cfNameECMF,"cfName.def",conceptsDir2,conceptsDir1) : no_copy,dump;
concept cfVarNameLegacyECMF(defaultShortName,"cfVarName.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden;
concept cfVarNameECMF (cfVarNameLegacyECMF,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy;
concept cfVarName (cfVarNameECMF,"cfVarName.def",conceptsDir2,conceptsDir1): no_copy,dump;
# concept cfVarNameLegacyECMF(defaultShortName,"cfVarName.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden;
# concept cfVarNameECMF (cfVarNameLegacyECMF,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy;
# concept cfVarName (cfVarNameECMF,"cfVarName.def",conceptsDir2,conceptsDir1): no_copy,dump;
# See ECC-1886
meta defaultCfVarName cf_var_name(shortName) : no_copy,hidden,read_only;
concept cfVarName (defaultCfVarName, "cfVarName.def", conceptsDir2, conceptsDir1): no_copy,dump,read_only;
if (chem_param_split == 1) {
# Note: 0 is a valid chemId

View File

@ -4,7 +4,7 @@
# Note from WMO document:
# This template is experimental, was not validated at the time of publication and should be used only for bilateral previously agreed tests
transient template_is_deprecated = 1 : hidden;
transient template_is_experimental = 1 : hidden;
meta codedValues data_g2simple_packing_with_preprocessing(
section7Length,

View File

@ -0,0 +1,5 @@
alias mars.anoffset=offsetToEndOf4DvarWindow;
alias mars.number=perturbationNumber;
unalias mars.levtype;
unalias mars.levelist;

View File

@ -0,0 +1,4 @@
alias mars.number=perturbationNumber;
unalias mars.levtype;
unalias mars.levelist;

View File

@ -74,3 +74,4 @@
93 ppm Point value metrics
94 gwt Weather types
95 est Ensemble statistics
96 mpp Model physics perturbations

View File

@ -960,10 +960,10 @@
!> @param nmessages number of messages found
!> @param status CODES_SUCCESS if OK, CODES_END_OF_FILE at the end of file, or error code
subroutine codes_any_scan_file(ifile, nmessages, status)
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt), intent(out) :: nmessages
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt), intent(out) :: nmessages
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt), optional, intent(out) :: status
iret = any_f_scan_file(ifile, nmessages)
if (present(status)) then
@ -989,8 +989,8 @@
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt), intent(in) :: nmsg
integer(kind=kindOfInt), intent(out) :: msgid
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt), optional, intent(out) :: status
iret = any_f_new_from_scanned_file(ifile, nmsg, msgid)
if (present(status)) then
@ -1007,10 +1007,10 @@
!> @param nmessages number of messages loaded
!> @param status CODES_SUCCESS if OK, CODES_END_OF_FILE at the end of file, or error code
subroutine codes_any_load_all_from_file(ifile, nmessages, status)
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt), intent(out) :: nmessages
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt), intent(out) :: nmessages
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt), optional, intent(out) :: status
iret = any_f_load_all_from_file(ifile, nmessages)
if (present(status)) then
@ -2789,43 +2789,37 @@
!> @param path samples path
!> @param status CODES_SUCCESS if OK, integer value on error
subroutine codes_set_samples_path(path, status)
character(len=*), intent(in) :: path
character(len=*), intent(in) :: path
integer(kind=kindOfInt), optional, intent(out) :: status
call grib_set_samples_path(path, status)
end subroutine codes_set_samples_path
subroutine codes_julian_to_datetime(jd, year, month, day, hour, minute, second, status)
real(kind=kindOfDouble), intent(in) :: jd
integer(kind=kindOfLong), intent(out) :: year, month, day, hour, minute, second
integer(kind=kindOfInt), optional, intent(out) :: status
real(kind=kindOfDouble), intent(in) :: jd
integer(kind=kindOfLong), intent(out) :: year, month, day, hour, minute, second
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_julian_to_datetime(jd, year, month, day, hour, minute, second)
if (iret /= 0) then
if (present(status)) then
status = iret
else
call grib_check(iret, 'codes_julian_to_datetime', ' ')
end if
return
if (present(status)) then
status = iret
else
call grib_check(iret, 'codes_julian_to_datetime', ' ')
end if
end subroutine codes_julian_to_datetime
subroutine codes_datetime_to_julian(year, month, day, hour, minute, second, jd, status)
integer(kind=kindOfLong), intent(in) :: year, month, day, hour, minute, second
real(kind=kindOfDouble), intent(out) :: jd
integer(kind=kindOfLong), intent(in) :: year, month, day, hour, minute, second
real(kind=kindOfDouble), intent(out) :: jd
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: iret
iret = grib_f_datetime_to_julian(year, month, day, hour, minute, second, jd)
if (iret /= 0) then
if (present(status)) then
status = iret
else
call grib_check(iret, 'codes_datetime_to_julian', ' ')
end if
return
if (present(status)) then
status = iret
else
call grib_check(iret, 'codes_datetime_to_julian', ' ')
end if
end subroutine codes_datetime_to_julian
@ -2840,11 +2834,11 @@
!> @param key key whose value is to be copied
!> @param status GRIB_SUCCESS if OK, integer value on error
subroutine codes_copy_key(msgid_src, key, msgid_dest, status)
integer(kind=kindOfInt), intent(in) :: msgid_src
integer(kind=kindOfInt), intent(in) :: msgid_dest
character(LEN=*), intent(in) :: key
integer(kind=kindOfInt), intent(in) :: msgid_src
integer(kind=kindOfInt), intent(in) :: msgid_dest
character(LEN=*), intent(in) :: key
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: iret
iret = grib_f_copy_key(msgid_src, key, msgid_dest)
if (present(status)) then
@ -2856,7 +2850,7 @@
subroutine codes_bufr_multi_element_constant_arrays_on(status)
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: iret
iret = codes_f_bufr_multi_element_constant_arrays_on()
if (present(status)) then
@ -2868,7 +2862,7 @@
subroutine codes_bufr_multi_element_constant_arrays_off(status)
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: iret
iret = codes_f_bufr_multi_element_constant_arrays_off()
if (present(status)) then

View File

@ -88,6 +88,7 @@ list( APPEND eccodes_src_files
accessor/grib_accessor_class_validity_date.cc
accessor/grib_accessor_class_validity_time.cc
accessor/grib_accessor_class_bytes.cc
accessor/grib_accessor_class_cf_var_name.cc
accessor/grib_accessor_class_change_alternative_row_scanning.cc
accessor/grib_accessor_class_change_scanning_direction.cc
accessor/grib_accessor_class_check_internal_version.cc

View File

@ -163,7 +163,8 @@ static int check_overridden_reference_values(const grib_context* c, long* refVal
#define DYN_ARRAY_SIZE_INIT 1000 /* Initial size for grib_iarray_new and grib_darray_new */
#define DYN_ARRAY_SIZE_INCR 1000 /* Increment size for grib_iarray_new and grib_darray_new */
void grib_accessor_class_bufr_data_array_t::init(grib_accessor* a, const long v, grib_arguments* params){
void grib_accessor_class_bufr_data_array_t::init(grib_accessor* a, const long v, grib_arguments* params)
{
grib_accessor_class_gen_t::init(a, v, params);
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
int n = 0;
@ -228,7 +229,8 @@ static int check_end_data(grib_context* c, bufr_descriptor* bd, grib_accessor_bu
return 0;
}
void self_clear(grib_context* c, grib_accessor_bufr_data_array_t* self){
void self_clear(grib_context* c, grib_accessor_bufr_data_array_t* self)
{
grib_context_free(c, self->canBeMissing);
grib_vdarray_delete_content(c, self->numericValues);
grib_vdarray_delete(c, self->numericValues);
@ -257,30 +259,36 @@ void self_clear(grib_context* c, grib_accessor_bufr_data_array_t* self){
if (self->inputBitmap) grib_context_free(c, self->inputBitmap);
}
int grib_accessor_class_bufr_data_array_t::get_native_type(grib_accessor* a){
int grib_accessor_class_bufr_data_array_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_DOUBLE;
}
long grib_accessor_class_bufr_data_array_t::byte_count(grib_accessor* a){
long grib_accessor_class_bufr_data_array_t::byte_count(grib_accessor* a)
{
return 0;
}
long grib_accessor_class_bufr_data_array_t::byte_offset(grib_accessor* a){
long grib_accessor_class_bufr_data_array_t::byte_offset(grib_accessor* a)
{
return a->offset;
}
long grib_accessor_class_bufr_data_array_t::next_offset(grib_accessor* a){
long grib_accessor_class_bufr_data_array_t::next_offset(grib_accessor* a)
{
return a->offset;
}
int grib_accessor_class_bufr_data_array_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int grib_accessor_class_bufr_data_array_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
self->do_decode = 1;
return GRIB_NOT_IMPLEMENTED;
}
int grib_accessor_class_bufr_data_array_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_bufr_data_array_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
self->do_decode = 1;
return process_elements(a, PROCESS_ENCODE, 0, 0, 0);
@ -536,7 +544,8 @@ static int encode_string_array(grib_context* c, grib_buffer* buff, long* pos, bu
return err;
}
void set_missing_long_to_double(grib_darray* dvalues){
void set_missing_long_to_double(grib_darray* dvalues)
{
size_t i, n = grib_darray_used_size(dvalues);
for (i = 0; i < n; i++) {
if (dvalues->v[i] == GRIB_MISSING_LONG)
@ -3166,14 +3175,15 @@ static int process_elements(grib_accessor* a, int flag, long onlySubset, long st
return err;
}
void grib_accessor_class_bufr_data_array_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_bufr_data_array_t::dump(grib_accessor* a, grib_dumper* dumper)
{
// grib_accessor_bufr_data_array_t *self =(grib_accessor_bufr_data_array_t*)a;
// int err=process_elements(a,PROCESS_DECODE);
// grib_dump_section(dumper,a,self->dataKeys->block);
return;
}
int grib_accessor_class_bufr_data_array_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_bufr_data_array_t::value_count(grib_accessor* a, long* count)
{
int err = 0, l;
long i;
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
@ -3196,7 +3206,8 @@ int grib_accessor_class_bufr_data_array_t::value_count(grib_accessor* a, long* c
return err;
}
int grib_accessor_class_bufr_data_array_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_bufr_data_array_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
int err = 0, i, k, ii;
int proc_flag = PROCESS_DECODE;
size_t l = 0, elementsInSubset;
@ -3249,7 +3260,8 @@ int grib_accessor_class_bufr_data_array_t::unpack_double(grib_accessor* a, doubl
return GRIB_SUCCESS;
}
void grib_accessor_class_bufr_data_array_t::destroy(grib_context* c, grib_accessor* a){
void grib_accessor_class_bufr_data_array_t::destroy(grib_context* c, grib_accessor* a)
{
grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a;
self_clear(c, self);
if (self->dataAccessors)

View File

@ -67,10 +67,8 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err)
char masterDir[1024] = {0,};
char localDir[1024] = {0,};
char dictName[1024] = {0,};
char masterRecomposed[1024] = {0,}; /*e.g. bufr/tables/0/wmo/36/element.table */
char localRecomposed[1024] = {
0,
}; /*e.g. bufr/tables/0/local/0/98/0/element.table */
char masterRecomposed[1024] = {0,}; //e.g. bufr/tables/0/wmo/36/element.table
char localRecomposed[1024] = {0,}; //e.g. bufr/tables/0/local/0/98/0/element.table
char* localFilename = 0;
char** list = 0;
char** cached_list = 0;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -88,9 +87,7 @@ static int build_long_array(grib_context* c, grib_handle* h, int compressed,
}
else {
/* uncompressed */
char keystr[32] = {
0,
};
char keystr[32] = {0,};
size_t values_len = 0;
for (i = 0; i < numberOfSubsets; ++i) {
long lVal = 0;
@ -118,15 +115,9 @@ static int select_datetime(grib_accessor* a)
grib_context* c = h->context;
size_t n;
double julianStart = 0, julianEnd = 0, julianDT = 0;
char start_str[80] = {
0,
},
end_str[80] = {
0,
},
datetime_str[80] = {
0,
};
char start_str[80] = {0,},
end_str[80] = {0,},
datetime_str[80] = {0,};
long yearRank, monthRank, dayRank, hourRank, minuteRank, secondRank;
long yearStart, monthStart, dayStart, hourStart, minuteStart, secondStart;
long yearEnd, monthEnd, dayEnd, hourEnd, minuteEnd, secondEnd;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,11 +10,12 @@
#include "grib_accessor_class_bufr_group.h"
grib_accessor_class_bufr_group_t _grib_accessor_class_bufr_group{"bufr_group"};
grib_accessor_class_bufr_group_t _grib_accessor_class_bufr_group{ "bufr_group" };
grib_accessor_class* grib_accessor_class_bufr_group = &_grib_accessor_class_bufr_group;
void grib_accessor_class_bufr_group_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_bufr_group_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_section(dumper, a, a->sub_section->block);
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,36 +10,42 @@
#include "grib_accessor_class_bytes.h"
grib_accessor_class_bytes_t _grib_accessor_class_bytes{"bytes"};
grib_accessor_class_bytes_t _grib_accessor_class_bytes{ "bytes" };
grib_accessor_class* grib_accessor_class_bytes = &_grib_accessor_class_bytes;
void grib_accessor_class_bytes_t::init(grib_accessor* a, const long len, grib_arguments* arg){
void grib_accessor_class_bytes_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_gen_t::init(a, len, arg);
/*grib_accessor_signed* self = (grib_accessor_signed*)a; */
a->length = len;
Assert(a->length >= 0);
}
int grib_accessor_class_bytes_t::get_native_type(grib_accessor* a){
int grib_accessor_class_bytes_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_BYTES;
}
int grib_accessor_class_bytes_t::compare(grib_accessor* a, grib_accessor* b){
int grib_accessor_class_bytes_t::compare(grib_accessor* a, grib_accessor* b)
{
int retval = GRIB_SUCCESS;
size_t alen = (size_t)a->byte_count(); size_t blen = (size_t)b->byte_count();
size_t alen = (size_t)a->byte_count();
size_t blen = (size_t)b->byte_count();
if (alen != blen)
return GRIB_COUNT_MISMATCH;
return retval;
}
int grib_accessor_class_bytes_t::unpack_string(grib_accessor* a, char* v, size_t* len){
unsigned char* p = NULL;
char* s = v;
long i = 0;
const long length = a->byte_count(); const long slength = 2 * length;
int grib_accessor_class_bytes_t::unpack_string(grib_accessor* a, char* v, size_t* len)
{
unsigned char* p = NULL;
char* s = v;
long i = 0;
const long length = a->byte_count();
const long slength = 2 * length;
if (*len < (size_t)slength) {
*len = slength;
@ -58,33 +63,34 @@ int grib_accessor_class_bytes_t::unpack_string(grib_accessor* a, char* v, size_t
return GRIB_SUCCESS;
}
int grib_accessor_class_bytes_t::pack_string(grib_accessor* a, const char* val, size_t* len){
int grib_accessor_class_bytes_t::pack_string(grib_accessor* a, const char* val, size_t* len)
{
/* The string representation (val) of the byte array will have two chars
* per byte e.g. 4C5B means the 2 bytes 0114 and 0133 in octal
* so has to be twice the length of the byte array
*/
int err = 0;
grib_context* c = a->context;
size_t nbytes = a->length;
int err = 0;
grib_context* c = a->context;
size_t nbytes = a->length;
const size_t expected_blen = nbytes;
const size_t expected_slen = 2 * expected_blen;
unsigned char* bytearray = NULL;
unsigned char* bytearray = NULL;
size_t i = 0, slen = strlen(val);
if (slen != expected_slen || *len != expected_slen) {
grib_context_log(c, GRIB_LOG_ERROR,
"%s: Key %s is %lu bytes. Expected a string with %lu characters (actual length=%zu)",
__func__, a->name, expected_blen, expected_slen, *len);
"%s: Key %s is %lu bytes. Expected a string with %lu characters (actual length=%zu)",
__func__, a->name, expected_blen, expected_slen, *len);
return GRIB_WRONG_ARRAY_SIZE;
}
bytearray = (unsigned char*)grib_context_malloc(c, nbytes * (sizeof(unsigned char)));
if (!bytearray) return GRIB_OUT_OF_MEMORY;
for (i = 0; i < (slen/2); i++) {
for (i = 0; i < (slen / 2); i++) {
unsigned int byteVal = 0;
if (sscanf(val + 2*i, "%02x", &byteVal) != 1) {
grib_context_log(c, GRIB_LOG_ERROR,"%s: Invalid hex byte specfication '%.2s'", __func__, val + 2*i);
if (sscanf(val + 2 * i, "%02x", &byteVal) != 1) {
grib_context_log(c, GRIB_LOG_ERROR, "%s: Invalid hex byte specfication '%.2s'", __func__, val + 2 * i);
grib_context_free(c, bytearray);
return GRIB_INVALID_KEY_VALUE;
}

View File

@ -0,0 +1,59 @@
/*
* (C) Copyright 2005- 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_accessor_class_cf_var_name.h"
grib_accessor_class_cf_var_name_t _grib_accessor_class_cf_var_name{ "cf_var_name" };
grib_accessor_class* grib_accessor_class_cf_var_name = &_grib_accessor_class_cf_var_name;
void grib_accessor_class_cf_var_name_t::init(grib_accessor* a, const long l, grib_arguments* arg)
{
grib_accessor_class_ascii_t::init(a, l, arg);
grib_accessor_cf_var_name_t* self = (grib_accessor_cf_var_name_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
self->defaultKey = grib_arguments_get_name(h, arg, 0);
}
int grib_accessor_class_cf_var_name_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
grib_accessor_cf_var_name_t* self = (grib_accessor_cf_var_name_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
char defaultKey[256] = {0,};
size_t size = sizeof(defaultKey) / sizeof(*defaultKey);
char* pDefaultKey = defaultKey;
int err = grib_get_string(h, self->defaultKey, defaultKey, &size);
if (err) return err;
Assert(size > 0);
Assert(strlen(defaultKey) > 0);
if ( STR_EQUAL(defaultKey, "~") || isdigit(defaultKey[0]) ) {
// NetCDF variables cannot start with a digit
long paramId = 0;
err = grib_get_long(h, "paramId", &paramId);
if (err) snprintf(val, 1024, "%s", "unknown");
else snprintf(val, 1024, "p%ld", paramId);
}
else {
snprintf(val, 1024, "%s", pDefaultKey);
}
size = strlen(val);
*len = size + 1;
return GRIB_SUCCESS;
}
size_t grib_accessor_class_cf_var_name_t::string_length(grib_accessor* a)
{
return 1024;
}

View File

@ -0,0 +1,30 @@
/*
* (C) Copyright 2005- 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.
*/
#pragma once
#include "grib_accessor_class_ascii.h"
class grib_accessor_cf_var_name_t : public grib_accessor_ascii_t
{
public:
/* Members defined in cf_var_name */
const char* defaultKey;
};
class grib_accessor_class_cf_var_name_t : public grib_accessor_class_ascii_t
{
public:
grib_accessor_class_cf_var_name_t(const char* name) : grib_accessor_class_ascii_t(name) {}
grib_accessor* create_empty_accessor() override { return new grib_accessor_cf_var_name_t{}; }
int unpack_string(grib_accessor*, char*, size_t* len) override;
size_t string_length(grib_accessor*) override;
void init(grib_accessor*, const long, grib_arguments*) override;
};

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,15 +10,16 @@
#include "grib_accessor_class_change_alternative_row_scanning.h"
grib_accessor_class_change_alternative_row_scanning_t _grib_accessor_class_change_alternative_row_scanning{"change_alternative_row_scanning"};
grib_accessor_class_change_alternative_row_scanning_t _grib_accessor_class_change_alternative_row_scanning{ "change_alternative_row_scanning" };
grib_accessor_class* grib_accessor_class_change_alternative_row_scanning = &_grib_accessor_class_change_alternative_row_scanning;
void grib_accessor_class_change_alternative_row_scanning_t::init(grib_accessor* a, const long len, grib_arguments* args){
void grib_accessor_class_change_alternative_row_scanning_t::init(grib_accessor* a, const long len, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, len, args);
int n = 0;
grib_accessor_change_alternative_row_scanning_t* self = (grib_accessor_change_alternative_row_scanning_t*)a;
int n = 0;
self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
self->Ni = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
self->Nj = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
@ -29,15 +29,17 @@ void grib_accessor_class_change_alternative_row_scanning_t::init(grib_accessor*
a->length = 0;
}
int grib_accessor_class_change_alternative_row_scanning_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int err = 0;
int grib_accessor_class_change_alternative_row_scanning_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_change_alternative_row_scanning_t* self = (grib_accessor_change_alternative_row_scanning_t*)a;
int err = 0;
const grib_context* c = a->context;
grib_handle* h = grib_handle_of_accessor(a);
grib_handle* h = grib_handle_of_accessor(a);
long i, j, jr, theEnd, Ni, Nj, k, kp, alternativeRowScanning;
size_t size = 0;
size_t size = 0;
double* values = NULL;
double tmp = 0.0;
double tmp = 0.0;
if (*val == 0)
return 0;
@ -62,7 +64,7 @@ int grib_accessor_class_change_alternative_row_scanning_t::pack_long(grib_access
if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS)
return err;
if ( size > (size_t)(Ni * Nj) ) {
if (size > (size_t)(Ni * Nj)) {
grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: wrong values size!=Ni*Nj (%zu!=%ld*%ld)", size, Ni, Nj);
return GRIB_WRONG_ARRAY_SIZE;
}
@ -106,11 +108,13 @@ int grib_accessor_class_change_alternative_row_scanning_t::pack_long(grib_access
return GRIB_SUCCESS;
}
int grib_accessor_class_change_alternative_row_scanning_t::get_native_type(grib_accessor* a){
int grib_accessor_class_change_alternative_row_scanning_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;
}
int grib_accessor_class_change_alternative_row_scanning_t::unpack_long(grib_accessor* a, long* v, size_t* len){
int grib_accessor_class_change_alternative_row_scanning_t::unpack_long(grib_accessor* a, long* v, size_t* len)
{
/* Decoding this accessor doesn't make sense so we return a dummy value */
*v = -1;
return GRIB_SUCCESS;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,16 +10,17 @@
#include "grib_accessor_class_change_scanning_direction.h"
grib_accessor_class_change_scanning_direction_t _grib_accessor_class_change_scanning_direction{"change_scanning_direction"};
grib_accessor_class_change_scanning_direction_t _grib_accessor_class_change_scanning_direction{ "change_scanning_direction" };
grib_accessor_class* grib_accessor_class_change_scanning_direction = &_grib_accessor_class_change_scanning_direction;
void grib_accessor_class_change_scanning_direction_t::init(grib_accessor* a, const long len, grib_arguments* args){
void grib_accessor_class_change_scanning_direction_t::init(grib_accessor* a, const long len, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, len, args);
grib_accessor_change_scanning_direction_t* self = (grib_accessor_change_scanning_direction_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
int n = 0;
int n = 0;
self->values = grib_arguments_get_name(h, args, n++);
self->Ni = grib_arguments_get_name(h, args, n++);
self->Nj = grib_arguments_get_name(h, args, n++);
@ -34,20 +34,21 @@ void grib_accessor_class_change_scanning_direction_t::init(grib_accessor* a, con
a->length = 0;
}
int grib_accessor_class_change_scanning_direction_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int grib_accessor_class_change_scanning_direction_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
int err = 0;
long i, j, jr, theEnd, Ni, Nj, k, kp;
double tmp;
long iScansNegatively = 0;
long jScansPositively = 0;
double first = 0;
double last = 0;
size_t size = 0;
double* values = NULL;
long iScansNegatively = 0;
long jScansPositively = 0;
double first = 0;
double last = 0;
size_t size = 0;
double* values = NULL;
grib_accessor_change_scanning_direction_t* self = (grib_accessor_change_scanning_direction_t*)a;
const grib_context* c = a->context;
grib_handle* h = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
const grib_context* c = a->context;
grib_handle* h = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
if (*val == 0)
return GRIB_SUCCESS;
@ -147,11 +148,13 @@ int grib_accessor_class_change_scanning_direction_t::pack_long(grib_accessor* a,
return GRIB_SUCCESS;
}
int grib_accessor_class_change_scanning_direction_t::get_native_type(grib_accessor* a){
int grib_accessor_class_change_scanning_direction_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;
}
int grib_accessor_class_change_scanning_direction_t::unpack_long(grib_accessor* a, long* v, size_t* len){
int grib_accessor_class_change_scanning_direction_t::unpack_long(grib_accessor* a, long* v, size_t* len)
{
/* ECC-976: decoding this accessor doesn't make sense so we return a dummy value */
*v = -1;
return GRIB_SUCCESS;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,7 +10,7 @@
#include "grib_accessor_class_check_internal_version.h"
grib_accessor_class_check_internal_version_t _grib_accessor_class_check_internal_version{"check_internal_version"};
grib_accessor_class_check_internal_version_t _grib_accessor_class_check_internal_version{ "check_internal_version" };
grib_accessor_class* grib_accessor_class_check_internal_version = &_grib_accessor_class_check_internal_version;
@ -20,7 +19,8 @@ grib_accessor_class* grib_accessor_class_check_internal_version = &_grib_accesso
/* See the key "internalVersion" */
#define LATEST_ENGINE_VERSION 30
void grib_accessor_class_check_internal_version_t::init(grib_accessor* a, const long l, grib_arguments* args){
void grib_accessor_class_check_internal_version_t::init(grib_accessor* a, const long l, grib_arguments* args)
{
grib_accessor_class_ascii_t::init(a, l, args);
/* Check version of definition files is compatible with the engine */
int err = 0;
@ -41,11 +41,13 @@ void grib_accessor_class_check_internal_version_t::init(grib_accessor* a, const
}
}
int grib_accessor_class_check_internal_version_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_check_internal_version_t::value_count(grib_accessor* a, long* count)
{
*count = 1;
return 0;
}
size_t grib_accessor_class_check_internal_version_t::string_length(grib_accessor* a){
size_t grib_accessor_class_check_internal_version_t::string_length(grib_accessor* a)
{
return 255;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,34 +11,37 @@
#include "grib_accessor_class_closest_date.h"
#include <float.h>
grib_accessor_class_closest_date_t _grib_accessor_class_closest_date{"closest_date"};
grib_accessor_class_closest_date_t _grib_accessor_class_closest_date{ "closest_date" };
grib_accessor_class* grib_accessor_class_closest_date = &_grib_accessor_class_closest_date;
void grib_accessor_class_closest_date_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_closest_date_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_double_t::init(a, l, c);
grib_accessor_closest_date_t* self = (grib_accessor_closest_date_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
int n = 0;
grib_handle* h = grib_handle_of_accessor(a);
int n = 0;
self->dateLocal = grib_arguments_get_name(h, c, n++);
self->timeLocal = grib_arguments_get_name(h, c, n++);
self->dateLocal = grib_arguments_get_name(h, c, n++);
self->timeLocal = grib_arguments_get_name(h, c, n++);
self->numForecasts = grib_arguments_get_name(h, c, n++);
self->year = grib_arguments_get_name(h, c, n++);
self->month = grib_arguments_get_name(h, c, n++);
self->day = grib_arguments_get_name(h, c, n++);
self->hour = grib_arguments_get_name(h, c, n++);
self->minute = grib_arguments_get_name(h, c, n++);
self->second = grib_arguments_get_name(h, c, n++);
self->year = grib_arguments_get_name(h, c, n++);
self->month = grib_arguments_get_name(h, c, n++);
self->day = grib_arguments_get_name(h, c, n++);
self->hour = grib_arguments_get_name(h, c, n++);
self->minute = grib_arguments_get_name(h, c, n++);
self->second = grib_arguments_get_name(h, c, n++);
a->length = 0;
}
void grib_accessor_class_closest_date_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_closest_date_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_string(dumper, a, NULL);
}
int grib_accessor_class_closest_date_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_closest_date_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
int ret = 0;
double v = 0;
@ -50,24 +52,25 @@ int grib_accessor_class_closest_date_t::unpack_long(grib_accessor* a, long* val,
}
/* Sets val to the 'index' of the closes date */
int grib_accessor_class_closest_date_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_closest_date_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
const grib_accessor_closest_date_t* self = (grib_accessor_closest_date_t*)a;
int err = 0;
int err = 0;
long num_forecasts = 0; /* numberOfForecastsUsedInLocalTime */
/* These relate to the date and time in Section 1 */
long ymdLocal, hmsLocal, yearLocal, monthLocal, dayLocal, hourLocal, minuteLocal, secondLocal;
double jLocal = 0;
double jLocal = 0;
double minDiff = DBL_MAX;
size_t i = 0;
size_t size = 0; /* number of elements in the array keys - should be = numberOfForecastsUsedInLocalTime */
size_t i = 0;
size_t size = 0; /* number of elements in the array keys - should be = numberOfForecastsUsedInLocalTime */
/* These relate to the forecast dates and times in Section 4 */
long *yearArray, *monthArray, *dayArray, *hourArray, *minuteArray, *secondArray;
grib_handle* h = grib_handle_of_accessor(a);
grib_handle* h = grib_handle_of_accessor(a);
const grib_context* c = a->context;
*val = -1; /* initialise to an invalid index */
*val = -1; /* initialise to an invalid index */
if ((err = grib_get_long_internal(h, self->numForecasts, &num_forecasts)) != GRIB_SUCCESS) return err;
Assert(num_forecasts > 1);
@ -79,7 +82,7 @@ int grib_accessor_class_closest_date_t::unpack_double(grib_accessor* a, double*
ymdLocal %= 100;
dayLocal = ymdLocal;
if ((err= grib_get_long(h, self->timeLocal, &hmsLocal)) != GRIB_SUCCESS) return err;
if ((err = grib_get_long(h, self->timeLocal, &hmsLocal)) != GRIB_SUCCESS) return err;
hourLocal = hmsLocal / 100;
hmsLocal %= 100;
minuteLocal = hmsLocal / 100;
@ -117,14 +120,14 @@ int grib_accessor_class_closest_date_t::unpack_double(grib_accessor* a, double*
if ((err = grib_get_long_array_internal(h, self->second, secondArray, &size)) != GRIB_SUCCESS) return err;
grib_datetime_to_julian(yearLocal, monthLocal, dayLocal, hourLocal, minuteLocal, secondLocal, &jLocal);
for(i=0; i< size; ++i) {
for (i = 0; i < size; ++i) {
double jval = 0, diff = 0;
grib_datetime_to_julian(yearArray[i], monthArray[i], dayArray[i],
hourArray[i], minuteArray[i], secondArray[i], &jval);
diff = jLocal - jval;
if (diff >= 0 && diff < minDiff) {
minDiff = diff;
*val = i;
*val = i;
}
}
if (*val == -1) {

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,16 +10,17 @@
#include "grib_accessor_class_data_apply_boustrophedonic_bitmap.h"
grib_accessor_class_data_apply_boustrophedonic_bitmap_t _grib_accessor_class_data_apply_boustrophedonic_bitmap{"data_apply_boustrophedonic_bitmap"};
grib_accessor_class_data_apply_boustrophedonic_bitmap_t _grib_accessor_class_data_apply_boustrophedonic_bitmap{ "data_apply_boustrophedonic_bitmap" };
grib_accessor_class* grib_accessor_class_data_apply_boustrophedonic_bitmap = &_grib_accessor_class_data_apply_boustrophedonic_bitmap;
void grib_accessor_class_data_apply_boustrophedonic_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_apply_boustrophedonic_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, v, args);
int n = 0;
grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
grib_handle* gh = grib_handle_of_accessor(a);
int n = 0;
self->coded_values = grib_arguments_get_name(gh, args, n++);
self->bitmap = grib_arguments_get_name(gh, args, n++);
self->missing_value = grib_arguments_get_name(gh, args, n++);
@ -33,15 +33,18 @@ void grib_accessor_class_data_apply_boustrophedonic_bitmap_t::init(grib_accessor
a->length = 0;
}
void grib_accessor_class_data_apply_boustrophedonic_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_data_apply_boustrophedonic_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_values(dumper, a);
}
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
size_t len = 0;
int ret = 0;
grib_handle* gh = grib_handle_of_accessor(a);
size_t len = 0;
int ret = 0;
/* This accessor is for data with a bitmap after all */
Assert(grib_find_accessor(gh, self->bitmap));
@ -51,9 +54,10 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::value_count(grib_ac
return ret;
}
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
grib_handle* gh = grib_handle_of_accessor(a);
size_t i = 0, j = 0, n_vals = 0, irow = 0;
long nn = 0;
@ -63,7 +67,8 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double(grib_
double missing_value = 0;
long numberOfPoints, numberOfRows, numberOfColumns;
err = a->value_count(&nn); n_vals = nn;
err = a->value_count(&nn);
n_vals = nn;
if (err)
return err;
@ -159,9 +164,10 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double(grib_
return err;
}
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_element(grib_accessor* a, size_t idx, double* val)
{
grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
grib_handle* gh = grib_handle_of_accessor(a);
int err = 0, i = 0;
size_t cidx = 0;
double missing_value = 0;
@ -169,7 +175,8 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_eleme
size_t n_vals = 0;
long nn = 0;
err = a->value_count(&nn); n_vals = nn;
err = a->value_count(&nn);
n_vals = nn;
if (err)
return err;
@ -204,19 +211,21 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_eleme
return grib_get_double_element_internal(gh, self->coded_values, cidx, val);
}
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
{
grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
grib_handle* gh = grib_handle_of_accessor(a);
int err = 0, all_missing = 1;
size_t cidx = 0; /* index into the coded_values array */
size_t* cidx_array = NULL; /* array of indexes into the coded_values */
double* cval_array = NULL; /* array of values of the coded_values */
size_t cidx = 0; /* index into the coded_values array */
size_t* cidx_array = NULL; /* array of indexes into the coded_values */
double* cval_array = NULL; /* array of values of the coded_values */
double missing_value = 0;
double* bvals = NULL;
size_t n_vals = 0, i = 0, j = 0, idx = 0, count_1s = 0, ci = 0;
long nn = 0;
err = a->value_count(&nn); n_vals = nn;
err = a->value_count(&nn);
n_vals = nn;
if (err) return err;
if (!grib_find_accessor(gh, self->bitmap))
@ -230,7 +239,8 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_eleme
for (i = 0; i < len; i++) {
if (val_array[i] == 0) {
val_array[i] = missing_value;
} else {
}
else {
all_missing = 0;
count_1s++;
}
@ -255,7 +265,7 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_eleme
ci = 0;
for (i = 0; i < len; i++) {
if (val_array[i] == 1) {
idx = index_array[i];
idx = index_array[i];
cidx = 0;
for (j = 0; j < idx; j++) {
cidx += bvals[j];
@ -282,17 +292,19 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_eleme
return GRIB_SUCCESS;
}
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
int err = 0;
size_t bmaplen = *len;
size_t irow = 0;
long coded_n_vals = 0;
double* coded_vals = NULL;
double* values = 0;
long i = 0;
long j = 0;
grib_handle* gh = grib_handle_of_accessor(a);
int err = 0;
size_t bmaplen = *len;
size_t irow = 0;
long coded_n_vals = 0;
double* coded_vals = NULL;
double* values = 0;
long i = 0;
long j = 0;
long numberOfPoints, numberOfRows, numberOfColumns;
double missing_value = 0;
@ -381,9 +393,10 @@ int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::pack_double(grib_ac
return err;
}
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::get_native_type(grib_accessor* a){
//grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
//return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values));
int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::get_native_type(grib_accessor* a)
{
// grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a;
// return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values));
return GRIB_TYPE_DOUBLE;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,24 +10,26 @@
#include "grib_accessor_class_data_dummy_field.h"
grib_accessor_class_data_dummy_field_t _grib_accessor_class_data_dummy_field{"data_dummy_field"};
grib_accessor_class_data_dummy_field_t _grib_accessor_class_data_dummy_field{ "data_dummy_field" };
grib_accessor_class* grib_accessor_class_data_dummy_field = &_grib_accessor_class_data_dummy_field;
void grib_accessor_class_data_dummy_field_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_dummy_field_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_g1simple_packing_t::init(a, v, args);
grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a;
self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->numberOfPoints = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->numberOfPoints = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
}
int grib_accessor_class_data_dummy_field_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_dummy_field_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a;
size_t i = 0, n_vals = 0;
long numberOfPoints;
double missing_value = 0;
int err = 0;
int err = 0;
if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, &numberOfPoints)) != GRIB_SUCCESS)
return err;
@ -54,15 +55,16 @@ int grib_accessor_class_data_dummy_field_t::unpack_double(grib_accessor* a, doub
return err;
}
int grib_accessor_class_data_dummy_field_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_dummy_field_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a;
size_t n_vals = *len;
int err = 0;
size_t n_vals = *len;
int err = 0;
long bits_per_value = 0;
long half_byte = 0;
size_t buflen = 0;
unsigned char* buf = NULL;
long half_byte = 0;
size_t buflen = 0;
unsigned char* buf = NULL;
if (*len == 0)
return GRIB_NO_VALUES;
@ -89,9 +91,10 @@ int grib_accessor_class_data_dummy_field_t::pack_double(grib_accessor* a, const
return GRIB_SUCCESS;
}
int grib_accessor_class_data_dummy_field_t::value_count(grib_accessor* a, long* numberOfPoints){
int grib_accessor_class_data_dummy_field_t::value_count(grib_accessor* a, long* numberOfPoints)
{
grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a;
int err = 0;
int err = 0;
*numberOfPoints = 0;
if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints)) != GRIB_SUCCESS) {

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,58 +10,62 @@
#include "grib_accessor_class_data_g1complex_packing.h"
grib_accessor_class_data_g1complex_packing_t _grib_accessor_class_data_g1complex_packing{"data_g1complex_packing"};
grib_accessor_class_data_g1complex_packing_t _grib_accessor_class_data_g1complex_packing{ "data_g1complex_packing" };
grib_accessor_class* grib_accessor_class_data_g1complex_packing = &_grib_accessor_class_data_g1complex_packing;
void grib_accessor_class_data_g1complex_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g1complex_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_complex_packing_t::init(a, v, args);
grib_accessor_data_g1complex_packing_t* self = (grib_accessor_data_g1complex_packing_t*)a;
self->half_byte = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->N = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->packingType = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->ieee_packing = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->edition = 1;
self->half_byte = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->N = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->packingType = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->ieee_packing = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->edition = 1;
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_g1complex_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_g1complex_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_g1complex_packing_t* self = (grib_accessor_data_g1complex_packing_t*)a;
int ret = GRIB_SUCCESS;
long seclen = 0;
long sub_j = 0;
long sub_k = 0;
long sub_m = 0;
long n = 0;
long half_byte = 0;
long bits_per_value = 0;
size_t buflen = 0;
int ret = GRIB_SUCCESS;
long seclen = 0;
long sub_j = 0;
long sub_k = 0;
long sub_m = 0;
long n = 0;
long half_byte = 0;
long bits_per_value = 0;
size_t buflen = 0;
if (*len == 0)
return GRIB_NO_VALUES;
// /* TODO: spectral_ieee does not work */
// if (c->ieee_packing && self->ieee_packing) {
// grib_handle* h = grib_handle_of_accessor(a);
// grib_context* c = a->context;
// char* packingType_s = NULL;
// char* ieee_packing_s = NULL;
// long precision = c->ieee_packing == 32 ? 1 : 2;
// size_t lenstr = strlen(self->ieee_packing);
// /* TODO: spectral_ieee does not work */
// if (c->ieee_packing && self->ieee_packing) {
// grib_handle* h = grib_handle_of_accessor(a);
// grib_context* c = a->context;
// char* packingType_s = NULL;
// char* ieee_packing_s = NULL;
// long precision = c->ieee_packing == 32 ? 1 : 2;
// size_t lenstr = strlen(self->ieee_packing);
// packingType_s = grib_context_strdup(c, self->packingType);
// ieee_packing_s = grib_context_strdup(c, self->ieee_packing);
// precision_s = grib_context_strdup(c, self->precision);
// packingType_s = grib_context_strdup(c, self->packingType);
// ieee_packing_s = grib_context_strdup(c, self->ieee_packing);
// precision_s = grib_context_strdup(c, self->precision);
// grib_set_string(h, packingType_s, ieee_packing_s, &lenstr);
// grib_set_long(h, precision_s, precision);
// grib_set_string(h, packingType_s, ieee_packing_s, &lenstr);
// grib_set_long(h, precision_s, precision);
// grib_context_free(c, packingType_s);
// grib_context_free(c, ieee_packing_s);
// grib_context_free(c, precision_s);
// return grib_set_double_array(h, "values", val, *len);
// }
// grib_context_free(c, packingType_s);
// grib_context_free(c, ieee_packing_s);
// grib_context_free(c, precision_s);
// return grib_set_double_array(h, "values", val, *len);
// }
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->sub_j, &sub_j)) != GRIB_SUCCESS)
return ret;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,14 +11,15 @@
#include "grib_accessor_class_data_g1second_order_constant_width_packing.h"
#include "grib_scaling.h"
grib_accessor_class_data_g1second_order_constant_width_packing_t _grib_accessor_class_data_g1second_order_constant_width_packing{"data_g1second_order_constant_width_packing"};
grib_accessor_class_data_g1second_order_constant_width_packing_t _grib_accessor_class_data_g1second_order_constant_width_packing{ "data_g1second_order_constant_width_packing" };
grib_accessor_class* grib_accessor_class_data_g1second_order_constant_width_packing = &_grib_accessor_class_data_g1second_order_constant_width_packing;
void grib_accessor_class_data_g1second_order_constant_width_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g1second_order_constant_width_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_simple_packing_t::init(a, v, args);
grib_accessor_data_g1second_order_constant_width_packing_t* self = (grib_accessor_data_g1second_order_constant_width_packing_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
self->half_byte = grib_arguments_get_name(hand, args, self->carg++);
self->packingType = grib_arguments_get_name(hand, args, self->carg++);
@ -41,23 +41,26 @@ void grib_accessor_class_data_g1second_order_constant_width_packing_t::init(grib
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_g1second_order_constant_width_packing_t::value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues){
int err = 0;
int grib_accessor_class_data_g1second_order_constant_width_packing_t::value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues)
{
int err = 0;
grib_accessor_data_g1second_order_constant_width_packing_t* self = (grib_accessor_data_g1second_order_constant_width_packing_t*)a;
*numberOfSecondOrderPackedValues = 0;
*numberOfSecondOrderPackedValues = 0;
err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfSecondOrderPackedValues, numberOfSecondOrderPackedValues);
return err;
}
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_float(grib_accessor*, float* val, size_t* len){
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_float(grib_accessor*, float* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double(grib_accessor* a, double* values, size_t* len){
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double(grib_accessor* a, double* values, size_t* len)
{
grib_accessor_data_g1second_order_constant_width_packing_t* self = (grib_accessor_data_g1second_order_constant_width_packing_t*)a;
int ret = 0;
int ret = 0;
long numberOfGroups, numberOfSecondOrderPackedValues;
long groupWidth = 0;
long* firstOrderValues = 0;
@ -139,7 +142,7 @@ int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_dou
i += secondaryBitmap[n];
long fovi = 0;
// ECC-1703
if ( i >=0 && i < numberOfGroups )
if (i >= 0 && i < numberOfGroups)
fovi = firstOrderValues[i];
X[n] = fovi + X[n];
n++;
@ -151,7 +154,7 @@ int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_dou
while (n < numberOfSecondOrderPackedValues) {
i += secondaryBitmap[n];
long fovi = 0;
if ( i >=0 && i < numberOfGroups )
if (i >= 0 && i < numberOfGroups)
fovi = firstOrderValues[i];
X[n] = fovi;
n++;
@ -177,17 +180,19 @@ int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_dou
return ret;
}
int grib_accessor_class_data_g1second_order_constant_width_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){
int grib_accessor_class_data_g1second_order_constant_width_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len)
{
const char* cclass_name = a->cclass->name;
grib_context_log(a->context, GRIB_LOG_ERROR, "%s: %s: Not implemented", cclass_name, __func__);
return GRIB_NOT_IMPLEMENTED;
}
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val)
{
grib_handle* hand = grib_handle_of_accessor(a);
size_t size = 0;
double* values = NULL;
int err = 0;
size_t size = 0;
double* values = NULL;
int err = 0;
/* TODO: This should be 'codedValues' not 'values'
but GRIB1 version of this packing does not have that key!! */
@ -208,11 +213,12 @@ int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_dou
return GRIB_SUCCESS;
}
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){
int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
{
grib_handle* hand = grib_handle_of_accessor(a);
size_t size = 0, i = 0;
double* values = NULL;
int err = 0;
int err = 0;
/* TODO: This should be 'codedValues' not 'values'
but GRIB1 version of this packing does not have that key!! */

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,20 +10,22 @@
#include "grib_accessor_class_data_g1secondary_bitmap.h"
grib_accessor_class_data_g1secondary_bitmap_t _grib_accessor_class_data_g1secondary_bitmap{"data_g1secondary_bitmap"};
grib_accessor_class_data_g1secondary_bitmap_t _grib_accessor_class_data_g1secondary_bitmap{ "data_g1secondary_bitmap" };
grib_accessor_class* grib_accessor_class_data_g1secondary_bitmap = &_grib_accessor_class_data_g1secondary_bitmap;
void grib_accessor_class_data_g1secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g1secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_secondary_bitmap_t::init(a, v, args);
grib_accessor_data_g1secondary_bitmap_t* self = (grib_accessor_data_g1secondary_bitmap_t*)a;
self->number_of_ones = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4);
self->number_of_ones = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4);
}
int grib_accessor_class_data_g1secondary_bitmap_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_data_g1secondary_bitmap_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_data_g1secondary_bitmap_t* self = (grib_accessor_data_g1secondary_bitmap_t*)a;
size_t len = 0;
int err = 0;
size_t len = 0;
int err = 0;
long expand_by;
*count = 0;
@ -40,11 +41,11 @@ int grib_accessor_class_data_g1secondary_bitmap_t::value_count(grib_accessor* a,
return GRIB_SUCCESS;
}
int grib_accessor_class_data_g1secondary_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_g1secondary_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_g1secondary_bitmap_t* self = (grib_accessor_data_g1secondary_bitmap_t*)a;
int err = 0;
int err = 0;
long primary_len = 0;
long secondary_len = 0;
double* primary_bitmap = NULL;
@ -52,11 +53,11 @@ int grib_accessor_class_data_g1secondary_bitmap_t::pack_double(grib_accessor* a,
long i = 0;
long j = 0;
long on = 0;
long k;
long m;
double missing_value = 0;
double present_value = 0;
long expand_by = 0;
long k = 0;
long m = 0;
double missing_value = 0;
double present_value = 0;
long expand_by = 0;
if (*len == 0)
return GRIB_NO_VALUES;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,15 +10,15 @@
#include "grib_accessor_class_data_g1shsimple_packing.h"
grib_accessor_class_data_g1shsimple_packing_t _grib_accessor_class_data_g1shsimple_packing{"data_g1shsimple_packing"};
grib_accessor_class_data_g1shsimple_packing_t _grib_accessor_class_data_g1shsimple_packing{ "data_g1shsimple_packing" };
grib_accessor_class* grib_accessor_class_data_g1shsimple_packing = &_grib_accessor_class_data_g1shsimple_packing;
int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a;
size_t len = 0;
int err = 0;
size_t len = 0;
int err = 0;
err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &len);
len += 1;
@ -28,9 +27,10 @@ int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a,
return err;
}
int grib_accessor_class_data_g1shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_g1shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a;
int err = GRIB_SUCCESS;
int err = GRIB_SUCCESS;
size_t coded_n_vals = 0;
size_t n_vals = 0;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,11 +11,12 @@
#include "grib_accessor_class_data_g1simple_packing.h"
#include "grib_scaling.h"
grib_accessor_class_data_g1simple_packing_t _grib_accessor_class_data_g1simple_packing{"data_g1simple_packing"};
grib_accessor_class_data_g1simple_packing_t _grib_accessor_class_data_g1simple_packing{ "data_g1simple_packing" };
grib_accessor_class* grib_accessor_class_data_g1simple_packing = &_grib_accessor_class_data_g1simple_packing;
void grib_accessor_class_data_g1simple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g1simple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_simple_packing_t::init(a, v, args);
grib_accessor_data_g1simple_packing_t* self = (grib_accessor_data_g1simple_packing_t*)a;
@ -28,9 +28,10 @@ void grib_accessor_class_data_g1simple_packing_t::init(grib_accessor* a, const l
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_g1simple_packing_t::value_count(grib_accessor* a, long* number_of_values){
int grib_accessor_class_data_g1simple_packing_t::value_count(grib_accessor* a, long* number_of_values)
{
grib_accessor_data_g1simple_packing_t* self = (grib_accessor_data_g1simple_packing_t*)a;
*number_of_values = 0;
*number_of_values = 0;
/* Special case for when values are cleared */
/*if(a->length == 0)
@ -39,7 +40,8 @@ int grib_accessor_class_data_g1simple_packing_t::value_count(grib_accessor* a, l
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, number_of_values);
}
int grib_accessor_class_data_g1simple_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){
int grib_accessor_class_data_g1simple_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len)
{
grib_accessor_data_g1simple_packing_t* self = (grib_accessor_data_g1simple_packing_t*)a;
size_t n_vals = *len;
@ -108,7 +110,7 @@ int grib_accessor_class_data_g1simple_packing_t::pack_double(grib_accessor* a, c
packingType_s = grib_context_strdup(c, self->packingType);
ieee_packing_s = grib_context_strdup(c, self->ieee_packing);
precision_s = grib_context_strdup(c, self->precision);
precision = c->ieee_packing == 32 ? 1 : 2;
precision = c->ieee_packing == 32 ? 1 : 2;
if ((ret = grib_set_string(h, packingType_s, ieee_packing_s, &lenstr)) != GRIB_SUCCESS)
return ret;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -787,7 +786,7 @@ int grib_accessor_class_data_g22order_packing_t::pack_double(grib_accessor* a, c
// long nvals_per_group = 0;
// long nbits_per_group_val = 0;
long binary_scale_factor, decimal_scale_factor, optimize_scale_factor, typeOfOriginalFieldValues;
long binary_scale_factor, decimal_scale_factor, typeOfOriginalFieldValues;
// long groupSplittingMethodUsed, numberOfGroupsOfDataValues, referenceForGroupWidths;
long missingValueManagementUsed, primaryMissingValueSubstitute, secondaryMissingValueSubstitute;
long numberOfBitsUsedForTheGroupWidths, numberOfBitsUsedForTheScaledGroupLengths, orderOfSpatialDifferencing;
@ -816,7 +815,7 @@ int grib_accessor_class_data_g22order_packing_t::pack_double(grib_accessor* a, c
if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS)
return err;
optimize_scale_factor = 1; // TODO(masn): To be reviewed
int use_scale = 1;
if ((err = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS)
return err;
@ -939,7 +938,7 @@ int grib_accessor_class_data_g22order_packing_t::pack_double(grib_accessor* a, c
binary_scale = bin_scale;
if (optimize_scale_factor == 0) { // ECMWF style
if (use_scale) { // ECMWF style
ref = min_val;
frange = max_val - ref;
dec_scale = 0;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -13,17 +12,18 @@
#include "grib_scaling.h"
#include <algorithm>
grib_accessor_class_data_g2bifourier_packing_t _grib_accessor_class_data_g2bifourier_packing{"data_g2bifourier_packing"};
grib_accessor_class_data_g2bifourier_packing_t _grib_accessor_class_data_g2bifourier_packing{ "data_g2bifourier_packing" };
grib_accessor_class* grib_accessor_class_data_g2bifourier_packing = &_grib_accessor_class_data_g2bifourier_packing;
typedef unsigned long (*encode_float_proc)(double);
typedef double (*decode_float_proc)(unsigned long);
void grib_accessor_class_data_g2bifourier_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g2bifourier_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_simple_packing_t::init(a, v, args);
grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
grib_handle* gh = grib_handle_of_accessor(a);
self->ieee_floats = grib_arguments_get_name(gh, args, self->carg++);
self->laplacianOperatorIsSet = grib_arguments_get_name(gh, args, self->carg++);
@ -43,10 +43,11 @@ void grib_accessor_class_data_g2bifourier_packing_t::init(grib_accessor* a, cons
self->dirty = 1;
}
int grib_accessor_class_data_g2bifourier_packing_t::value_count(grib_accessor* a, long* numberOfValues){
int grib_accessor_class_data_g2bifourier_packing_t::value_count(grib_accessor* a, long* numberOfValues)
{
grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
*numberOfValues = 0;
grib_handle* gh = grib_handle_of_accessor(a);
*numberOfValues = 0;
return grib_get_long_internal(gh, self->number_of_values, numberOfValues);
}
@ -249,7 +250,7 @@ static double laplam(bif_trunc_t* bt, const double val[])
free(itab2);
return 0.;
}
Assert(lmax>0);
Assert(lmax > 0);
/*
* Now, itab2 contains all possible values of i*i+j*j, and itab1 contains
@ -426,8 +427,8 @@ static bif_trunc_t* new_bif_trunc(grib_accessor* a)
bt->jtruncation_bif = (long*)grib_context_malloc(gh->context, sizeof(long) * (1 + bt->bif_i));
#define RECTANGLE 77
#define ELLIPSE 88
#define DIAMOND 99
#define ELLIPSE 88
#define DIAMOND 99
switch (bt->biFourierTruncationType) {
case RECTANGLE:
@ -471,9 +472,10 @@ cleanup:
return NULL;
}
int grib_accessor_class_data_g2bifourier_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_g2bifourier_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
grib_handle* gh = grib_handle_of_accessor(a);
unsigned char* buf = NULL;
unsigned char* hres = NULL;
@ -568,19 +570,20 @@ cleanup:
return ret;
}
int grib_accessor_class_data_g2bifourier_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_g2bifourier_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
grib_handle* gh = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
size_t buflen = 0;
size_t hsize = 0;
size_t lsize = 0;
unsigned char* buf = NULL;
unsigned char* hres = NULL;
unsigned char* lres = NULL;
long hpos = 0;
long lpos = 0;
size_t buflen = 0;
size_t hsize = 0;
size_t lsize = 0;
unsigned char* buf = NULL;
unsigned char* hres = NULL;
unsigned char* lres = NULL;
long hpos = 0;
long lpos = 0;
int isp;
bif_trunc_t* bt = NULL;
@ -619,7 +622,7 @@ int grib_accessor_class_data_g2bifourier_packing_t::pack_double(grib_accessor* a
if (*len != bt->n_vals_bif) {
grib_context_log(gh->context, GRIB_LOG_ERROR, "BIFOURIER_PACKING: wrong number of values, expected %lu - got %lu",
bt->n_vals_bif, *len);
bt->n_vals_bif, *len);
ret = GRIB_INTERNAL_ERROR;
goto cleanup;
}
@ -745,7 +748,7 @@ int grib_accessor_class_data_g2bifourier_packing_t::pack_double(grib_accessor* a
grib_get_double_internal(gh, self->reference_value, &ref);
if (ref != bt->reference_value) {
grib_context_log(a->context, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)",
cclass_name, __func__, self->reference_value, ref, bt->reference_value);
cclass_name, __func__, self->reference_value, ref, bt->reference_value);
return GRIB_INTERNAL_ERROR;
}
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,29 +10,32 @@
#include "grib_accessor_class_data_g2complex_packing.h"
grib_accessor_class_data_g2complex_packing_t _grib_accessor_class_data_g2complex_packing{"data_g2complex_packing"};
grib_accessor_class_data_g2complex_packing_t _grib_accessor_class_data_g2complex_packing{ "data_g2complex_packing" };
grib_accessor_class* grib_accessor_class_data_g2complex_packing = &_grib_accessor_class_data_g2complex_packing;
void grib_accessor_class_data_g2complex_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g2complex_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_complex_packing_t::init(a, v, args);
grib_accessor_data_g2complex_packing_t* self = (grib_accessor_data_g2complex_packing_t*)a;
self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->edition = 2;
self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
self->edition = 2;
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_g2complex_packing_t::value_count(grib_accessor* a, long* numberOfValues){
int grib_accessor_class_data_g2complex_packing_t::value_count(grib_accessor* a, long* numberOfValues)
{
grib_accessor_data_g2complex_packing_t* self = (grib_accessor_data_g2complex_packing_t*)a;
*numberOfValues = 0;
*numberOfValues = 0;
return grib_get_long(grib_handle_of_accessor(a), self->numberOfValues, numberOfValues);
}
int grib_accessor_class_data_g2complex_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_g2complex_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_g2complex_packing_t* self = (grib_accessor_data_g2complex_packing_t*)a;
int ret = GRIB_SUCCESS;
int ret = GRIB_SUCCESS;
if (*len == 0)
return GRIB_NO_VALUES;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,25 +10,28 @@
#include "grib_accessor_class_data_g2secondary_bitmap.h"
grib_accessor_class_data_g2secondary_bitmap_t _grib_accessor_class_data_g2secondary_bitmap{"data_g2secondary_bitmap"};
grib_accessor_class_data_g2secondary_bitmap_t _grib_accessor_class_data_g2secondary_bitmap{ "data_g2secondary_bitmap" };
grib_accessor_class* grib_accessor_class_data_g2secondary_bitmap = &_grib_accessor_class_data_g2secondary_bitmap;
void grib_accessor_class_data_g2secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g2secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_secondary_bitmap_t::init(a, v, args);
grib_accessor_data_g2secondary_bitmap_t* self = (grib_accessor_data_g2secondary_bitmap_t*)a;
self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4);
self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4);
}
int grib_accessor_class_data_g2secondary_bitmap_t::value_count(grib_accessor* a, long* len){
int grib_accessor_class_data_g2secondary_bitmap_t::value_count(grib_accessor* a, long* len)
{
grib_accessor_data_g2secondary_bitmap_t* self = (grib_accessor_data_g2secondary_bitmap_t*)a;
*len = 0;
*len = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, len);
}
int grib_accessor_class_data_g2secondary_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_g2secondary_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_g2secondary_bitmap_t* self = (grib_accessor_data_g2secondary_bitmap_t*)a;
int err = 0;
int err = 0;
long primary_len = 0, secondary_len = 0;
double* primary_bitmap = NULL;
@ -85,7 +87,7 @@ int grib_accessor_class_data_g2secondary_bitmap_t::pack_double(grib_accessor* a,
primary_bitmap[k++] = present_value;
for (j = 0; j < expand_by; j++)
secondary_bitmap[m++] = val[i + j];
//on++;
// on++;
}
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,11 +10,12 @@
#include "grib_accessor_class_data_g2shsimple_packing.h"
grib_accessor_class_data_g2shsimple_packing_t _grib_accessor_class_data_g2shsimple_packing{"data_g2shsimple_packing"};
grib_accessor_class_data_g2shsimple_packing_t _grib_accessor_class_data_g2shsimple_packing{ "data_g2shsimple_packing" };
grib_accessor_class* grib_accessor_class_data_g2shsimple_packing = &_grib_accessor_class_data_g2shsimple_packing;
void grib_accessor_class_data_g2shsimple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g2shsimple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_shsimple_packing_t::init(a, v, args);
grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a;
@ -24,15 +24,17 @@ void grib_accessor_class_data_g2shsimple_packing_t::init(grib_accessor* a, const
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_g2shsimple_packing_t::value_count(grib_accessor* a, long* len){
int grib_accessor_class_data_g2shsimple_packing_t::value_count(grib_accessor* a, long* len)
{
grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a;
*len = 0;
*len = 0;
return grib_get_long(grib_handle_of_accessor(a), self->numberOfValues, len);
}
int grib_accessor_class_data_g2shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_g2shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a;
int err = GRIB_SUCCESS;
int err = GRIB_SUCCESS;
size_t n_vals = 0;
@ -61,9 +63,10 @@ int grib_accessor_class_data_g2shsimple_packing_t::unpack_double(grib_accessor*
return err;
}
int grib_accessor_class_data_g2shsimple_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_g2shsimple_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a;
int err = GRIB_SUCCESS;
int err = GRIB_SUCCESS;
size_t coded_n_vals = *len - 1;
size_t n_vals = *len;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,43 +11,46 @@
#include "grib_accessor_class_data_g2simple_packing.h"
#include "grib_scaling.h"
grib_accessor_class_data_g2simple_packing_t _grib_accessor_class_data_g2simple_packing{"data_g2simple_packing"};
grib_accessor_class_data_g2simple_packing_t _grib_accessor_class_data_g2simple_packing{ "data_g2simple_packing" };
grib_accessor_class* grib_accessor_class_data_g2simple_packing = &_grib_accessor_class_data_g2simple_packing;
void grib_accessor_class_data_g2simple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_g2simple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_simple_packing_t::init(a, v, args);
grib_accessor_data_g2simple_packing_t* self = (grib_accessor_data_g2simple_packing_t*)a;
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
self->edition = 2;
}
int grib_accessor_class_data_g2simple_packing_t::value_count(grib_accessor* a, long* n_vals){
int grib_accessor_class_data_g2simple_packing_t::value_count(grib_accessor* a, long* n_vals)
{
grib_accessor_data_g2simple_packing_t* self = (grib_accessor_data_g2simple_packing_t*)a;
*n_vals = 0;
*n_vals = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals);
}
int grib_accessor_class_data_g2simple_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){
int grib_accessor_class_data_g2simple_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len)
{
grib_accessor_data_g2simple_packing_t* self = (grib_accessor_data_g2simple_packing_t*)a;
//grib_accessor_class* super = *(a->cclass->super);
size_t n_vals = *len;
double reference_value = 0;
long binary_scale_factor = 0;
long bits_per_value = 0;
long decimal_scale_factor = 0;
double decimal = 1;
size_t buflen = 0;
unsigned char* buf = NULL;
unsigned char* encoded = NULL;
double divisor = 1;
long off = 0;
int ret = 0;
double units_factor = 1.0;
double units_bias = 0.0;
double* val = (double*)cval;
// grib_accessor_class* super = *(a->cclass->super);
size_t n_vals = *len;
double reference_value = 0;
long binary_scale_factor = 0;
long bits_per_value = 0;
long decimal_scale_factor = 0;
double decimal = 1;
size_t buflen = 0;
unsigned char* buf = NULL;
unsigned char* encoded = NULL;
double divisor = 1;
long off = 0;
int ret = 0;
double units_factor = 1.0;
double units_bias = 0.0;
double* val = (double*)cval;
int i;
grib_context* c = a->context;
grib_context* c = a->context;
if (*len == 0) {
grib_buffer_replace(a, NULL, 0, 1, 1);
@ -76,7 +78,8 @@ int grib_accessor_class_data_g2simple_packing_t::pack_double(grib_accessor* a, c
for (i = 0; i < n_vals; i++) {
val[i] = val[i] * units_factor + units_bias;
}
} else {
}
else {
for (i = 0; i < n_vals; i++) {
val[i] *= units_factor;
}
@ -147,7 +150,8 @@ int grib_accessor_class_data_g2simple_packing_t::pack_double(grib_accessor* a, c
return ret;
}
int grib_accessor_class_data_g2simple_packing_t::pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len){
int grib_accessor_class_data_g2simple_packing_t::pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len)
{
size_t length = *len;
grib_buffer_replace(a, val, length, 1, 1);
return GRIB_SUCCESS;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,20 +10,21 @@
#include "grib_accessor_class_data_jpeg2000_packing.h"
grib_accessor_class_data_jpeg2000_packing_t _grib_accessor_class_data_jpeg2000_packing{"data_jpeg2000_packing"};
grib_accessor_class_data_jpeg2000_packing_t _grib_accessor_class_data_jpeg2000_packing{ "data_jpeg2000_packing" };
grib_accessor_class* grib_accessor_class_data_jpeg2000_packing = &_grib_accessor_class_data_jpeg2000_packing;
static int first = 1;
#define JASPER_LIB 1
#define JASPER_LIB 1
#define OPENJPEG_LIB 2
void grib_accessor_class_data_jpeg2000_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_jpeg2000_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_simple_packing_t::init(a, v, args);
const char* user_lib = NULL;
const char* user_lib = NULL;
grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
self->jpeg_lib = 0;
self->type_of_compression_used = grib_arguments_get_name(hand, args, self->carg++);
@ -78,9 +78,10 @@ void grib_accessor_class_data_jpeg2000_packing_t::init(grib_accessor* a, const l
}
}
int grib_accessor_class_data_jpeg2000_packing_t::value_count(grib_accessor* a, long* n_vals){
int grib_accessor_class_data_jpeg2000_packing_t::value_count(grib_accessor* a, long* n_vals)
{
grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a;
*n_vals = 0;
*n_vals = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals);
}
@ -88,16 +89,18 @@ int grib_accessor_class_data_jpeg2000_packing_t::value_count(grib_accessor* a, l
#define EXTRA_BUFFER_SIZE 10240
#if HAVE_JPEG
int grib_accessor_class_data_jpeg2000_packing_t::unpack_float(grib_accessor*, float* val, size_t* len){
int grib_accessor_class_data_jpeg2000_packing_t::unpack_float(grib_accessor*, float* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a;
int err = GRIB_SUCCESS;
size_t i = 0;
size_t buflen = a->byte_count();
int err = GRIB_SUCCESS;
size_t i = 0;
size_t buflen = a->byte_count();
double bscale = 0;
double dscale = 0;
unsigned char* buf = NULL;
@ -112,7 +115,8 @@ int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a,
double units_bias = 0.0;
n_vals = 0;
err = a->value_count(&nn); n_vals = nn;
err = a->value_count(&nn);
n_vals = nn;
if (err)
return err;
@ -176,7 +180,8 @@ int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a,
for (i = 0; i < n_vals; i++) {
val[i] = val[i] * units_factor + units_bias;
}
} else {
}
else {
for (i = 0; i < n_vals; i++) {
val[i] *= units_factor;
}
@ -191,10 +196,11 @@ int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a,
return err;
}
int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){
int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len)
{
grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a;
size_t n_vals = *len;
int err = 0;
size_t n_vals = *len;
int err = 0;
int i;
double reference_value = 0;
long binary_scale_factor = 0;
@ -215,9 +221,9 @@ int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, c
long number_of_data_points;
int ret = 0;
j2k_encode_helper helper;
double units_factor = 1.0;
double units_bias = 0.0;
double* val = (double*)cval;
double units_factor = 1.0;
double units_bias = 0.0;
double* val = (double*)cval;
const char* cclass_name = a->cclass->name;
self->dirty = 1;
@ -329,28 +335,28 @@ int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, c
/* ECC-802: We cannot bomb out here as the user might have changed Ni/Nj and the packingType
* but has not yet submitted the new data values. So len will be out of sync!
* So issue a warning but proceed.
*/
*/
/*return GRIB_INTERNAL_ERROR;*/
grib_context_free(a->context, buf);
return GRIB_SUCCESS;
}
switch (type_of_compression_used) {
case 0: // Lossless
case 0: // Lossless
if (target_compression_ratio != 255) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s %s: When %s=0 (Lossless), %s must be set to 255",
cclass_name, __func__, self->type_of_compression_used, self->target_compression_ratio);
"%s %s: When %s=0 (Lossless), %s must be set to 255",
cclass_name, __func__, self->type_of_compression_used, self->target_compression_ratio);
return GRIB_ENCODING_ERROR;
}
helper.compression = 0;
break;
case 1: // Lossy
case 1: // Lossy
if (target_compression_ratio == 255 || target_compression_ratio == 0) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s %s: When %s=1 (Lossy), %s must be specified",
cclass_name, __func__, self->type_of_compression_used, self->target_compression_ratio);
"%s %s: When %s=1 (Lossy), %s must be specified",
cclass_name, __func__, self->type_of_compression_used, self->target_compression_ratio);
return GRIB_ENCODING_ERROR;
}
Assert(target_compression_ratio != 255);
@ -428,34 +434,39 @@ cleanup:
}
#else
static void print_error_feature_not_enabled(grib_context* c){
static void print_error_feature_not_enabled(grib_context* c)
{
grib_context_log(c, GRIB_LOG_ERROR,
"JPEG support not enabled. Please rebuild with -DENABLE_JPG=ON");
}
int grib_accessor_class_data_jpeg2000_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len){
int grib_accessor_class_data_jpeg2000_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
#endif
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val)
{
grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
size_t size = 0;
double* values = NULL;
int err = 0;
double reference_value = 0;
long bits_per_value = 0;
grib_handle* hand = grib_handle_of_accessor(a);
size_t size = 0;
double* values = NULL;
int err = 0;
double reference_value = 0;
long bits_per_value = 0;
if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS)
return err;
@ -486,14 +497,15 @@ int grib_accessor_class_data_jpeg2000_packing_t::unpack_double_element(grib_acce
return GRIB_SUCCESS;
}
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){
int grib_accessor_class_data_jpeg2000_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
{
grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
size_t size = 0, i = 0;
double* values = NULL;
int err = 0;
double* values = NULL;
int err = 0;
double reference_value = 0;
long bits_per_value = 0;
long bits_per_value = 0;
if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS)
return err;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -14,14 +13,15 @@
#define PNG_ANYBITS
grib_accessor_class_data_png_packing_t _grib_accessor_class_data_png_packing{"data_png_packing"};
grib_accessor_class_data_png_packing_t _grib_accessor_class_data_png_packing{ "data_png_packing" };
grib_accessor_class* grib_accessor_class_data_png_packing = &_grib_accessor_class_data_png_packing;
void grib_accessor_class_data_png_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_png_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_values_t::init(a, v, args);
grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
grib_handle* h = grib_handle_of_accessor(a);
self->number_of_values = grib_arguments_get_name(h, args, self->carg++);
self->reference_value = grib_arguments_get_name(h, args, self->carg++);
@ -36,15 +36,16 @@ void grib_accessor_class_data_png_packing_t::init(grib_accessor* a, const long v
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_png_packing_t::value_count(grib_accessor* a, long* n_vals){
int grib_accessor_class_data_png_packing_t::value_count(grib_accessor* a, long* n_vals)
{
grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a;
*n_vals = 0;
*n_vals = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals);
}
#if HAVE_LIBPNG
#include <png.h>
#include <png.h>
typedef struct png_read_callback_data
{
@ -69,7 +70,7 @@ static void png_write_callback(png_structp png, png_bytep data, png_size_t lengt
if (p->offset + length > p->length) {
/* Errors handled through png_error() are fatal, meaning that png_error() should never return to its caller.
Currently, this is handled via setjmp() and longjmp() */
png_error(png,"Failed to write PNG data");
png_error(png, "Failed to write PNG data");
}
memcpy(p->buffer + p->offset, data, length);
p->offset += length;
@ -80,12 +81,13 @@ static void png_flush_callback(png_structp png)
/* Empty */
}
int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a;
int err = GRIB_SUCCESS;
int i, j;
size_t buflen = a->byte_count();
size_t buflen = a->byte_count();
double bscale = 0;
double dscale = 0;
unsigned char* buf = NULL;
@ -109,7 +111,8 @@ int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, doub
self->dirty = 0;
err = a->value_count(&nn); n_vals = nn;
err = a->value_count(&nn);
n_vals = nn;
if (err) return err;
if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS)
@ -195,11 +198,11 @@ int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, doub
depth = 32;
bits8 = ((bits_per_value + 7) / 8) * 8;
#ifdef PNG_ANYBITS
#ifdef PNG_ANYBITS
Assert(depth == bits8);
#else
#else
Assert(bits_per_value % 8 == 0);
#endif
#endif
i = 0;
@ -224,10 +227,11 @@ cleanup:
static bool is_constant(const double* values, size_t n_vals)
{
bool isConstant = true;
double v = 0;
double v = 0;
size_t i;
for (i = 0; i < n_vals; i++) {
if (i == 0) v = values[i];
if (i == 0)
v = values[i];
else if (v != values[i]) {
isConstant = false;
break;
@ -236,11 +240,12 @@ static bool is_constant(const double* values, size_t n_vals)
return isConstant;
}
int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a;
const char* cclass_name = a->cclass->name;
const char* cclass_name = a->cclass->name;
int err = GRIB_SUCCESS;
int err = GRIB_SUCCESS;
bool is_constant_field = false;
int i, j;
size_t buflen = 0;
@ -299,11 +304,11 @@ int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const
}
if (is_constant_field) {
#ifdef DEBUG
#ifdef DEBUG
for (i = 1; i < n_vals; i++) {
Assert(val[i] == val[0]);
}
#endif
#endif
if ((err = grib_set_double_internal(grib_handle_of_accessor(a), self->reference_value, val[0])) != GRIB_SUCCESS)
return err;
@ -313,7 +318,7 @@ int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const
grib_get_double_internal(grib_handle_of_accessor(a), self->reference_value, &ref);
if (ref != reference_value) {
grib_context_log(a->context, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)",
cclass_name, __func__, self->reference_value, ref, reference_value);
cclass_name, __func__, self->reference_value, ref, reference_value);
return GRIB_INTERNAL_ERROR;
}
}
@ -370,7 +375,7 @@ int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const
/* ECC-802: We cannot bomb out here as the user might have changed Ni/Nj and the packingType
* but has not yet submitted the new data values. So len will be out of sync!
* So issue a warning but proceed.
*/
*/
return GRIB_SUCCESS;
}
@ -379,8 +384,10 @@ int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const
max = val[0];
min = max;
for (i = 1; i < n_vals; i++) {
if (val[i] > max) max = val[i];
else if (val[i] < min) min = val[i];
if (val[i] > max)
max = val[i];
else if (val[i] < min)
min = val[i];
}
min *= d;
max *= d;
@ -393,16 +400,16 @@ int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const
if (reference_value > min) {
grib_context_log(a->context, GRIB_LOG_ERROR, "reference_value=%g min_value=%g diff=%g",
reference_value, min, reference_value - min);
reference_value, min, reference_value - min);
return GRIB_INTERNAL_ERROR;
}
binary_scale_factor = grib_get_binary_scale_fact(max, reference_value, bits_per_value, &err);
divisor = codes_power<double>(-binary_scale_factor, 2);
#ifndef PNG_ANYBITS
#ifndef PNG_ANYBITS
Assert(bits_per_value % 8 == 0);
#endif
#endif
bits8 = (bits_per_value + 7) / 8 * 8;
encoded = (unsigned char*)grib_context_buffer_malloc_clear(a->context, bits8 / 8 * n_vals);
if (!encoded) {
@ -531,15 +538,16 @@ cleanup:
return err;
}
int grib_accessor_class_data_png_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){
int grib_accessor_class_data_png_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val)
{
/* The index idx relates to codedValues NOT values! */
grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
int err = 0;
size_t size = 0;
double reference_value = 0;
long bits_per_value = 0;
double* values = NULL;
grib_handle* hand = grib_handle_of_accessor(a);
int err = 0;
size_t size = 0;
double reference_value = 0;
long bits_per_value = 0;
double* values = NULL;
if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS)
return err;
@ -566,15 +574,16 @@ int grib_accessor_class_data_png_packing_t::unpack_double_element(grib_accessor*
return GRIB_SUCCESS;
}
int grib_accessor_class_data_png_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){
int grib_accessor_class_data_png_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
{
/* The index idx relates to codedValues NOT values! */
grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
int err = 0;
grib_handle* hand = grib_handle_of_accessor(a);
int err = 0;
size_t size = 0, i = 0;
double reference_value = 0;
long bits_per_value = 0;
double* values = NULL;
double reference_value = 0;
long bits_per_value = 0;
double* values = NULL;
if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS)
return err;
@ -612,24 +621,29 @@ int grib_accessor_class_data_png_packing_t::unpack_double_element_set(grib_acces
#else
static void print_error_feature_not_enabled(grib_context* c){
static void print_error_feature_not_enabled(grib_context* c)
{
grib_context_log(c, GRIB_LOG_ERROR,
"PNG support not enabled. Please rebuild with -DENABLE_PNG=ON");
}
int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_accessor_class_data_png_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){
int grib_accessor_class_data_png_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_accessor_class_data_png_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){
int grib_accessor_class_data_png_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,11 +11,12 @@
#include "grib_accessor_class_data_raw_packing.h"
#include "grib_ieeefloat.h"
grib_accessor_class_data_raw_packing_t _grib_accessor_class_data_raw_packing{"data_raw_packing"};
grib_accessor_class_data_raw_packing_t _grib_accessor_class_data_raw_packing{ "data_raw_packing" };
grib_accessor_class* grib_accessor_class_data_raw_packing = &_grib_accessor_class_data_raw_packing;
void grib_accessor_class_data_raw_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_raw_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_values_t::init(a, v, args);
grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a;
@ -25,19 +25,21 @@ void grib_accessor_class_data_raw_packing_t::init(grib_accessor* a, const long v
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_raw_packing_t::value_count(grib_accessor* a, long* n_vals){
int grib_accessor_class_data_raw_packing_t::value_count(grib_accessor* a, long* n_vals)
{
grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a;
*n_vals = 0;
*n_vals = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals);
}
int grib_accessor_class_data_raw_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_raw_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a;
unsigned char* buf = NULL;
int bytes = 0;
size_t nvals = 0;
long inlen = a->byte_count();
long precision = 0;
unsigned char* buf = NULL;
int bytes = 0;
size_t nvals = 0;
long inlen = a->byte_count();
long precision = 0;
int code = GRIB_SUCCESS;
@ -71,7 +73,8 @@ int grib_accessor_class_data_raw_packing_t::unpack_double(grib_accessor* a, doub
return code;
}
int grib_accessor_class_data_raw_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_raw_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a;
int bytes = 0;
@ -127,7 +130,7 @@ clean_up:
* free(buffer);
* if (free_values)
* free(values);
*/
*/
grib_buffer_replace(a, buffer, bufsize, 1, 1);
@ -142,14 +145,16 @@ clean_up:
return code;
}
int grib_accessor_class_data_raw_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){
int ret = 0;
int grib_accessor_class_data_raw_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val)
{
int ret = 0;
grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a;
unsigned char* buf = NULL;
int bytes = 0;
size_t nvals = 0;
long inlen = a->byte_count(); long pos = 0;
long precision = 0;
unsigned char* buf = NULL;
int bytes = 0;
size_t nvals = 0;
long inlen = a->byte_count();
long pos = 0;
long precision = 0;
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS)
return ret;
@ -183,11 +188,12 @@ int grib_accessor_class_data_raw_packing_t::unpack_double_element(grib_accessor*
return ret;
}
int grib_accessor_class_data_raw_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){
int err = 0;
int grib_accessor_class_data_raw_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
{
int err = 0;
size_t i = 0;
for (i=0; i<len; ++i) {
if ((err = unpack_double_element(a, index_array[i], val_array+i)) != GRIB_SUCCESS)
for (i = 0; i < len; ++i) {
if ((err = unpack_double_element(a, index_array[i], val_array + i)) != GRIB_SUCCESS)
return err;
}
return GRIB_SUCCESS;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,44 +11,47 @@
#include "grib_accessor_class_data_run_length_packing.h"
#include "grib_scaling.h"
grib_accessor_class_data_run_length_packing_t _grib_accessor_class_data_run_length_packing{"data_run_length_packing"};
grib_accessor_class_data_run_length_packing_t _grib_accessor_class_data_run_length_packing{ "data_run_length_packing" };
grib_accessor_class* grib_accessor_class_data_run_length_packing = &_grib_accessor_class_data_run_length_packing;
void grib_accessor_class_data_run_length_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_run_length_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_values_t::init(a, v, args);
grib_accessor_data_run_length_packing_t* self = (grib_accessor_data_run_length_packing_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
self->number_of_values = grib_arguments_get_name(gh, args, self->carg++);
self->bits_per_value = grib_arguments_get_name(gh, args, self->carg++);
self->max_level_value = grib_arguments_get_name(gh, args, self->carg++);
self->number_of_level_values = grib_arguments_get_name(gh, args, self->carg++);
self->decimal_scale_factor = grib_arguments_get_name(gh, args, self->carg++);
self->level_values = grib_arguments_get_name(gh, args, self->carg++);
grib_handle* gh = grib_handle_of_accessor(a);
self->number_of_values = grib_arguments_get_name(gh, args, self->carg++);
self->bits_per_value = grib_arguments_get_name(gh, args, self->carg++);
self->max_level_value = grib_arguments_get_name(gh, args, self->carg++);
self->number_of_level_values = grib_arguments_get_name(gh, args, self->carg++);
self->decimal_scale_factor = grib_arguments_get_name(gh, args, self->carg++);
self->level_values = grib_arguments_get_name(gh, args, self->carg++);
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
int grib_accessor_class_data_run_length_packing_t::value_count(grib_accessor* a, long* number_of_values){
int grib_accessor_class_data_run_length_packing_t::value_count(grib_accessor* a, long* number_of_values)
{
grib_accessor_data_run_length_packing_t* self = (grib_accessor_data_run_length_packing_t*)a;
*number_of_values = 0;
*number_of_values = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, number_of_values);
}
int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_run_length_packing_t* self = (grib_accessor_data_run_length_packing_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
int err = GRIB_SUCCESS;
grib_handle* gh = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
int err = GRIB_SUCCESS;
long seclen, number_of_values, bits_per_value, max_level_value, number_of_level_values, decimal_scale_factor;
long* level_values = NULL;
long* level_values = NULL;
size_t level_values_size = 0;
long i = 0, number_of_compressed_values = 0, range = 0, offsetBeforeData = 0, pos = 0;
long v, n, factor, k, j;
long* compressed_values = NULL;
long* compressed_values = NULL;
double level_scale_factor = 0;
double* levels = NULL;
unsigned char* buf = NULL;
double missingValue = 9999.0;
double* levels = NULL;
unsigned char* buf = NULL;
double missingValue = 9999.0;
if ((err = grib_get_long_internal(gh, self->seclen, &seclen)) != GRIB_SUCCESS)
return err;
@ -66,12 +68,12 @@ int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor*
if ((err = grib_get_double(gh, "missingValue", &missingValue)) != GRIB_SUCCESS)
return err;
level_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_level_values);
level_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_level_values);
level_values_size = number_of_level_values;
if ((err = grib_get_long_array_internal(gh, self->level_values, level_values, &level_values_size)) != GRIB_SUCCESS)
return err;
*len = number_of_values;
i = 0;
*len = number_of_values;
i = 0;
number_of_compressed_values = ((seclen - 5) * 8) / bits_per_value;
if (number_of_compressed_values == 0 || max_level_value == 0) {
for (i = 0; i < number_of_values; i++) {
@ -82,23 +84,24 @@ int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor*
range = (1 << bits_per_value) - 1 - max_level_value;
if ((max_level_value <= 0) || (number_of_level_values <= 0) || (max_level_value > number_of_level_values) || (range <= 0)) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s: parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), "
"number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)",
cclass_name, max_level_value, number_of_level_values, range);
"%s: parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), "
"number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)",
cclass_name, max_level_value, number_of_level_values, range);
return GRIB_DECODING_ERROR;
}
if (decimal_scale_factor > 127) {
decimal_scale_factor = -(decimal_scale_factor - 128);
}
level_scale_factor = codes_power<double>(-decimal_scale_factor, 10.0);
levels = (double*)grib_context_malloc_clear(a->context, sizeof(double) * (number_of_level_values + 1));
levels[0] = missingValue;
levels = (double*)grib_context_malloc_clear(a->context, sizeof(double) * (number_of_level_values + 1));
levels[0] = missingValue;
for (i = 0; i < number_of_level_values; i++) {
levels[i + 1] = level_values[i] * level_scale_factor;
}
compressed_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_compressed_values);
buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
offsetBeforeData = a->byte_offset(); buf += offsetBeforeData;
buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
offsetBeforeData = a->byte_offset();
buf += offsetBeforeData;
pos = 0;
grib_decode_long_array(buf, &pos, bits_per_value, number_of_compressed_values, compressed_values);
j = 0;
@ -106,13 +109,13 @@ int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor*
while (i < number_of_compressed_values) {
if (compressed_values[i] > max_level_value) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s: numberOfValues mismatch: i=%ld, "
"compressed_values[i]=%ld, max_level_value=%ld",
cclass_name, i, compressed_values[i], max_level_value);
"%s: numberOfValues mismatch: i=%ld, "
"compressed_values[i]=%ld, max_level_value=%ld",
cclass_name, i, compressed_values[i], max_level_value);
break;
}
v = compressed_values[i++];
n = 1;
v = compressed_values[i++];
n = 1;
factor = 1;
while (i < number_of_compressed_values && compressed_values[i] > max_level_value) {
n += factor * (compressed_values[i] - max_level_value - 1);
@ -121,7 +124,7 @@ int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor*
}
if (n > number_of_values) {
grib_context_log(a->context, GRIB_LOG_ERROR, "%s: numberOfValues mismatch: n=%ld, number_of_values=%ld",
cclass_name, n, number_of_values);
cclass_name, n, number_of_values);
break;
}
for (k = 0; k < n; k++) {
@ -139,19 +142,20 @@ int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor*
return err;
}
int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_run_length_packing_t* self = (grib_accessor_data_run_length_packing_t*)a;
grib_handle* gh = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
int err = GRIB_SUCCESS;
grib_handle* gh = grib_handle_of_accessor(a);
const char* cclass_name = a->cclass->name;
int err = GRIB_SUCCESS;
long number_of_values, bits_per_value, max_level_value, number_of_level_values, decimal_scale_factor;
long* level_values = NULL;
long* level_values = NULL;
size_t level_values_size = 0;
long i = 0, range = 0, pos = 0, n = 0, j = 0, k = 0, l = 0, missingValueLong = 0;
double level_scale_factor = 0;
unsigned char* buf = NULL;
double missingValue = 9999.0;
size_t n_vals = *len;
unsigned char* buf = NULL;
double missingValue = 9999.0;
size_t n_vals = *len;
if ((err = grib_get_long_internal(gh, self->number_of_values, &number_of_values)) != GRIB_SUCCESS)
return err;
@ -177,7 +181,7 @@ int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a,
return GRIB_SUCCESS;
}
level_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_level_values);
level_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_level_values);
level_values_size = number_of_level_values;
if ((err = grib_get_long_array_internal(gh, self->level_values, level_values, &level_values_size)) != GRIB_SUCCESS)
return err;
@ -185,7 +189,7 @@ int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a,
decimal_scale_factor = -(decimal_scale_factor - 128);
}
level_scale_factor = grib_power(-decimal_scale_factor, 10.0);
missingValueLong = (long)(round(missingValue / level_scale_factor));
missingValueLong = (long)(round(missingValue / level_scale_factor));
for (i = 0; i < number_of_level_values; i++) {
if (missingValueLong == level_values[i]) {
grib_context_log(a->context, GRIB_LOG_ERROR, "%s: Parameters are invalid: level_values[%ld]=%ld, missingValueLong=%ld",
@ -196,22 +200,23 @@ int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a,
range = (1 << bits_per_value) - 1 - max_level_value;
if ((max_level_value <= 0) || (number_of_level_values <= 0) || (max_level_value > number_of_level_values) || (range <= 0)) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s: Parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), "
"number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)",
cclass_name, max_level_value, number_of_level_values, range);
"%s: Parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), "
"number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)",
cclass_name, max_level_value, number_of_level_values, range);
return GRIB_ENCODING_ERROR;
}
buf = (unsigned char*)grib_context_malloc(a->context, 2 * number_of_values);
for (i = 0; i < number_of_values; i++) {
k = (long)(round(val[i] / level_scale_factor));
k = (long)(round(val[i] / level_scale_factor));
err = GRIB_ENCODING_ERROR;
if (missingValueLong == k) {
k = 0;
k = 0;
err = GRIB_SUCCESS;
} else {
}
else {
for (j = 0; j < max_level_value; j++) {
if (level_values[j] == k) {
k = j + 1;
k = j + 1;
err = GRIB_SUCCESS;
break;
}
@ -219,17 +224,19 @@ int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a,
}
if (err != GRIB_SUCCESS) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s: Values and/or parameters are invalid: val[%ld]=%lf, level_value=%ld, max_level_value=%ld",
cclass_name, i, val[i], k, max_level_value);
"%s: Values and/or parameters are invalid: val[%ld]=%lf, level_value=%ld, max_level_value=%ld",
cclass_name, i, val[i], k, max_level_value);
return GRIB_ENCODING_ERROR;
}
if (i == 0) {
grib_encode_unsigned_longb(buf, k, &pos, bits_per_value);
} else if (i == number_of_values - 1) {
}
else if (i == number_of_values - 1) {
if (k != l) {
if (n == 0) {
grib_encode_unsigned_longb(buf, k, &pos, bits_per_value);
} else {
}
else {
while (n >= range) {
grib_encode_unsigned_longb(buf, (n % range) + max_level_value + 1, &pos, bits_per_value);
n = n / range;
@ -237,7 +244,8 @@ int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a,
grib_encode_unsigned_longb(buf, n + max_level_value + 1, &pos, bits_per_value);
grib_encode_unsigned_longb(buf, k, &pos, bits_per_value);
}
} else {
}
else {
n = n + 1;
while (n >= range) {
grib_encode_unsigned_longb(buf, (n % range) + max_level_value + 1, &pos, bits_per_value);
@ -245,11 +253,13 @@ int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a,
}
grib_encode_unsigned_longb(buf, n + max_level_value + 1, &pos, bits_per_value);
}
} else {
}
else {
if (k != l) {
if ( n == 0 ) {
if (n == 0) {
grib_encode_unsigned_longb(buf, k, &pos, bits_per_value);
} else {
}
else {
while (n >= range) {
grib_encode_unsigned_longb(buf, (n % range) + max_level_value + 1, &pos, bits_per_value);
n = n / range;
@ -258,14 +268,15 @@ int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a,
grib_encode_unsigned_longb(buf, k, &pos, bits_per_value);
n = 0;
}
} else {
}
else {
n = n + 1;
}
}
l = k;
}
grib_context_free(a->context, level_values);
grib_buffer_replace(a, buf, pos/8, 1, 1);
grib_buffer_replace(a, buf, pos / 8, 1, 1);
grib_context_buffer_free(a->context, buf);
return err;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,26 +10,29 @@
#include "grib_accessor_class_data_secondary_bitmap.h"
grib_accessor_class_data_secondary_bitmap_t _grib_accessor_class_data_secondary_bitmap{"data_secondary_bitmap"};
grib_accessor_class_data_secondary_bitmap_t _grib_accessor_class_data_secondary_bitmap{ "data_secondary_bitmap" };
grib_accessor_class* grib_accessor_class_data_secondary_bitmap = &_grib_accessor_class_data_secondary_bitmap;
void grib_accessor_class_data_secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, v, args);
grib_accessor_data_secondary_bitmap_t* self = (grib_accessor_data_secondary_bitmap_t*)a;
self->primary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0);
self->secondary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1);
self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2);
self->expand_by = grib_arguments_get_name(grib_handle_of_accessor(a), args, 3);
self->primary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0);
self->secondary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1);
self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2);
self->expand_by = grib_arguments_get_name(grib_handle_of_accessor(a), args, 3);
a->length = 0;
}
void grib_accessor_class_data_secondary_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_data_secondary_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_values(dumper, a);
}
int grib_accessor_class_data_secondary_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_secondary_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_secondary_bitmap_t* self = (grib_accessor_data_secondary_bitmap_t*)a;
size_t i = 0;
@ -45,7 +47,8 @@ int grib_accessor_class_data_secondary_bitmap_t::unpack_double(grib_accessor* a,
size_t secondary_len;
double* primary_vals;
double* secondary_vals;
err = a->value_count(&nn); n_vals = nn;
err = a->value_count(&nn);
n_vals = nn;
if (err)
return err;
@ -111,8 +114,9 @@ int grib_accessor_class_data_secondary_bitmap_t::unpack_double(grib_accessor* a,
return err;
}
int grib_accessor_class_data_secondary_bitmap_t::get_native_type(grib_accessor* a){
int grib_accessor_class_data_secondary_bitmap_t::get_native_type(grib_accessor* a)
{
// grib_accessor_data_secondary_bitmap_t* self = (grib_accessor_data_secondary_bitmap_t*)a;
//return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values));
// return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values));
return GRIB_TYPE_DOUBLE;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,17 +11,18 @@
#include "grib_accessor_class_data_sh_packed.h"
#include "grib_scaling.h"
grib_accessor_class_data_sh_packed_t _grib_accessor_class_data_sh_packed{"data_sh_packed"};
grib_accessor_class_data_sh_packed_t _grib_accessor_class_data_sh_packed{ "data_sh_packed" };
grib_accessor_class* grib_accessor_class_data_sh_packed = &_grib_accessor_class_data_sh_packed;
typedef unsigned long (*encode_float_proc)(double);
typedef double (*decode_float_proc)(unsigned long);
void grib_accessor_class_data_sh_packed_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_sh_packed_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_simple_packing_t::init(a, v, args);
grib_accessor_data_sh_packed_t* self = (grib_accessor_data_sh_packed_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
self->GRIBEX_sh_bug_present = grib_arguments_get_name(hand, args, self->carg++);
self->ieee_floats = grib_arguments_get_name(hand, args, self->carg++);
@ -39,11 +39,12 @@ void grib_accessor_class_data_sh_packed_t::init(grib_accessor* a, const long v,
a->length = 0;
}
int grib_accessor_class_data_sh_packed_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_data_sh_packed_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_data_sh_packed_t* self = (grib_accessor_data_sh_packed_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
int ret = 0;
const char* cclass_name = a->cclass->name;
grib_handle* hand = grib_handle_of_accessor(a);
int ret = 0;
const char* cclass_name = a->cclass->name;
long sub_j = 0;
long sub_k = 0;
@ -75,42 +76,44 @@ int grib_accessor_class_data_sh_packed_t::value_count(grib_accessor* a, long* co
return ret;
}
int grib_accessor_class_data_sh_packed_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_sh_packed_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_sh_packed_t* self = (grib_accessor_data_sh_packed_t*)a;
size_t i = 0;
int ret = GRIB_SUCCESS;
size_t i = 0;
int ret = GRIB_SUCCESS;
// long lup = 0;
long hcount = 0, lcount = 0, hpos = 0, mmax = 0, n_vals = 0;
double* scals = NULL;
/* double *pscals=NULL; */
double s = 0, d = 0, laplacianOperator = 0;
unsigned char* buf = NULL;
unsigned char* hres = NULL;
unsigned char* lres = NULL;
unsigned char* buf = NULL;
unsigned char* hres = NULL;
unsigned char* lres = NULL;
unsigned long packed_offset;
long lpos = 0;
long maxv = 0;
long GRIBEX_sh_bug_present = 0;
long ieee_floats = 0;
long offsetdata = 0;
long bits_per_value = 0;
double reference_value = 0;
long binary_scale_factor = 0;
long decimal_scale_factor = 0;
long offsetdata = 0;
long bits_per_value = 0;
double reference_value = 0;
long binary_scale_factor = 0;
long decimal_scale_factor = 0;
long sub_j = 0, sub_k = 0, sub_m = 0, pen_j = 0, pen_k = 0, pen_m = 0;
double operat = 0;
int bytes = 0;
int err = 0;
int bytes = 0;
int err = 0;
decode_float_proc decode_float = NULL;
n_vals = 0;
err = a->value_count(&n_vals); if (err)
err = a->value_count(&n_vals);
if (err)
return err;
if (*len < n_vals) {
@ -191,7 +194,7 @@ int grib_accessor_class_data_sh_packed_t::unpack_double(grib_accessor* a, double
d = codes_power<double>(-decimal_scale_factor, 10);
scals = (double*)grib_context_malloc(a->context, maxv * sizeof(double));
if(!scals) return GRIB_OUT_OF_MEMORY;
if (!scals) return GRIB_OUT_OF_MEMORY;
scals[0] = 0;
for (i = 1; i < maxv; i++) {

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,17 +11,18 @@
#include "grib_accessor_class_data_sh_unpacked.h"
#include "grib_scaling.h"
grib_accessor_class_data_sh_unpacked_t _grib_accessor_class_data_sh_unpacked{"data_sh_unpacked"};
grib_accessor_class_data_sh_unpacked_t _grib_accessor_class_data_sh_unpacked{ "data_sh_unpacked" };
grib_accessor_class* grib_accessor_class_data_sh_unpacked = &_grib_accessor_class_data_sh_unpacked;
typedef unsigned long (*encode_float_proc)(double);
typedef double (*decode_float_proc)(unsigned long);
void grib_accessor_class_data_sh_unpacked_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_sh_unpacked_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_data_simple_packing_t::init(a, v, args);
grib_accessor_data_sh_unpacked_t* self = (grib_accessor_data_sh_unpacked_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
self->GRIBEX_sh_bug_present = grib_arguments_get_name(hand, args, self->carg++);
self->ieee_floats = grib_arguments_get_name(hand, args, self->carg++);
@ -39,9 +39,10 @@ void grib_accessor_class_data_sh_unpacked_t::init(grib_accessor* a, const long v
a->length = 0;
}
int grib_accessor_class_data_sh_unpacked_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_data_sh_unpacked_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_data_sh_unpacked_t* self = (grib_accessor_data_sh_unpacked_t*)a;
int ret = 0;
int ret = 0;
long sub_j = 0;
long sub_k = 0;
@ -62,7 +63,8 @@ int grib_accessor_class_data_sh_unpacked_t::value_count(grib_accessor* a, long*
return ret;
}
int grib_accessor_class_data_sh_unpacked_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_data_sh_unpacked_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_data_sh_unpacked_t* self = (grib_accessor_data_sh_unpacked_t*)a;
size_t i = 0;
@ -110,7 +112,8 @@ int grib_accessor_class_data_sh_unpacked_t::unpack_double(grib_accessor* a, doub
decode_float_proc decode_float = NULL;
n_vals = 0;
err = a->value_count(&n_vals); if (err)
err = a->value_count(&n_vals);
if (err)
return err;
if (*len < n_vals) {

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,11 +10,12 @@
#include "grib_accessor_class_data_shsimple_packing.h"
grib_accessor_class_data_shsimple_packing_t _grib_accessor_class_data_shsimple_packing{"data_shsimple_packing"};
grib_accessor_class_data_shsimple_packing_t _grib_accessor_class_data_shsimple_packing{ "data_shsimple_packing" };
grib_accessor_class* grib_accessor_class_data_shsimple_packing = &_grib_accessor_class_data_shsimple_packing;
void grib_accessor_class_data_shsimple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_data_shsimple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, v, args);
grib_accessor_data_shsimple_packing_t* self = (grib_accessor_data_shsimple_packing_t*)a;
@ -26,13 +26,15 @@ void grib_accessor_class_data_shsimple_packing_t::init(grib_accessor* a, const l
a->length = 0;
}
void grib_accessor_class_data_shsimple_packing_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_data_shsimple_packing_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_values(dumper, a);
}
int grib_accessor_class_data_shsimple_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_data_shsimple_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_shsimple_packing_t* self = (grib_accessor_data_shsimple_packing_t*)a;
int err = GRIB_SUCCESS;
int err = GRIB_SUCCESS;
size_t coded_n_vals = *len - 1;
size_t n_vals = *len;
@ -55,6 +57,7 @@ int grib_accessor_class_data_shsimple_packing_t::pack_double(grib_accessor* a, c
return err;
}
int grib_accessor_class_data_shsimple_packing_t::get_native_type(grib_accessor* a){
int grib_accessor_class_data_shsimple_packing_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_DOUBLE;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,15 +10,16 @@
#include "grib_accessor_class_decimal_precision.h"
grib_accessor_class_decimal_precision_t _grib_accessor_class_decimal_precision{"decimal_precision"};
grib_accessor_class_decimal_precision_t _grib_accessor_class_decimal_precision{ "decimal_precision" };
grib_accessor_class* grib_accessor_class_decimal_precision = &_grib_accessor_class_decimal_precision;
void grib_accessor_class_decimal_precision_t::init(grib_accessor* a, const long l, grib_arguments* args){
void grib_accessor_class_decimal_precision_t::init(grib_accessor* a, const long l, grib_arguments* args)
{
grib_accessor_class_long_t::init(a, l, args);
int n = 0;
grib_accessor_decimal_precision_t* self = (grib_accessor_decimal_precision_t*)a;
int n = 0;
self->bits_per_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
self->decimal_scale_factor = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
self->changing_precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
@ -29,11 +29,12 @@ void grib_accessor_class_decimal_precision_t::init(grib_accessor* a, const long
a->length = 0;
}
int grib_accessor_class_decimal_precision_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int ret = 0;
int grib_accessor_class_decimal_precision_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_decimal_precision_t* self = (grib_accessor_decimal_precision_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
grib_handle* h = grib_handle_of_accessor(a);
int ret = GRIB_SUCCESS;
if ((ret = grib_get_long_internal(h, self->decimal_scale_factor, val)) != GRIB_SUCCESS)
return ret;
@ -41,14 +42,16 @@ int grib_accessor_class_decimal_precision_t::unpack_long(grib_accessor* a, long*
return ret;
}
int grib_accessor_class_decimal_precision_t::pack_long(grib_accessor* a, const long* val, size_t* len){
long bitsPerValue = 0;
double* values = NULL;
size_t size = 0;
int ret = 0;
int grib_accessor_class_decimal_precision_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_decimal_precision_t* self = (grib_accessor_decimal_precision_t*)a;
grib_context* c = a->context;
grib_handle* h = grib_handle_of_accessor(a);
long bitsPerValue = 0;
double* values = NULL;
size_t size = 0;
int ret = 0;
grib_context* c = a->context;
grib_handle* h = grib_handle_of_accessor(a);
if (!self->values) {
if ((ret = grib_set_long_internal(h, self->bits_per_value, 0)) != GRIB_SUCCESS)

View File

@ -30,9 +30,10 @@ int grib_accessor_class_dirty_t::pack_long(grib_accessor* a, const long* val, si
grib_accessor_dirty_t* self = (grib_accessor_dirty_t*)a;
grib_accessor* x = grib_find_accessor(grib_handle_of_accessor(a), self->accessor);
if (x)
if (x) {
//printf("\ngrib_accessor_class_dirty_t::pack_long: Setting dirty to %ld on %s\n", *val, x->name);
x->dirty = *val;
}
return GRIB_SUCCESS;
}
@ -41,10 +42,11 @@ int grib_accessor_class_dirty_t::unpack_long(grib_accessor* a, long* val, size_t
grib_accessor_dirty_t* self = (grib_accessor_dirty_t*)a;
grib_accessor* x = grib_find_accessor(grib_handle_of_accessor(a), self->accessor);
if (x)
x->dirty = 1;
*val = 1;
if (x) {
//printf("\ngrib_accessor_class_dirty_t::unpack_long: Getting dirty for %s\n", x->name);
*val = x->dirty;
} else {
*val = 1;
}
return GRIB_SUCCESS;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,25 +10,27 @@
#include "grib_accessor_class_g1bitmap.h"
grib_accessor_class_g1bitmap_t _grib_accessor_class_g1bitmap{"g1bitmap"};
grib_accessor_class_g1bitmap_t _grib_accessor_class_g1bitmap{ "g1bitmap" };
grib_accessor_class* grib_accessor_class_g1bitmap = &_grib_accessor_class_g1bitmap;
void grib_accessor_class_g1bitmap_t::init(grib_accessor* a, const long len, grib_arguments* arg){
void grib_accessor_class_g1bitmap_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_bitmap_t::init(a, len, arg);
grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a;
self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 4);
self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 4);
}
int grib_accessor_class_g1bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_g1bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a;
size_t tlen;
unsigned char* buf = NULL;
size_t i;
int err = 0;
long pos = 0;
//long bmaplen = 0;
int err = 0;
long pos = 0;
// long bmaplen = 0;
const int bit_padding = 16;
double miss_values = 0;
tlen = ((*len + bit_padding - 1) / bit_padding * bit_padding) / 8;
@ -45,7 +46,7 @@ int grib_accessor_class_g1bitmap_t::pack_double(grib_accessor* a, const double*
if (val[i] == miss_values)
pos++;
else {
//bmaplen++;
// bmaplen++;
grib_set_bit_on(buf, &pos);
}
}
@ -61,7 +62,8 @@ int grib_accessor_class_g1bitmap_t::pack_double(grib_accessor* a, const double*
return GRIB_SUCCESS;
}
int grib_accessor_class_g1bitmap_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_g1bitmap_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a;
long tlen;
int err;
@ -73,12 +75,14 @@ int grib_accessor_class_g1bitmap_t::value_count(grib_accessor* a, long* count){
return err;
}
int grib_accessor_class_g1bitmap_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len){
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
int grib_accessor_class_g1bitmap_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len)
{
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a;
long tlen;
int err;
long length = a->byte_count(); long offset = a->byte_offset();
long length = a->byte_count();
long offset = a->byte_offset();
if (*len < (size_t)length) {
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it is %ld bytes long\n", a->name, length);
*len = length;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,15 +10,16 @@
#include "grib_accessor_class_g1date.h"
grib_accessor_class_g1date_t _grib_accessor_class_g1date{"g1date"};
grib_accessor_class_g1date_t _grib_accessor_class_g1date{ "g1date" };
grib_accessor_class* grib_accessor_class_g1date = &_grib_accessor_class_g1date;
void grib_accessor_class_g1date_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1date_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_long_t::init(a, l, c);
grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
int n = 0;
grib_handle* hand = grib_handle_of_accessor(a);
int n = 0;
self->century = grib_arguments_get_name(hand, c, n++);
self->year = grib_arguments_get_name(hand, c, n++);
@ -27,11 +27,12 @@ void grib_accessor_class_g1date_t::init(grib_accessor* a, const long l, grib_arg
self->day = grib_arguments_get_name(hand, c, n++);
}
int grib_accessor_class_g1date_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_g1date_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
int ret = 0;
int ret = 0;
long year = 0, century = 0, month = 0, day = 0;
if ((ret = grib_get_long_internal(hand, self->century, &century)) != GRIB_SUCCESS)
@ -59,12 +60,13 @@ int grib_accessor_class_g1date_t::unpack_long(grib_accessor* a, long* val, size_
return GRIB_SUCCESS;
}
int grib_accessor_class_g1date_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int grib_accessor_class_g1date_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
int ret = 0;
long v = val[0];
int ret = 0;
long v = val[0];
long year = 0, century = 0, month = 0, day = 0;
if (*len != 1)
@ -116,9 +118,10 @@ static const char* months[] = {
"dec",
};
int grib_accessor_class_g1date_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_g1date_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
int ret = 0;
char tmp[1024];
@ -159,7 +162,8 @@ int grib_accessor_class_g1date_t::unpack_string(grib_accessor* a, char* val, siz
return GRIB_SUCCESS;
}
int grib_accessor_class_g1date_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_g1date_t::value_count(grib_accessor* a, long* count)
{
*count = 1;
return 0;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,31 +10,33 @@
#include "grib_accessor_class_g1day_of_the_year_date.h"
grib_accessor_class_g1day_of_the_year_date_t _grib_accessor_class_g1day_of_the_year_date{"g1day_of_the_year_date"};
grib_accessor_class_g1day_of_the_year_date_t _grib_accessor_class_g1day_of_the_year_date{ "g1day_of_the_year_date" };
grib_accessor_class* grib_accessor_class_g1day_of_the_year_date = &_grib_accessor_class_g1day_of_the_year_date;
void grib_accessor_class_g1day_of_the_year_date_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1day_of_the_year_date_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_g1date_t::init(a, l, c);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
}
void grib_accessor_class_g1day_of_the_year_date_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_g1day_of_the_year_date_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_string(dumper, a, NULL);
}
int grib_accessor_class_g1day_of_the_year_date_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_g1day_of_the_year_date_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
/* special clim case where each mont have 30 days.. to comply with mars*/
grib_accessor_g1day_of_the_year_date_t* self = (grib_accessor_g1day_of_the_year_date_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
char tmp[1024];
long year = 0;
long century = 0;
long month = 0;
long day = 0;
long fullyear = 0;
long year = 0;
long century = 0;
long month = 0;
long day = 0;
long fullyear = 0;
long fake_day_of_year = 0;
grib_get_long_internal(hand, self->century, &century);
@ -43,7 +44,7 @@ int grib_accessor_class_g1day_of_the_year_date_t::unpack_string(grib_accessor* a
grib_get_long_internal(hand, self->month, &month);
grib_get_long_internal(hand, self->year, &year);
fullyear = ((century - 1) * 100 + year);
fullyear = ((century - 1) * 100 + year);
fake_day_of_year = ((month - 1) * 30) + day;
snprintf(tmp, sizeof(tmp), "%04ld-%03ld", fullyear, fake_day_of_year);

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,14 +10,15 @@
#include "grib_accessor_class_g1end_of_interval_monthly.h"
grib_accessor_class_g1end_of_interval_monthly_t _grib_accessor_class_g1end_of_interval_monthly{"g1end_of_interval_monthly"};
grib_accessor_class_g1end_of_interval_monthly_t _grib_accessor_class_g1end_of_interval_monthly{ "g1end_of_interval_monthly" };
grib_accessor_class* grib_accessor_class_g1end_of_interval_monthly = &_grib_accessor_class_g1end_of_interval_monthly;
void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_abstract_vector_t::init(a, l, c);
grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a;
int n = 0;
int n = 0;
self->verifyingMonth = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
@ -26,20 +26,23 @@ void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, con
a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN;
self->number_of_elements = 6;
self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements);
self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements);
a->length = 0;
a->dirty = 1;
}
int grib_accessor_class_g1end_of_interval_monthly_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_g1end_of_interval_monthly_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a;
int ret = 0;
char verifyingMonth[7] = {0,};
int ret = 0;
char verifyingMonth[7] = {
0,
};
size_t slen = 7;
long year = 0, month = 0, date = 0;
const long mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
long days = 0;
long days = 0;
if (!a->dirty)
return GRIB_SUCCESS;
@ -50,7 +53,7 @@ int grib_accessor_class_g1end_of_interval_monthly_t::unpack_double(grib_accessor
if ((ret = grib_get_string(grib_handle_of_accessor(a), self->verifyingMonth, verifyingMonth, &slen)) != GRIB_SUCCESS)
return ret;
date = atoi(verifyingMonth);
date = atoi(verifyingMonth);
if (date < 0) {
return GRIB_INVALID_ARGUMENT;
}
@ -85,19 +88,22 @@ int grib_accessor_class_g1end_of_interval_monthly_t::unpack_double(grib_accessor
return ret;
}
int grib_accessor_class_g1end_of_interval_monthly_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_g1end_of_interval_monthly_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a;
*count = self->number_of_elements;
*count = self->number_of_elements;
return 0;
}
void grib_accessor_class_g1end_of_interval_monthly_t::destroy(grib_context* c, grib_accessor* a){
void grib_accessor_class_g1end_of_interval_monthly_t::destroy(grib_context* c, grib_accessor* a)
{
grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a;
grib_context_free(c, self->v);
grib_accessor_class_abstract_vector_t::destroy(c, a);
}
int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, grib_accessor* b){
int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, grib_accessor* b)
{
int retval = GRIB_SUCCESS;
double* aval = 0;
double* bval = 0;
@ -107,11 +113,13 @@ int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, g
size_t blen = 0;
int err = 0;
err = a->value_count(&count); if (err)
err = a->value_count(&count);
if (err)
return err;
alen = count;
err = b->value_count(&count); if (err)
err = b->value_count(&count);
if (err)
return err;
blen = count;
@ -124,8 +132,9 @@ int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, g
b->dirty = 1;
a->dirty = 1;
err = a->unpack_double(aval, &alen); err = b->unpack_double(bval, &blen);
for(size_t i=0; i<alen && retval == GRIB_SUCCESS; ++i) {
err = a->unpack_double(aval, &alen);
err = b->unpack_double(bval, &blen);
for (size_t i = 0; i < alen && retval == GRIB_SUCCESS; ++i) {
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,16 +10,17 @@
#include "grib_accessor_class_g1fcperiod.h"
grib_accessor_class_g1fcperiod_t _grib_accessor_class_g1fcperiod{"g1fcperiod"};
grib_accessor_class_g1fcperiod_t _grib_accessor_class_g1fcperiod{ "g1fcperiod" };
grib_accessor_class* grib_accessor_class_g1fcperiod = &_grib_accessor_class_g1fcperiod;
int grib_accessor_class_g1fcperiod_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_g1fcperiod_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
long start = 0, theEnd = 0;
char tmp[1024];
const size_t tmpLen = sizeof(tmp);
int err = grib_g1_step_get_steps(a, &start, &theEnd);
size_t l = 0;
int err = grib_g1_step_get_steps(a, &start, &theEnd);
size_t l = 0;
if (err)
return err;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,20 +10,21 @@
#include "grib_accessor_class_g1monthlydate.h"
grib_accessor_class_g1monthlydate_t _grib_accessor_class_g1monthlydate{"g1monthlydate"};
grib_accessor_class_g1monthlydate_t _grib_accessor_class_g1monthlydate{ "g1monthlydate" };
grib_accessor_class* grib_accessor_class_g1monthlydate = &_grib_accessor_class_g1monthlydate;
void grib_accessor_class_g1monthlydate_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1monthlydate_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_long_t::init(a, l, c);
grib_accessor_g1monthlydate_t* self = (grib_accessor_g1monthlydate_t*)a;
int n = 0;
self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, 0);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
}
int grib_accessor_class_g1monthlydate_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_g1monthlydate_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_g1monthlydate_t* self = (grib_accessor_g1monthlydate_t*)a;
long date = 0;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,28 +10,31 @@
#include "grib_accessor_class_g1number_of_coded_values_sh_complex.h"
grib_accessor_class_g1number_of_coded_values_sh_complex_t _grib_accessor_class_g1number_of_coded_values_sh_complex{"g1number_of_coded_values_sh_complex"};
grib_accessor_class_g1number_of_coded_values_sh_complex_t _grib_accessor_class_g1number_of_coded_values_sh_complex{ "g1number_of_coded_values_sh_complex" };
grib_accessor_class* grib_accessor_class_g1number_of_coded_values_sh_complex = &_grib_accessor_class_g1number_of_coded_values_sh_complex;
void grib_accessor_class_g1number_of_coded_values_sh_complex_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1number_of_coded_values_sh_complex_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_long_t::init(a, l, c);
int n = 0;
grib_accessor_g1number_of_coded_values_sh_complex_t* self = (grib_accessor_g1number_of_coded_values_sh_complex_t*)a;
self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->JS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->KS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->MS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
int n = 0;
self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->JS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->KS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->MS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION;
a->length = 0;
}
int grib_accessor_class_g1number_of_coded_values_sh_complex_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_g1number_of_coded_values_sh_complex_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
int ret = GRIB_SUCCESS;
long bpv = 0;
long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,27 +10,30 @@
#include "grib_accessor_class_g1number_of_coded_values_sh_simple.h"
grib_accessor_class_g1number_of_coded_values_sh_simple_t _grib_accessor_class_g1number_of_coded_values_sh_simple{"g1number_of_coded_values_sh_simple"};
grib_accessor_class_g1number_of_coded_values_sh_simple_t _grib_accessor_class_g1number_of_coded_values_sh_simple{ "g1number_of_coded_values_sh_simple" };
grib_accessor_class* grib_accessor_class_g1number_of_coded_values_sh_simple = &_grib_accessor_class_g1number_of_coded_values_sh_simple;
void grib_accessor_class_g1number_of_coded_values_sh_simple_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1number_of_coded_values_sh_simple_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_long_t::init(a, l, c);
int n = 0;
grib_accessor_g1number_of_coded_values_sh_simple_t* self = (grib_accessor_g1number_of_coded_values_sh_simple_t*)a;
self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
int n = 0;
self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION;
a->length = 0;
}
int grib_accessor_class_g1number_of_coded_values_sh_simple_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int ret = GRIB_SUCCESS;
long bpv = 0;
int grib_accessor_class_g1number_of_coded_values_sh_simple_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
int ret = GRIB_SUCCESS;
long bpv = 0;
long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues;
grib_accessor_g1number_of_coded_values_sh_simple_t* self = (grib_accessor_g1number_of_coded_values_sh_simple_t*)a;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,34 +10,37 @@
#include "grib_accessor_class_g1step_range.h"
grib_accessor_class_g1step_range_t _grib_accessor_class_g1step_range{"g1step_range"};
grib_accessor_class_g1step_range_t _grib_accessor_class_g1step_range{ "g1step_range" };
grib_accessor_class* grib_accessor_class_g1step_range = &_grib_accessor_class_g1step_range;
void grib_accessor_class_g1step_range_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1step_range_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_abstract_long_vector_t::init(a, l, c);
grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
int n = 0;
self->p1 = grib_arguments_get_name(h, c, n++);
self->p2 = grib_arguments_get_name(h, c, n++);
self->timeRangeIndicator = grib_arguments_get_name(h, c, n++);
self->unit = grib_arguments_get_name(h, c, n++);
self->step_unit = grib_arguments_get_name(h, c, n++);
self->stepType = grib_arguments_get_name(h, c, n++);
self->patch_fp_precip = grib_arguments_get_name(h, c, n++);
self->error_on_units = 1;
grib_handle* h = grib_handle_of_accessor(a);
int n = 0;
self->p1 = grib_arguments_get_name(h, c, n++);
self->p2 = grib_arguments_get_name(h, c, n++);
self->timeRangeIndicator = grib_arguments_get_name(h, c, n++);
self->unit = grib_arguments_get_name(h, c, n++);
self->step_unit = grib_arguments_get_name(h, c, n++);
self->stepType = grib_arguments_get_name(h, c, n++);
self->patch_fp_precip = grib_arguments_get_name(h, c, n++);
self->error_on_units = 1;
self->number_of_elements = 2;
self->v = (long*)grib_context_malloc_clear(h->context,
sizeof(long) * self->number_of_elements);
self->pack_index = -1;
a->dirty = 1;
sizeof(long) * self->number_of_elements);
self->pack_index = -1;
a->dirty = 1;
a->length = 0;
}
void grib_accessor_class_g1step_range_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_g1step_range_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_string(dumper, a, NULL);
}
@ -88,7 +90,7 @@ static const int u2s[] = {
int grib_g1_step_get_steps(grib_accessor* a, long* start, long* theEnd)
{
grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a;
int err = 0;
int err = 0;
long p1 = 0, p2 = 0, unit = 0, timeRangeIndicator = 0, timeRangeIndicatorFromStepRange = 0;
long step_unit = 1;
char stepType[20] = {0,};
@ -182,15 +184,16 @@ int grib_g1_step_get_steps(grib_accessor* a, long* start, long* theEnd)
return 0;
}
int grib_accessor_class_g1step_range_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_g1step_range_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a;
char buf[100];
size_t size = 0;
long start = 0, theEnd = 0;
long timeRangeIndicator = 0;
long unit;
int err = 0;
char stepType[20] = {0,};
int err = 0;
char stepType[20] = {0,};
size_t stepTypeLen = 20;
grib_handle* hand = grib_handle_of_accessor(a);
@ -279,9 +282,9 @@ int grib_accessor_class_g1step_range_t::unpack_string(grib_accessor* a, char* va
}
static int grib_g1_step_apply_units(
const long* start, const long* theEnd, const long* step_unit,
long* P1, long* P2, long* unit,
const int max, const int instant)
const long* start, const long* theEnd, const long* step_unit,
long* P1, long* P2, long* unit,
const int max, const int instant)
{
int j = 0;
long start_sec, end_sec;
@ -333,9 +336,10 @@ static int grib_g1_step_apply_units(
return GRIB_WRONG_STEP;
}
int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char* val, size_t* len){
int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char* val, size_t* len)
{
grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
grib_handle* h = grib_handle_of_accessor(a);
long timeRangeIndicator = 0, P1 = 0, P2 = 0;
long start = 0, theEnd = -1, unit = 0, ounit = 0, step_unit = 1;
int ret = 0;
@ -399,8 +403,8 @@ int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char
if (timeRangeIndicator == 10) {
/*
* timeRangeIndicator = 10 means 'P1 occupies octets 19 and 20' i.e. 16 bits
*/
* timeRangeIndicator = 10 means 'P1 occupies octets 19 and 20' i.e. 16 bits
*/
long off = 0;
grib_accessor* p1_accessor = NULL;
if (theEnd != start && !h->context->gribex_mode_on) {
@ -431,7 +435,7 @@ int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char
return ret;
if (h->context->debug) {
long dp1,dp2;
long dp1, dp2;
grib_get_long(h, self->p1, &dp1);
grib_get_long(h, self->p2, &dp2);
fprintf(stderr, "ECCODES DEBUG pack_string: P1=%ld P2=%ld (as two octets => %ld)\n", dp1, dp2, P1);
@ -480,7 +484,7 @@ int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char
return ret;
if (h->context->debug) {
long dp1,dp2;
long dp1, dp2;
grib_get_long(h, self->p1, &dp1);
grib_get_long(h, self->p2, &dp2);
fprintf(stderr, "ECCODES DEBUG pack_string: P1=%ld P2=%ld (as two octets => %ld)\n", dp1, dp2, P1);
@ -492,7 +496,7 @@ int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char
if (ret == GRIB_WRONG_STEP) {
grib_context_log(h->context, GRIB_LOG_ERROR,
"Failed to set %s=%s: Keys P1 and P2 are one octet each (Range 0 to 255)", a->name, val);
"Failed to set %s=%s: Keys P1 and P2 are one octet each (Range 0 to 255)", a->name, val);
}
return ret;
}
@ -513,23 +517,27 @@ int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char
return 0;
}
int grib_accessor_class_g1step_range_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_g1step_range_t::value_count(grib_accessor* a, long* count)
{
*count = 1;
return 0;
}
size_t grib_accessor_class_g1step_range_t::string_length(grib_accessor* a){
size_t grib_accessor_class_g1step_range_t::string_length(grib_accessor* a)
{
return 255;
}
int grib_accessor_class_g1step_range_t::pack_long(grib_accessor* a, const long* val, size_t* len){
char buff[256];
size_t bufflen = 100;
char sval[100] = { 0 };
char* p = sval;
size_t svallen = 100;
int grib_accessor_class_g1step_range_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a;
char stepType[20] = {0,};
char buff[256] = {0,};
size_t bufflen = 100;
char sval[100] = { 0 };
char* p = sval;
size_t svallen = 100;
char stepType[20] = {0,};
size_t stepTypeLen = 20;
long step_unit = 0;
int err = 0;
@ -597,7 +605,8 @@ int grib_accessor_class_g1step_range_t::pack_long(grib_accessor* a, const long*
return GRIB_INTERNAL_ERROR;
}
int grib_accessor_class_g1step_range_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_g1step_range_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a;
char buff[100];
size_t bufflen = 100;
@ -627,11 +636,13 @@ int grib_accessor_class_g1step_range_t::unpack_long(grib_accessor* a, long* val,
return 0;
}
int grib_accessor_class_g1step_range_t::get_native_type(grib_accessor* a){
int grib_accessor_class_g1step_range_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_STRING;
}
void grib_accessor_class_g1step_range_t::destroy(grib_context* c, grib_accessor* a){
void grib_accessor_class_g1step_range_t::destroy(grib_context* c, grib_accessor* a)
{
grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a;
grib_context_free(c, self->v);
grib_accessor_class_abstract_long_vector_t::destroy(c, a);

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,14 +10,15 @@
#include "grib_accessor_class_g1verificationdate.h"
grib_accessor_class_g1verificationdate_t _grib_accessor_class_g1verificationdate{"g1verificationdate"};
grib_accessor_class_g1verificationdate_t _grib_accessor_class_g1verificationdate{ "g1verificationdate" };
grib_accessor_class* grib_accessor_class_g1verificationdate = &_grib_accessor_class_g1verificationdate;
void grib_accessor_class_g1verificationdate_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_g1verificationdate_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_long_t::init(a, l, c);
grib_accessor_g1verificationdate_t* self = (grib_accessor_g1verificationdate_t*)a;
int n = 0;
int n = 0;
self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->time = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
@ -27,16 +27,18 @@ void grib_accessor_class_g1verificationdate_t::init(grib_accessor* a, const long
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
}
int grib_accessor_class_g1verificationdate_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_g1verificationdate_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_g1verificationdate_t* self = (grib_accessor_g1verificationdate_t*)a;
int ret = 0;
long date = 0;
long time = 0;
long cdate = 0;
long step = 0;
long vtime = 0;
long vdate = 0;
long vd = 0;
int ret = 0;
long date = 0;
long time = 0;
long cdate = 0;
long step = 0;
long vtime = 0;
long vdate = 0;
long vd = 0;
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->date, &date)) != GRIB_SUCCESS)
return ret;
@ -52,13 +54,13 @@ int grib_accessor_class_g1verificationdate_t::unpack_long(grib_accessor* a, long
vd = vtime / 24;
vdate = grib_julian_to_date(vd);
/* printf("\n********\n date %d, time %d, step %d, vdate: %d, cdate %d, vd %d\n********\n", date, time, step, vdate, cdate, vd); */
//printf("\n********\n date %d, time %d, step %d, vdate: %d, cdate %d, vd %d\n********\n", date, time, step, vdate, cdate, vd);
if (*len < 1)
return GRIB_ARRAY_TOO_SMALL;
*val = vdate;
/* fprintf(stdout,"\n********\n %d cdate %d vd %d\n********\n", vdate, cdate, step); */
// fprintf(stdout,"\n********\n %d cdate %d vd %d\n********\n", vdate, cdate, step);
return GRIB_SUCCESS;
}

View File

@ -93,7 +93,8 @@ int grib_accessor_class_g2_eps_t::pack_long(grib_accessor* a, const long* val, s
derivedForecast = 4;
}
else {
productDefinitionTemplateNumberNew = 1;
//productDefinitionTemplateNumberNew = 1;
productDefinitionTemplateNumberNew = grib2_choose_PDTN(productDefinitionTemplateNumber, false, isInstant);
}
}
else {
@ -107,61 +108,22 @@ int grib_accessor_class_g2_eps_t::pack_long(grib_accessor* a, const long* val, s
derivedForecast = 4;
}
else {
productDefinitionTemplateNumberNew = 11;
// productDefinitionTemplateNumberNew = 11;
productDefinitionTemplateNumberNew = grib2_choose_PDTN(productDefinitionTemplateNumber, false, false);
}
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 0;
}
else {
productDefinitionTemplateNumberNew = 8;
}
productDefinitionTemplateNumberNew = grib2_choose_PDTN(productDefinitionTemplateNumber, true, isInstant);
// if (isInstant) {
// productDefinitionTemplateNumberNew = 0;
// }
// else {
// productDefinitionTemplateNumberNew = 8;
// }
}
// Adjust for chemical species
if (chemical == 1) {
if (eps == 1) {
if (isInstant) {
productDefinitionTemplateNumberNew = 41;
}
else {
productDefinitionTemplateNumberNew = 43;
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 40;
}
else {
productDefinitionTemplateNumberNew = 42;
}
}
}
// Adjust for aerosols
if (aerosol == 1) {
if (eps == 1) {
if (isInstant) {
productDefinitionTemplateNumberNew = 45;
}
else {
// productDefinitionTemplateNumberNew = 47; This PDT is deprecated
productDefinitionTemplateNumberNew = 85;
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 48; // 44 is deprecated*/
}
else {
productDefinitionTemplateNumberNew = 46;
}
}
}
if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) {
if (productDefinitionTemplateNumberNew >=0 && productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) {
grib_set_long(hand, self->productDefinitionTemplateNumber, productDefinitionTemplateNumberNew);
if (derivedForecast >= 0)
grib_set_long(hand, self->derivedForecast, derivedForecast);

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,15 +10,16 @@
#include "grib_accessor_class_gds_not_present_bitmap.h"
grib_accessor_class_gds_not_present_bitmap_t _grib_accessor_class_gds_not_present_bitmap{"gds_not_present_bitmap"};
grib_accessor_class_gds_not_present_bitmap_t _grib_accessor_class_gds_not_present_bitmap{ "gds_not_present_bitmap" };
grib_accessor_class* grib_accessor_class_gds_not_present_bitmap = &_grib_accessor_class_gds_not_present_bitmap;
void grib_accessor_class_gds_not_present_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){
void grib_accessor_class_gds_not_present_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, v, args);
int n = 0;
int n = 0;
grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
self->missing_value = grib_arguments_get_name(hand, args, n++);
self->number_of_values = grib_arguments_get_name(hand, args, n++);
@ -29,15 +29,17 @@ void grib_accessor_class_gds_not_present_bitmap_t::init(grib_accessor* a, const
a->length = 0;
}
int grib_accessor_class_gds_not_present_bitmap_t::value_count(grib_accessor* a, long* number_of_points){
int grib_accessor_class_gds_not_present_bitmap_t::value_count(grib_accessor* a, long* number_of_points)
{
grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a;
*number_of_points = 0;
*number_of_points = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_points, number_of_points);
}
int grib_accessor_class_gds_not_present_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_gds_not_present_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a;
grib_handle* hand = grib_handle_of_accessor(a);
grib_handle* hand = grib_handle_of_accessor(a);
long number_of_points = 0, number_of_values = 0, ni = 0;
long latitude_of_first_point = 0;
@ -47,8 +49,8 @@ int grib_accessor_class_gds_not_present_bitmap_t::unpack_double(grib_accessor* a
long missing_value;
double* coded_vals = NULL;
int err = a->value_count(&nn);
n_vals = nn;
int err = a->value_count(&nn);
n_vals = nn;
if (err)
return err;
@ -98,12 +100,14 @@ int grib_accessor_class_gds_not_present_bitmap_t::unpack_double(grib_accessor* a
return err;
}
int grib_accessor_class_gds_not_present_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_gds_not_present_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
// See deprecated/grib_accessor_class_gds_not_present_bitmap.cc for
// a possible implementation
return GRIB_NOT_IMPLEMENTED;
}
int grib_accessor_class_gds_not_present_bitmap_t::get_native_type(grib_accessor* a){
int grib_accessor_class_gds_not_present_bitmap_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_DOUBLE;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,13 +10,14 @@
#include "grib_accessor_class_group.h"
grib_accessor_class_group_t _grib_accessor_class_group{"group"};
grib_accessor_class_group_t _grib_accessor_class_group{ "group" };
grib_accessor_class* grib_accessor_class_group = &_grib_accessor_class_group;
void grib_accessor_class_group_t::init(grib_accessor* a, const long len, grib_arguments* arg){
void grib_accessor_class_group_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_gen_t::init(a, len, arg);
grib_buffer* buffer = grib_handle_of_accessor(a)->buffer;
grib_buffer* buffer = grib_handle_of_accessor(a)->buffer;
grib_accessor_group_t* self = (grib_accessor_group_t*)a;
size_t i = 0;
@ -52,26 +52,31 @@ void grib_accessor_class_group_t::init(grib_accessor* a, const long len, grib_ar
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
}
int grib_accessor_class_group_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_group_t::value_count(grib_accessor* a, long* count)
{
*count = 1;
return 0;
}
size_t grib_accessor_class_group_t::string_length(grib_accessor* a){
size_t grib_accessor_class_group_t::string_length(grib_accessor* a)
{
return a->length;
}
void grib_accessor_class_group_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_group_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_string(dumper, a, NULL);
}
int grib_accessor_class_group_t::get_native_type(grib_accessor* a){
int grib_accessor_class_group_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_STRING;
}
int grib_accessor_class_group_t::unpack_string(grib_accessor* a, char* val, size_t* len){
long i = 0;
size_t l = a->length + 1;
int grib_accessor_class_group_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
long i = 0;
size_t l = a->length + 1;
grib_handle* h = grib_handle_of_accessor(a);
if (*len < l) {
@ -85,11 +90,12 @@ int grib_accessor_class_group_t::unpack_string(grib_accessor* a, char* val, size
for (i = 0; i < a->length; i++)
val[i] = h->buffer->data[a->offset + i];
val[i] = 0;
*len = i;
*len = i;
return GRIB_SUCCESS;
}
int grib_accessor_class_group_t::unpack_long(grib_accessor* a, long* v, size_t* len){
int grib_accessor_class_group_t::unpack_long(grib_accessor* a, long* v, size_t* len)
{
char val[1024] = {0,};
size_t l = sizeof(val);
size_t i = 0;
@ -115,7 +121,8 @@ int grib_accessor_class_group_t::unpack_long(grib_accessor* a, long* v, size_t*
return GRIB_SUCCESS;
}
int grib_accessor_class_group_t::unpack_double(grib_accessor* a, double* v, size_t* len){
int grib_accessor_class_group_t::unpack_double(grib_accessor* a, double* v, size_t* len)
{
char val[1024];
size_t l = sizeof(val);
char* last = NULL;
@ -130,7 +137,8 @@ int grib_accessor_class_group_t::unpack_double(grib_accessor* a, double* v, size
return GRIB_NOT_IMPLEMENTED;
}
int grib_accessor_class_group_t::compare(grib_accessor* a, grib_accessor* b){
int grib_accessor_class_group_t::compare(grib_accessor* a, grib_accessor* b)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "%s:%s not implemented", __func__, a->name);
return GRIB_NOT_IMPLEMENTED;
@ -155,6 +163,7 @@ int grib_accessor_class_group_t::compare(grib_accessor* a, grib_accessor* b){
// return retval;
}
long grib_accessor_class_group_t::next_offset(grib_accessor* a){
long grib_accessor_class_group_t::next_offset(grib_accessor* a)
{
return a->offset + a->length;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,25 +10,27 @@
#include "grib_accessor_class_gts_header.h"
grib_accessor_class_gts_header_t _grib_accessor_class_gts_header{"gts_header"};
grib_accessor_class_gts_header_t _grib_accessor_class_gts_header{ "gts_header" };
grib_accessor_class* grib_accessor_class_gts_header = &_grib_accessor_class_gts_header;
void grib_accessor_class_gts_header_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_gts_header_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_ascii_t::init(a, l, c);
grib_accessor_gts_header_t* self = (grib_accessor_gts_header_t*)a;
self->gts_offset = -1;
self->gts_length = -1;
self->gts_offset = grib_arguments_get_long(grib_handle_of_accessor(a), c, 0);
self->gts_length = grib_arguments_get_long(grib_handle_of_accessor(a), c, 1);
self->gts_offset = -1;
self->gts_length = -1;
self->gts_offset = grib_arguments_get_long(grib_handle_of_accessor(a), c, 0);
self->gts_length = grib_arguments_get_long(grib_handle_of_accessor(a), c, 1);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
}
int grib_accessor_class_gts_header_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_gts_header_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
grib_accessor_gts_header_t* self = (grib_accessor_gts_header_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
int offset = 0;
size_t length = 0;
grib_handle* h = grib_handle_of_accessor(a);
int offset = 0;
size_t length = 0;
if (h->gts_header == NULL || h->gts_header_len < 8) {
if (*len < 8)
@ -50,12 +51,14 @@ int grib_accessor_class_gts_header_t::unpack_string(grib_accessor* a, char* val,
return GRIB_SUCCESS;
}
int grib_accessor_class_gts_header_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_gts_header_t::value_count(grib_accessor* a, long* count)
{
*count = 1;
return 0;
}
size_t grib_accessor_class_gts_header_t::string_length(grib_accessor* a){
size_t grib_accessor_class_gts_header_t::string_length(grib_accessor* a)
{
grib_handle* h = grib_handle_of_accessor(a);
return h->gts_header_len;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,36 +10,42 @@
#include "grib_accessor_class_hash_array.h"
grib_accessor_class_hash_array_t _grib_accessor_class_hash_array{"hash_array"};
grib_accessor_class_hash_array_t _grib_accessor_class_hash_array{ "hash_array" };
grib_accessor_class* grib_accessor_class_hash_array = &_grib_accessor_class_hash_array;
#define MAX_HASH_ARRAY_STRING_LENGTH 255
void grib_accessor_class_hash_array_t::init(grib_accessor* a, const long len, grib_arguments* args){
void grib_accessor_class_hash_array_t::init(grib_accessor* a, const long len, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, len, args);
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
a->length = 0;
self->key = 0;
self->ha = NULL;
a->length = 0;
self->key = 0;
self->ha = NULL;
}
void grib_accessor_class_hash_array_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_hash_array_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_string(dumper, a, NULL);
}
int grib_accessor_class_hash_array_t::pack_double(grib_accessor* a, const double* val, size_t* len){
int grib_accessor_class_hash_array_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
char s[200] = {0,};
char s[200] = {0,};
snprintf(s, sizeof(s), "%g", *val);
self->key = grib_context_strdup(a->context, s);
self->ha = 0;
return GRIB_SUCCESS;
}
int grib_accessor_class_hash_array_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int grib_accessor_class_hash_array_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
char s[200] = {0,};
char s[200] = {0,};
snprintf(s, sizeof(s), "%ld", *val);
if (self->key)
grib_context_free(a->context, self->key);
@ -49,22 +54,24 @@ int grib_accessor_class_hash_array_t::pack_long(grib_accessor* a, const long* va
return GRIB_SUCCESS;
}
int grib_accessor_class_hash_array_t::pack_string(grib_accessor* a, const char* v, size_t* len){
int grib_accessor_class_hash_array_t::pack_string(grib_accessor* a, const char* v, size_t* len)
{
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
self->key = grib_context_strdup(a->context, v);
self->ha = 0;
self->key = grib_context_strdup(a->context, v);
self->ha = 0;
return GRIB_SUCCESS;
}
int grib_accessor_class_hash_array_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_hash_array_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
static grib_hash_array_value* find_hash_value(grib_accessor* a, int* err)
{
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
grib_hash_array_value* ha_ret = 0;
grib_hash_array_value* ha = NULL;
grib_hash_array_value* ha_ret = 0;
grib_hash_array_value* ha = NULL;
ha = get_hash_array(grib_handle_of_accessor(a), a->creator);
if (!ha) {
@ -103,11 +110,12 @@ static grib_hash_array_value* find_hash_value(grib_accessor* a, int* err)
return ha_ret;
}
int grib_accessor_class_hash_array_t::unpack_long(grib_accessor* a, long* val, size_t* len){
grib_hash_array_value* ha = 0;
int grib_accessor_class_hash_array_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_hash_array_value* ha = 0;
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
int err = 0;
size_t i = 0;
int err = 0;
size_t i = 0;
if (!self->ha) {
ha = find_hash_value(a, &err);
@ -133,7 +141,8 @@ int grib_accessor_class_hash_array_t::unpack_long(grib_accessor* a, long* val, s
return GRIB_SUCCESS;
}
int grib_accessor_class_hash_array_t::get_native_type(grib_accessor* a){
int grib_accessor_class_hash_array_t::get_native_type(grib_accessor* a)
{
int type = GRIB_TYPE_STRING;
if (a->flags & GRIB_ACCESSOR_FLAG_LONG_TYPE)
type = GRIB_TYPE_LONG;
@ -141,25 +150,29 @@ int grib_accessor_class_hash_array_t::get_native_type(grib_accessor* a){
return type;
}
void grib_accessor_class_hash_array_t::destroy(grib_context* c, grib_accessor* a){
void grib_accessor_class_hash_array_t::destroy(grib_context* c, grib_accessor* a)
{
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
if (self->key)
grib_context_free(c, self->key);
grib_accessor_class_gen_t::destroy(c, a);
}
int grib_accessor_class_hash_array_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_hash_array_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
size_t grib_accessor_class_hash_array_t::string_length(grib_accessor* a){
size_t grib_accessor_class_hash_array_t::string_length(grib_accessor* a)
{
return MAX_HASH_ARRAY_STRING_LENGTH;
}
int grib_accessor_class_hash_array_t::value_count(grib_accessor* a, long* count){
int err = 0;
int grib_accessor_class_hash_array_t::value_count(grib_accessor* a, long* count)
{
int err = 0;
grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a;
grib_hash_array_value* ha = 0;
grib_hash_array_value* ha = 0;
if (!self->ha) {
ha = find_hash_value(a, &err);
@ -172,6 +185,7 @@ int grib_accessor_class_hash_array_t::value_count(grib_accessor* a, long* count)
return err;
}
int grib_accessor_class_hash_array_t::compare(grib_accessor* a, grib_accessor* b){
int grib_accessor_class_hash_array_t::compare(grib_accessor* a, grib_accessor* b)
{
return GRIB_NOT_IMPLEMENTED;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,23 +10,26 @@
#include "grib_accessor_class_headers_only.h"
grib_accessor_class_headers_only_t _grib_accessor_class_headers_only{"headers_only"};
grib_accessor_class_headers_only_t _grib_accessor_class_headers_only{ "headers_only" };
grib_accessor_class* grib_accessor_class_headers_only = &_grib_accessor_class_headers_only;
void grib_accessor_class_headers_only_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_headers_only_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_gen_t::init(a, l, c);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN;
a->length = 0;
}
int grib_accessor_class_headers_only_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_headers_only_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
*val = grib_handle_of_accessor(a)->partial;
*len = 1;
return 0;
}
int grib_accessor_class_headers_only_t::get_native_type(grib_accessor* a){
int grib_accessor_class_headers_only_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,23 +10,25 @@
#include "grib_accessor_class_ifs_param.h"
grib_accessor_class_ifs_param_t _grib_accessor_class_ifs_param{"ifs_param"};
grib_accessor_class_ifs_param_t _grib_accessor_class_ifs_param{ "ifs_param" };
grib_accessor_class* grib_accessor_class_ifs_param = &_grib_accessor_class_ifs_param;
void grib_accessor_class_ifs_param_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_ifs_param_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_gen_t::init(a, l, c);
grib_accessor_ifs_param_t* self = (grib_accessor_ifs_param_t*)a;
int n = 0;
int n = 0;
self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->type = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
}
int grib_accessor_class_ifs_param_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_ifs_param_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_ifs_param_t* self = (grib_accessor_ifs_param_t*)a;
int ret = 0;
long paramId = 0;
int ret = 0;
long paramId = 0;
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->paramId, &paramId)) != GRIB_SUCCESS)
return ret;
@ -44,11 +45,12 @@ int grib_accessor_class_ifs_param_t::unpack_long(grib_accessor* a, long* val, si
return ret;
}
int grib_accessor_class_ifs_param_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int grib_accessor_class_ifs_param_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_ifs_param_t* self = (grib_accessor_ifs_param_t*)a;
long type = 0;
long table = 128;
long paramId = *val;
long type = 0;
long table = 128;
long paramId = *val;
long param;
grib_get_long(grib_handle_of_accessor(a), self->type, &type);
@ -88,6 +90,7 @@ int grib_accessor_class_ifs_param_t::pack_long(grib_accessor* a, const long* val
return grib_set_long_internal(grib_handle_of_accessor(a), self->paramId, paramId);
}
int grib_accessor_class_ifs_param_t::get_native_type(grib_accessor* a){
int grib_accessor_class_ifs_param_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,20 +10,22 @@
#include "grib_accessor_class_ksec1expver.h"
grib_accessor_class_ksec1expver_t _grib_accessor_class_ksec1expver{"ksec1expver"};
grib_accessor_class_ksec1expver_t _grib_accessor_class_ksec1expver{ "ksec1expver" };
grib_accessor_class* grib_accessor_class_ksec1expver = &_grib_accessor_class_ksec1expver;
void grib_accessor_class_ksec1expver_t::init(grib_accessor* a, const long len, grib_arguments* arg){
void grib_accessor_class_ksec1expver_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_ascii_t::init(a, len, arg);
a->length = len;
Assert(a->length >= 0);
}
int grib_accessor_class_ksec1expver_t::unpack_long(grib_accessor* a, long* val, size_t* len){
long value = 0;
long pos = a->offset * 8;
char* intc = NULL;
int grib_accessor_class_ksec1expver_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
long value = 0;
long pos = a->offset * 8;
char* intc = NULL;
char* pTemp = NULL;
char expver[5];
char refexpver[5];
@ -40,7 +41,7 @@ int grib_accessor_class_ksec1expver_t::unpack_long(grib_accessor* a, long* val,
a->unpack_string(refexpver, &llen);
/* test for endian */
intc = (char*)&value;
intc = (char*)&value;
pTemp = intc;
expver[0] = *pTemp++;
@ -49,11 +50,11 @@ int grib_accessor_class_ksec1expver_t::unpack_long(grib_accessor* a, long* val,
expver[3] = *pTemp++;
expver[4] = 0;
// expver[0] = intc[0];
// expver[1] = intc[1];
// expver[2] = intc[2];
// expver[3] = intc[3];
// expver[4] = 0;
// expver[0] = intc[0];
// expver[1] = intc[1];
// expver[2] = intc[2];
// expver[3] = intc[3];
// expver[4] = 0;
/* if there is a difference, have to reverse*/
if (strcmp(refexpver, expver)) {
@ -68,7 +69,8 @@ int grib_accessor_class_ksec1expver_t::unpack_long(grib_accessor* a, long* val,
return GRIB_SUCCESS;
}
int grib_accessor_class_ksec1expver_t::pack_string(grib_accessor* a, const char* val, size_t* len){
int grib_accessor_class_ksec1expver_t::pack_string(grib_accessor* a, const char* val, size_t* len)
{
int i = 0;
if (len[0] != 4) {
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong length for %s. It has to be 4", a->name);
@ -76,7 +78,7 @@ int grib_accessor_class_ksec1expver_t::pack_string(grib_accessor* a, const char*
}
if (len[0] > (a->length) + 1) {
grib_context_log(a->context, GRIB_LOG_ERROR, "pack_string: Wrong size (%lu) for %s, it contains %ld values",
len[0], a->name, a->length + 1);
len[0], a->name, a->length + 1);
len[0] = 0;
return GRIB_BUFFER_TOO_SMALL;
}
@ -87,7 +89,8 @@ int grib_accessor_class_ksec1expver_t::pack_string(grib_accessor* a, const char*
return GRIB_SUCCESS;
}
int grib_accessor_class_ksec1expver_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int grib_accessor_class_ksec1expver_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
char sval[5] = {0,};
size_t slen = 4;
snprintf(sval, sizeof(sval), "%04d", (int)(*val));

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,26 +10,30 @@
#include "grib_accessor_class_label.h"
grib_accessor_class_label_t _grib_accessor_class_label{"label"};
grib_accessor_class_label_t _grib_accessor_class_label{ "label" };
grib_accessor_class* grib_accessor_class_label = &_grib_accessor_class_label;
void grib_accessor_class_label_t::init(grib_accessor* a, const long len, grib_arguments* arg){
void grib_accessor_class_label_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_gen_t::init(a, len, arg);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC;
a->length = 0;
}
void grib_accessor_class_label_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_label_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_label(dumper, a, NULL);
}
int grib_accessor_class_label_t::get_native_type(grib_accessor* a){
int grib_accessor_class_label_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LABEL;
}
int grib_accessor_class_label_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_label_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
size_t vlen = strlen(a->name);
if (vlen > *len)
return GRIB_BUFFER_TOO_SMALL;

View File

@ -15,11 +15,11 @@ grib_accessor_class_latitudes_t _grib_accessor_class_latitudes{ "latitudes" };
grib_accessor_class* grib_accessor_class_latitudes = &_grib_accessor_class_latitudes;
static int get_distinct(grib_accessor* a, double** val, long* len);
int compare_doubles(const void* a, const void* b, int ascending)
static int compare_doubles(const void* a, const void* b, int ascending)
{
// ascending is a boolean: 0 or 1
double* arg1 = (double*)a;
double* arg2 = (double*)b;
const double* arg1 = (double*)a;
const double* arg2 = (double*)b;
if (ascending) {
if (*arg1 < *arg2)
return -1; // Smaller values come before larger ones
@ -33,11 +33,13 @@ int compare_doubles(const void* a, const void* b, int ascending)
else
return 1;
}
int compare_doubles_ascending(const void* a, const void* b)
static int compare_doubles_ascending(const void* a, const void* b)
{
return compare_doubles(a, b, 1);
}
int compare_doubles_descending(const void* a, const void* b)
static int compare_doubles_descending(const void* a, const void* b)
{
return compare_doubles(a, b, 0);
}
@ -95,8 +97,7 @@ int grib_accessor_class_latitudes_t::unpack_double(grib_accessor* a, double* val
// ECC-1525 Performance: We do not need the values to be decoded
iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret);
if (ret != GRIB_SUCCESS) {
if (iter)
grib_iterator_delete(iter);
grib_iterator_delete(iter);
grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Unable to create iterator");
return ret;
}
@ -164,8 +165,7 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
// Performance: We do not need the values to be decoded
grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret);
if (ret != GRIB_SUCCESS) {
if (iter)
grib_iterator_delete(iter);
grib_iterator_delete(iter);
grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Unable to create iterator");
return ret;
}
@ -184,10 +184,14 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), "jScansPositively", &jScansPositively)))
return ret;
if (jScansPositively) {
qsort(v, *len, sizeof(double), &compare_doubles_ascending); //South to North
if (!is_sorted_ascending(v, size)) {
qsort(v, *len, sizeof(double), &compare_doubles_ascending); //South to North
}
}
else {
qsort(v, *len, sizeof(double), &compare_doubles_descending); //North to South
if (!is_sorted_descending(v, size)) {
qsort(v, *len, sizeof(double), &compare_doubles_descending); //North to South
}
}
v1 = (double*)grib_context_malloc_clear(c, size * sizeof(double));

View File

@ -11,21 +11,23 @@
#include "grib_accessor_class_latlonvalues.h"
grib_accessor_class_latlonvalues_t _grib_accessor_class_latlonvalues{"latlonvalues"};
grib_accessor_class_latlonvalues_t _grib_accessor_class_latlonvalues{ "latlonvalues" };
grib_accessor_class* grib_accessor_class_latlonvalues = &_grib_accessor_class_latlonvalues;
void grib_accessor_class_latlonvalues_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_latlonvalues_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_double_t::init(a, l, c);
grib_accessor_latlonvalues_t* self = (grib_accessor_latlonvalues_t*)a;
int n = 0;
int n = 0;
self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
}
int grib_accessor_class_latlonvalues_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_latlonvalues_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_context* c = a->context;
int err = 0;
double* v = val;
@ -34,17 +36,17 @@ int grib_accessor_class_latlonvalues_t::unpack_double(grib_accessor* a, double*
long count = 0;
grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), 0, &err);
if (err) {
if (iter) grib_iterator_delete(iter);
grib_iterator_delete(iter);
grib_context_log(c, GRIB_LOG_ERROR, "latlonvalues: Unable to create iterator");
return err;
}
err = value_count(a, &count);
err = value_count(a, &count);
if (err) return err;
size = count;
if (*len < size) {
if (iter) grib_iterator_delete(iter);
grib_iterator_delete(iter);
return GRIB_ARRAY_TOO_SMALL;
}
@ -61,10 +63,11 @@ int grib_accessor_class_latlonvalues_t::unpack_double(grib_accessor* a, double*
return GRIB_SUCCESS;
}
int grib_accessor_class_latlonvalues_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_latlonvalues_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_latlonvalues_t* self = (grib_accessor_latlonvalues_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
int ret = GRIB_SUCCESS;
grib_handle* h = grib_handle_of_accessor(a);
int ret = GRIB_SUCCESS;
size_t size;
if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) {
grib_context_log(h->context, GRIB_LOG_ERROR, "latlonvalues: Unable to get size of %s", self->values);

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,19 +10,20 @@
#include "grib_accessor_class_library_version.h"
grib_accessor_class_library_version_t _grib_accessor_class_library_version{"library_version"};
grib_accessor_class_library_version_t _grib_accessor_class_library_version{ "library_version" };
grib_accessor_class* grib_accessor_class_library_version = &_grib_accessor_class_library_version;
int grib_accessor_class_library_version_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_library_version_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
char result[30] = {0,};
size_t size;
size_t size = 0;
int major = ECCODES_MAJOR_VERSION;
int minor = ECCODES_MINOR_VERSION;
int revision = ECCODES_REVISION_VERSION;
snprintf(result, sizeof(result), "%d.%d.%d", major, minor, revision);
snprintf(result, sizeof(result), "%d.%d.%d", major, minor, revision);
size = sizeof(result);
if (*len < size)
@ -35,11 +35,13 @@ int grib_accessor_class_library_version_t::unpack_string(grib_accessor* a, char*
return GRIB_SUCCESS;
}
int grib_accessor_class_library_version_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_library_version_t::value_count(grib_accessor* a, long* count)
{
*count = 1;
return 0;
}
size_t grib_accessor_class_library_version_t::string_length(grib_accessor* a){
size_t grib_accessor_class_library_version_t::string_length(grib_accessor* a)
{
return 255;
}

View File

@ -54,9 +54,6 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
long eps = -1;
long chemical = -1;
long aerosol = -1;
long chemical_distfn = -1;
long chemical_srcsink = -1;
long aerosol_optical = -1;
char stepType[15] = {0,};
size_t slen = 15;
int localDefinitionNumber = *val;
@ -81,10 +78,8 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
isInstant = 1;
grib_get_long(hand, self->grib2LocalSectionNumber, &grib2LocalSectionNumber);
grib_get_long(hand, "is_chemical", &chemical);
grib_get_long(hand, "is_chemical_distfn", &chemical_distfn);
grib_get_long(hand, "is_chemical_srcsink", &chemical_srcsink);
grib_get_long(hand, "is_aerosol", &aerosol);
grib_get_long(hand, "is_aerosol_optical", &aerosol_optical);
if (chemical == 1 && aerosol == 1) {
grib_context_log(a->context, GRIB_LOG_ERROR, "Parameter cannot be both chemical and aerosol!");
return GRIB_ENCODING_ERROR;
@ -224,99 +219,6 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
productDefinitionTemplateNumberNew = -1; // disable PDT selection
}
// Adjust for atmospheric chemical constituents
if (chemical == 1) {
if (eps == 1) {
if (isInstant) {
productDefinitionTemplateNumberNew = 41;
}
else {
productDefinitionTemplateNumberNew = 43;
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 40;
}
else {
productDefinitionTemplateNumberNew = 42;
}
}
}
// Adjust for atmospheric chemical constituents based on a distribution function
if (chemical_distfn == 1) {
if (eps == 1) {
if (isInstant) {
productDefinitionTemplateNumberNew = 58;
}
else {
productDefinitionTemplateNumberNew = 68;
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 57;
}
else {
productDefinitionTemplateNumberNew = 67;
}
}
}
// Adjust for atmospheric chemical constituents with source or sink
if (chemical_srcsink == 1) {
if (eps == 1) {
if (isInstant) {
productDefinitionTemplateNumberNew = 77;
}
else {
productDefinitionTemplateNumberNew = 79;
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 76;
}
else {
productDefinitionTemplateNumberNew = 78;
}
}
}
// Adjust for aerosols
if (aerosol == 1) {
if (eps == 1) {
if (isInstant) {
productDefinitionTemplateNumberNew = 45;
}
else {
// productDefinitionTemplateNumberNew = 47; This PDT is deprecated
productDefinitionTemplateNumberNew = 85;
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 48; // 44 is deprecated*/
}
else {
productDefinitionTemplateNumberNew = 46;
}
}
}
// Adjust for optical properties of aerosol
if (aerosol_optical == 1) {
if (eps == 1) {
if (isInstant) {
productDefinitionTemplateNumberNew = 49;
}
}
else {
if (isInstant) {
productDefinitionTemplateNumberNew = 48;
}
}
}
if (productDefinitionTemplateNumberNew >=0 && productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) {
if (a->context->debug) {
fprintf(stderr, "ECCODES DEBUG %s %s: ldNumber=%d, newPDTN=%ld\n", a->cclass->name, __func__,

View File

@ -13,7 +13,8 @@
grib_accessor_class_long_t _grib_accessor_class_long{"long"};
grib_accessor_class* grib_accessor_class_long = &_grib_accessor_class_long;
void grib_accessor_class_long_t::init(grib_accessor* a, const long len, grib_arguments* arg) {
void grib_accessor_class_long_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_gen_t::init(a, len, arg);
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,16 +11,17 @@
#include "grib_accessor_class_long_vector.h"
#include "grib_accessor_class_abstract_long_vector.h"
grib_accessor_class_long_vector_t _grib_accessor_class_long_vector{"long_vector"};
grib_accessor_class_long_vector_t _grib_accessor_class_long_vector{ "long_vector" };
grib_accessor_class* grib_accessor_class_long_vector = &_grib_accessor_class_long_vector;
void grib_accessor_class_long_vector_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_long_vector_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_abstract_long_vector_t::init(a, l, c);
grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a;
grib_accessor* va = NULL;
grib_accessor* va = NULL;
grib_accessor_abstract_long_vector_t* v = NULL;
int n = 0;
int n = 0;
self->vector = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector);
@ -35,12 +35,13 @@ void grib_accessor_class_long_vector_t::init(grib_accessor* a, const long l, gri
a->length = 0;
}
int grib_accessor_class_long_vector_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_long_vector_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
size_t size = 0;
int err = 0;
int err = 0;
long* vector;
grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a;
grib_accessor* va = NULL;
grib_accessor* va = NULL;
grib_accessor_abstract_long_vector_t* v = NULL;
va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector);
@ -51,7 +52,8 @@ int grib_accessor_class_long_vector_t::unpack_long(grib_accessor* a, long* val,
if (err) return err;
DEBUG_ASSERT(size > 0);
vector = (long*)grib_context_malloc(a->context, sizeof(long) * size);
err = va->unpack_long(vector, &size); grib_context_free(a->context, vector);
err = va->unpack_long(vector, &size);
grib_context_free(a->context, vector);
if (err) return err;
*val = v->v[self->index];
@ -59,14 +61,15 @@ int grib_accessor_class_long_vector_t::unpack_long(grib_accessor* a, long* val,
return GRIB_SUCCESS;
}
int grib_accessor_class_long_vector_t::unpack_double(grib_accessor* a, double* val, size_t* len){
long lval = 0;
int err = 0;
int grib_accessor_class_long_vector_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
long lval = 0;
int err = 0;
grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a;
grib_accessor* va = NULL;
grib_accessor* va = NULL;
grib_accessor_abstract_long_vector_t* v = NULL;
va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector);
v = (grib_accessor_abstract_long_vector_t*)va;
va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector);
v = (grib_accessor_abstract_long_vector_t*)va;
err = unpack_long(a, &lval, len);
@ -75,10 +78,11 @@ int grib_accessor_class_long_vector_t::unpack_double(grib_accessor* a, double* v
return err;
}
int grib_accessor_class_long_vector_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int err = 0;
int grib_accessor_class_long_vector_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
int err = 0;
grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a;
grib_accessor* va = NULL;
grib_accessor* va = NULL;
grib_accessor_abstract_long_vector_t* v = NULL;
va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector);
@ -90,6 +94,7 @@ int grib_accessor_class_long_vector_t::pack_long(grib_accessor* a, const long* v
return err;
}
int grib_accessor_class_long_vector_t::get_native_type(grib_accessor* a){
int grib_accessor_class_long_vector_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;
}

View File

@ -16,7 +16,7 @@ grib_accessor_class* grib_accessor_class_longitudes = &_grib_accessor_class_long
static int get_distinct(grib_accessor* a, double** val, long* len);
int compare_doubles(const void* a, const void* b);
void grib_accessor_class_longitudes_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_double_t::init(a, l, c);
@ -73,8 +73,7 @@ int grib_accessor_class_longitudes_t::unpack_double(grib_accessor* a, double* va
// ECC-1525 Performance: We do not need the values to be decoded
iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret);
if (ret != GRIB_SUCCESS) {
if (iter)
grib_iterator_delete(iter);
grib_iterator_delete(iter);
grib_context_log(c, GRIB_LOG_ERROR, "longitudes: Unable to create iterator");
return ret;
}
@ -125,6 +124,18 @@ int grib_accessor_class_longitudes_t::value_count(grib_accessor* a, long* len)
return ret;
}
static int compare_doubles_ascending(const void* a, const void* b)
{
const double* arg1 = (double*)a;
const double* arg2 = (double*)b;
if (*arg1 < *arg2)
return -1;
else if (*arg1 == *arg2)
return 0;
else
return 1;
}
static int get_distinct(grib_accessor* a, double** val, long* len)
{
long count = 0;
@ -139,8 +150,7 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
// Performance: We do not need the values to be decoded
grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret);
if (ret != GRIB_SUCCESS) {
if (iter)
grib_iterator_delete(iter);
grib_iterator_delete(iter);
grib_context_log(c, GRIB_LOG_ERROR, "longitudes: Unable to create iterator");
return ret;
}
@ -155,7 +165,7 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
grib_iterator_delete(iter);
v = *val;
qsort(v, *len, sizeof(double), &compare_doubles);
qsort(v, *len, sizeof(double), &compare_doubles_ascending);
v1 = (double*)grib_context_malloc_clear(c, size * sizeof(double));
if (!v1) {
@ -181,15 +191,3 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
*len = count;
return GRIB_SUCCESS;
}
int compare_doubles(const void* a, const void* b)
{
double* arg1 = (double*)a;
double* arg2 = (double*)b;
if (*arg1 < *arg2)
return -1;
else if (*arg1 == *arg2)
return 0;
else
return 1;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,39 +10,42 @@
#include "grib_accessor_class_lookup.h"
grib_accessor_class_lookup_t _grib_accessor_class_lookup{"lookup"};
grib_accessor_class_lookup_t _grib_accessor_class_lookup{ "lookup" };
grib_accessor_class* grib_accessor_class_lookup = &_grib_accessor_class_lookup;
void grib_accessor_class_lookup_t::init(grib_accessor* a, const long len, grib_arguments* arg){
void grib_accessor_class_lookup_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_long_t::init(a, len, arg);
grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a;
a->length = 0;
self->llength = len;
self->loffset = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 0);
a->length = 0;
self->llength = len;
self->loffset = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 0);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
self->real_name = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 1);
}
void grib_accessor_class_lookup_t::post_init(grib_accessor* a){
void grib_accessor_class_lookup_t::post_init(grib_accessor* a)
{
grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a;
if (self->real_name) {
grib_dependency_observe_expression(a, self->real_name);
}
}
void grib_accessor_class_lookup_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_lookup_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a;
unsigned char bytes[1024] = {0,};
unsigned char bytes[1024] = {0,};
char msg[1024] = {0,};
char buf[2048];
int i;
unsigned long v = 0;
size_t llen = self->llength;
a->unpack_bytes(bytes, &llen);
bytes[llen] = 0;
for (i = 0; i < llen; i++) {
for (size_t i = 0; i < llen; i++) {
msg[i] = isprint(bytes[i]) ? bytes[i] : '?';
v <<= 8;
v |= bytes[i];
@ -56,16 +58,16 @@ void grib_accessor_class_lookup_t::dump(grib_accessor* a, grib_dumper* dumper){
grib_dump_long(dumper, a, buf);
}
int grib_accessor_class_lookup_t::unpack_string(grib_accessor* a, char* v, size_t* len){
int grib_accessor_class_lookup_t::unpack_string(grib_accessor* a, char* v, size_t* len)
{
grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a;
unsigned char bytes[1024] = {0,};
int i;
unsigned char bytes[1024] = {0,};
size_t llen = self->llength;
a->unpack_bytes(bytes, &llen);
bytes[llen] = 0;
for (i = 0; i < llen; i++) {
for (size_t i = 0; i < llen; i++) {
v[i] = isprint(bytes[i]) ? bytes[i] : '?';
}
@ -87,9 +89,10 @@ int grib_accessor_class_lookup_t::unpack_string(grib_accessor* a, char* v, size_
return GRIB_SUCCESS;
}
int grib_accessor_class_lookup_t::unpack_long(grib_accessor* a, long* val, size_t* len){
int grib_accessor_class_lookup_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a;
grib_handle* h = grib_handle_of_accessor(a);
grib_handle* h = grib_handle_of_accessor(a);
long pos = (a->offset + self->loffset) * 8;
@ -113,21 +116,25 @@ int grib_accessor_class_lookup_t::unpack_long(grib_accessor* a, long* val, size_
return GRIB_SUCCESS;
}
int grib_accessor_class_lookup_t::pack_long(grib_accessor* a, const long* val, size_t* len){
int grib_accessor_class_lookup_t::pack_long(grib_accessor* a, const long* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
long grib_accessor_class_lookup_t::byte_count(grib_accessor* a){
long grib_accessor_class_lookup_t::byte_count(grib_accessor* a)
{
grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a;
return self->llength;
}
long grib_accessor_class_lookup_t::byte_offset(grib_accessor* a){
long grib_accessor_class_lookup_t::byte_offset(grib_accessor* a)
{
grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a;
return self->loffset;
}
int grib_accessor_class_lookup_t::notify_change(grib_accessor* self, grib_accessor* changed){
int grib_accessor_class_lookup_t::notify_change(grib_accessor* self, grib_accessor* changed)
{
/* Forward changes */
return grib_dependency_notify_change(self);
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,17 +10,19 @@
#include "grib_accessor_class_mars_param.h"
grib_accessor_class_mars_param_t _grib_accessor_class_mars_param{"mars_param"};
grib_accessor_class_mars_param_t _grib_accessor_class_mars_param{ "mars_param" };
grib_accessor_class* grib_accessor_class_mars_param = &_grib_accessor_class_mars_param;
void grib_accessor_class_mars_param_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_mars_param_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_ascii_t::init(a, l, c);
int n = 0;
grib_accessor_mars_param_t* self = (grib_accessor_mars_param_t*)a;
self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->table = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->param = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
int n = 0;
self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->table = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->param = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
}
// For an implementation of pack_string, see
@ -30,11 +31,12 @@ void grib_accessor_class_mars_param_t::init(grib_accessor* a, const long l, grib
// For an alternative implementation of unpack_string, see
// src/deprecated/grib_accessor_class_mars_param.cc
//
int grib_accessor_class_mars_param_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_mars_param_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
grib_accessor_mars_param_t* self = (grib_accessor_mars_param_t*)a;
long param = 0;
long table = 0;
int ret = 0;
long param = 0;
long table = 0;
int ret = 0;
if (self->table != NULL && (ret = grib_get_long_internal(grib_handle_of_accessor(a), self->table, &table)) != GRIB_SUCCESS)
return ret;
@ -48,6 +50,7 @@ int grib_accessor_class_mars_param_t::unpack_string(grib_accessor* a, char* val,
return GRIB_SUCCESS;
}
size_t grib_accessor_class_mars_param_t::string_length(grib_accessor* a){
size_t grib_accessor_class_mars_param_t::string_length(grib_accessor* a)
{
return 7;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,12 +10,12 @@
#include "grib_accessor_class_message.h"
grib_accessor_class_message_t _grib_accessor_class_message{"message"};
grib_accessor_class_message_t _grib_accessor_class_message{ "message" };
grib_accessor_class* grib_accessor_class_message = &_grib_accessor_class_message;
void grib_accessor_class_message_t::init(grib_accessor* a, const long len, grib_arguments* arg){
void grib_accessor_class_message_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_bytes_t::init(a, len, arg);
a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC;
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
@ -30,11 +29,13 @@ void grib_accessor_class_message_t::init(grib_accessor* a, const long len, grib_
// return GRIB_SUCCESS;
// }
void grib_accessor_class_message_t::update_size(grib_accessor* a, size_t new_size){
void grib_accessor_class_message_t::update_size(grib_accessor* a, size_t new_size)
{
a->length = new_size;
}
void grib_accessor_class_message_t::resize(grib_accessor* a, size_t new_size){
void grib_accessor_class_message_t::resize(grib_accessor* a, size_t new_size)
{
grib_context_log(a->context, GRIB_LOG_FATAL, "%s %s: Not supported", a->cclass->name, __func__);
// void* zero = grib_context_malloc_clear(a->context, new_size);
@ -45,14 +46,16 @@ void grib_accessor_class_message_t::resize(grib_accessor* a, size_t new_size){
// Assert(new_size == a->length);
}
int grib_accessor_class_message_t::value_count(grib_accessor* a, long* count){
int grib_accessor_class_message_t::value_count(grib_accessor* a, long* count)
{
*count = 1;
return 0;
}
int grib_accessor_class_message_t::unpack_string(grib_accessor* a, char* val, size_t* len){
long i = 0;
size_t l = string_length(a) + 1;
int grib_accessor_class_message_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
long i = 0;
size_t l = string_length(a) + 1;
grib_handle* h = grib_handle_of_accessor(a);
if (*len < l) {
@ -66,10 +69,11 @@ int grib_accessor_class_message_t::unpack_string(grib_accessor* a, char* val, si
for (i = 0; i < a->length; i++)
val[i] = h->buffer->data[a->offset + i];
val[i] = 0;
*len = i;
*len = i;
return GRIB_SUCCESS;
}
size_t grib_accessor_class_message_t::string_length(grib_accessor* a){
size_t grib_accessor_class_message_t::string_length(grib_accessor* a)
{
return a->length;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,25 +10,29 @@
#include "grib_accessor_class_message_copy.h"
grib_accessor_class_message_copy_t _grib_accessor_class_message_copy{"message_copy"};
grib_accessor_class_message_copy_t _grib_accessor_class_message_copy{ "message_copy" };
grib_accessor_class* grib_accessor_class_message_copy = &_grib_accessor_class_message_copy;
void grib_accessor_class_message_copy_t::init(grib_accessor* a, const long length, grib_arguments* args){
void grib_accessor_class_message_copy_t::init(grib_accessor* a, const long length, grib_arguments* args)
{
grib_accessor_class_gen_t::init(a, length, args);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
a->length = 0;
}
void grib_accessor_class_message_copy_t::dump(grib_accessor* a, grib_dumper* dumper){
void grib_accessor_class_message_copy_t::dump(grib_accessor* a, grib_dumper* dumper)
{
grib_dump_string(dumper, a, NULL);
}
int grib_accessor_class_message_copy_t::get_native_type(grib_accessor* a){
int grib_accessor_class_message_copy_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_STRING;
}
int grib_accessor_class_message_copy_t::unpack_string(grib_accessor* a, char* val, size_t* len){
int grib_accessor_class_message_copy_t::unpack_string(grib_accessor* a, char* val, size_t* len)
{
size_t slen = grib_handle_of_accessor(a)->buffer->ulength;
size_t i;
unsigned char* v = 0;
@ -50,10 +53,12 @@ int grib_accessor_class_message_copy_t::unpack_string(grib_accessor* a, char* va
return GRIB_SUCCESS;
}
size_t grib_accessor_class_message_copy_t::string_length(grib_accessor* a){
size_t grib_accessor_class_message_copy_t::string_length(grib_accessor* a)
{
return grib_handle_of_accessor(a)->buffer->ulength;
}
long grib_accessor_class_message_copy_t::byte_count(grib_accessor* a){
long grib_accessor_class_message_copy_t::byte_count(grib_accessor* a)
{
return a->length;
}

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -11,22 +10,24 @@
#include "grib_accessor_class_multdouble.h"
grib_accessor_class_multdouble_t _grib_accessor_class_multdouble{"multdouble"};
grib_accessor_class_multdouble_t _grib_accessor_class_multdouble{ "multdouble" };
grib_accessor_class* grib_accessor_class_multdouble = &_grib_accessor_class_multdouble;
void grib_accessor_class_multdouble_t::init(grib_accessor* a, const long l, grib_arguments* c){
void grib_accessor_class_multdouble_t::init(grib_accessor* a, const long l, grib_arguments* c)
{
grib_accessor_class_double_t::init(a, l, c);
grib_accessor_multdouble_t* self = (grib_accessor_multdouble_t*)a;
int n = 0;
self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->multiplier = grib_arguments_get_double(grib_handle_of_accessor(a), c, n++);
}
int grib_accessor_class_multdouble_t::unpack_double(grib_accessor* a, double* val, size_t* len){
int grib_accessor_class_multdouble_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
const grib_accessor_multdouble_t* self = (grib_accessor_multdouble_t*)a;
int ret = GRIB_SUCCESS;
int ret = GRIB_SUCCESS;
double value = 0;
ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value);

Some files were not shown because too many files have changed in this diff Show More