Merge develop

This commit is contained in:
Shahram Najm 2019-11-06 11:21:37 +00:00
commit e089e4767a
9 changed files with 38 additions and 23 deletions

View File

@ -1,4 +1,4 @@
# Code table 0: Identification of centres
# COMMON CODE TABLE C-1: Identification of originating/generating centre (GRIB1, BUFR3)
0 0 Absent
1 ammc Melbourne (WMC)
2 2 Melbourne (WMC)

View File

@ -1,4 +1,4 @@
# COMMON CODE TABLE C-11: Originating/generating centres
# COMMON CODE TABLE C-11: Originating/generating centres (GRIB2, BUFR4)
0 0 WMO Secretariat
1 ammc Melbourne (WMC)
2 2 Melbourne (WMC)

View File

@ -98,21 +98,29 @@ if (isHindcast == 1) {
alias mars.time = modelVersionTime;
}
# ECC-891
concept is_ocean_param(zero) {
'1' = { paramId = 151219; }
'1' = { paramId = 151163; }
'1' = { paramId = 151127; }
'1' = { paramId = 151175; }
'1' = { paramId = 151131; }
'1' = { paramId = 151132; }
'1' = { paramId = 151145; }
'1' = { paramId = 151225; }
'1' = { paramId = 174098; }
'0' = { dummy=1; }
# ECC-891, ECC-1013
concept is_ocean2d_param(zero) {
'1' = { discipline=10; typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255; }
'1' = { discipline=10; typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=missing(); scaledValueOfFirstFixedSurface=missing(); typeOfSecondFixedSurface=255; }
'1' = { discipline=10; typeOfFirstFixedSurface=20; scaleFactorOfFirstFixedSurface=2; scaledValueOfFirstFixedSurface=29315; typeOfSecondFixedSurface=255; }
'1' = { discipline=10; typeOfFirstFixedSurface=169; scaleFactorOfFirstFixedSurface=2; scaledValueOfFirstFixedSurface=1; typeOfSecondFixedSurface=255; }
'1' = { discipline=10; typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=160; scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=300; }
'0' = { dummy=1; }
}
if (is_ocean_param) {
constant oceanLevName = 'o2d';
alias mars.levtype = oceanLevName;
unalias mars.levelist;
concept is_ocean3d_param(zero) {
'1' = { discipline=10; typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160; }
'0' = { discipline=10; typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=160; scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=300; }
'0' = { dummy=1; }
}
if (is_ocean2d_param) {
constant oceanLevName = 'o2d';
alias mars.levtype = oceanLevName;
unalias mars.levelist;
}
if (is_ocean3d_param) {
constant oceanLevName = 'o3d';
alias mars.levtype = oceanLevName;
unalias mars.levelist;
}

View File

@ -74,6 +74,10 @@ concept_nofail vertical.typeOfLevel (unknown) {
'entireOcean' = {typeOfFirstFixedSurface=1;typeOfSecondFixedSurface=9;}
'snow' = {typeOfFirstFixedSurface=114;typeOfSecondFixedSurface=255;}
'snowLayer' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=114;}
'oceanSurface' = {typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;}
'oceanLayer' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160;}
'mixedLayerDepth' = {typeOfFirstFixedSurface=169; typeOfSecondFixedSurface=255;}
}
alias levelType=typeOfFirstFixedSurface;

View File

@ -320,6 +320,7 @@ static int unpack_string (grib_accessor* a, char* buffer, size_t *len)
}
*len=rsize;
Assert(buffer);
memcpy(buffer,start,rsize);
buffer[rsize]=0;

View File

@ -338,7 +338,7 @@ static int grib_load_smart_table(grib_context* c,const char* filename,
while(fgets(line,sizeof(line)-1,f))
{
char* s=line;
char* p=line;
char* p;
line[strlen(line)-1]=0;

View File

@ -108,14 +108,12 @@ int main (int argc, char **argv)
CODES_CHECK (codes_check_message_header(buffer, size, PRODUCT_BUFR), 0);
CODES_CHECK (codes_check_message_footer(buffer, size, PRODUCT_BUFR), 0);
if (fwrite (buffer, 1, size, fout) != size) {
fclose (fout);
fprintf (stderr, "Failed to write data.\n");
return 1;
}
if (fclose (fout) != 0) {
fprintf (stderr, "Failed to close file handle.\n");
return 1;
}
fclose (fout);
codes_handle_delete (h);
free (ivalues);
free (rvalues);

View File

@ -26,8 +26,10 @@ static int encode_file(char *template_file, char *output_file)
int err = 0;
long numSubsets = 0;
assert(template_file);
in = fopen(template_file,"r"); assert(in);
if (opt_write) {
assert(output_file);
out = fopen(output_file,"w"); assert(out);
}

View File

@ -15,6 +15,7 @@
#include "grib_api.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#ifndef ECCODES_ON_WINDOWS
#include <unistd.h>
@ -48,6 +49,7 @@ int main(int argc,char* argv[]) {
else if (argc==2) filename=argv[1];
else usage(argv[0]);
assert(filename);
f=fopen(filename,"r");
if (!f) {perror(filename);exit(1);}