Definitions: clean up

This commit is contained in:
Shahram Najm 2021-08-21 22:17:22 +01:00
parent 64929ab32f
commit 28ab943001
2 changed files with 87 additions and 129 deletions

View File

@ -27,7 +27,6 @@ unsigned[1] methodNumber : dump ;
#
# Coordinate structure definition
#
unsigned[1] spaceUnitFlag : dump ;
unsigned[1] verticalCoordinateDefinition : dump ;
@ -41,7 +40,6 @@ unsigned[1] timeCoordinateDefinition : dump ;
#
# Position definition: mixed coordinates
#
unsigned[1] mixedCoordinateFieldFlag : dump ;
unsigned[1] coordinate1Flag : dump ;
@ -63,7 +61,6 @@ signed[4] coordinate2End : dump ;
#
# Data grid definitions
#
unsigned[1] coordinate3Flag : dump ;
unsigned[1] coordinate4Flag : dump ;
@ -87,7 +84,6 @@ flags[1] flagForNormalOrStaggeredGrid 'grib1/ocean.1.table' : dump;
#
# Auxiliary information
#
flags[1] flagForAnyFurtherInformation 'grib1/ocean.1.table' : dump;
unsigned[1] numberInHorizontalCoordinates : dump;
@ -101,13 +97,11 @@ unsigned[2] numberInTheAuxiliaryArray : dump ;
#
# Horizontal coordinate definition
#
unsigned[4] horizontalCoordinateSupplement[numberInHorizontalCoordinates] : dump;
#
# Mixed coordinate definition
#
unsigned[4] mixedCoordinateDefinition[numberInMixedCoordinateDefinition] : dump;
#
@ -120,17 +114,15 @@ if (numberInTheGridCoordinateList>0) {
#
# Auxiliary array
#
unsigned[4] auxiliary[numberInTheAuxiliaryArray] : dump;
#
# Post-auxiliary array
#
constant postAuxiliaryArrayPresent = 1;
if (flagShowingPostAuxiliaryArrayInUse == postAuxiliaryArrayPresent) {
unsigned[4] sizeOfPostAuxiliaryArrayPlusOne : dump;
unsigned[4] sizeOfPostAuxiliaryArrayPlusOne : dump;
meta sizeOfPostAuxiliaryArray evaluate(sizeOfPostAuxiliaryArrayPlusOne - 1);
if (sizeOfPostAuxiliaryArray>0) {
unsigned[4] postAuxiliary[sizeOfPostAuxiliaryArray] : dump;

View File

@ -21,173 +21,139 @@ constant isectionNumber2 = "h";
constant isectionNumber3 = "m";
constant isectionNumber4 = "z";
constant tsectionNumber3 = "v";
constant tsectionNumber4 = "z";
constant tsectionNumber5 = "m";
constant GRIB_DEPTH = 2;
constant GRIB_LONGITUDE = 3;
constant GRIB_LATITUDE = 4;
constant GRIB_DEPTH = 2;
constant GRIB_LONGITUDE = 3;
constant GRIB_LATITUDE = 4;
meta verificationDate g1verificationdate(dataDate, dataTime, endStep) : read_only;
if(horizontalCoordinateDefinition == 0)
{
if(coordinate1Flag == 1 )
{
# range
if(averaging1Flag == P_TAVG ){
if(
marsType == TYPE_OR
|| marsType == TYPE_FC
|| marsType == TYPE_FF
|| marsType == TYPE_FX
)
{
meta marsRange evaluate((coordinate1End - coordinate1Start)/3600);
alias mars.range = marsRange;
}
if (horizontalCoordinateDefinition == 0) {
if (coordinate1Flag == 1 ) {
# range
if (averaging1Flag == P_TAVG ) {
if (marsType == TYPE_OR
|| marsType == TYPE_FC
|| marsType == TYPE_FF
|| marsType == TYPE_FX)
{
meta marsRange evaluate((coordinate1End - coordinate1Start)/3600);
alias mars.range = marsRange;
}
}
# section
# section
if (coordinate2Flag == 2) { alias mars.section = isectionNumber2; }
if (coordinate2Flag == 3) { alias mars.section = isectionNumber3; }
if (coordinate2Flag == 4) { alias mars.section = isectionNumber4; }
if(coordinate2Flag == 2) { alias mars.section = isectionNumber2;}
if(coordinate2Flag == 3) { alias mars.section = isectionNumber3;}
if(coordinate2Flag == 4) { alias mars.section = isectionNumber4;}
# levelist latitude longitude
if(coordinate2Flag == GRIB_DEPTH){
meta marsLevelist divdouble( coordinate2Start,1000 );
meta roundedMarsLevelist round( marsLevelist ,1000);
alias mars.levelist = roundedMarsLevelist ;
}
if(coordinate2Flag == GRIB_LONGITUDE){
meta marsLongitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLongitude round( marsLongitude ,1000);
alias mars.longitude = roundedMarsLongitude ;
}
if(coordinate2Flag == GRIB_LATITUDE){
meta marsLatitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLatitude round( marsLatitude ,1000);
alias mars.latitude = roundedMarsLatitude ;
# levelist latitude longitude
if (coordinate2Flag == GRIB_DEPTH) {
meta marsLevelist divdouble( coordinate2Start,1000 );
meta roundedMarsLevelist round( marsLevelist ,1000);
alias mars.levelist = roundedMarsLevelist ;
}
if (coordinate2Flag == GRIB_LONGITUDE) {
meta marsLongitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLongitude round( marsLongitude ,1000);
alias mars.longitude = roundedMarsLongitude ;
}
if (coordinate2Flag == GRIB_LATITUDE) {
meta marsLatitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLatitude round( marsLatitude ,1000);
alias mars.latitude = roundedMarsLatitude ;
}
#product
if(averaging1Flag == 0) { alias mars.product = coordAveraging0;}
if(averaging1Flag == 1) { alias mars.product = coordAveraging1;}
if(averaging1Flag == 2) { alias mars.product = coordAveraging2;}
if(averaging1Flag == 3) { alias mars.product = coordAveraging3;}
#product
if (averaging1Flag == 0) { alias mars.product = coordAveraging0;}
if (averaging1Flag == 1) { alias mars.product = coordAveraging1;}
if (averaging1Flag == 2) { alias mars.product = coordAveraging2;}
if (averaging1Flag == 3) { alias mars.product = coordAveraging3;}
# date
if(
(marsType == TYPE_OR && averaging1Flag == P_TAVG)
# date
if ( (marsType == TYPE_OR && averaging1Flag == P_TAVG)
|| (marsType == TYPE_OR && averaging1Flag == P_TACC)
|| (marsType == TYPE_FX && averaging1Flag == P_TAVG)
)
{
|| (marsType == TYPE_FX && averaging1Flag == P_TAVG))
{
#remove mars.date;
alias mars.date = verificationDate;
#remove mars.step;
constant stepZero = 0;
alias mars.step = stepZero;
}
}
else
{
meta coordinateIndexNumber evaluate(coordinate4Flag+coordinate3Flag);
}
}
else
{
meta coordinateIndexNumber evaluate(coordinate4Flag+coordinate3Flag);
# levelist latitude longitude
if (coordinateIndexNumber== 3) {
meta marsLatitude divdouble( coordinate1Start,1000000);
meta marsLongitude divdouble( coordinate2Start,1000000);
if(coordinateIndexNumber== 3)
{
meta marsLatitude divdouble( coordinate1Start,1000000);
meta marsLongitude divdouble( coordinate2Start,1000000);
meta roundedMarsLatitude round( marsLatitude ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
meta roundedMarsLatitude round( marsLatitude ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
alias mars.latitude = roundedMarsLatitude ;
alias mars.longitude = roundedMarsLongitude ;
}
alias mars.latitude = roundedMarsLatitude ;
alias mars.longitude = roundedMarsLongitude ;
if (coordinateIndexNumber == 4) {
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLatitude divdouble( coordinate2Start,1000000);
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLatitude round( marsLatitude ,1000);
if(coordinateIndexNumber == 4)
{
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLatitude divdouble( coordinate2Start,1000000);
alias mars.levelist = roundedMarsLevelist ;
alias mars.latitude = roundedMarsLatitude ;
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLatitude round( marsLatitude ,1000);
if (coordinateIndexNumber == 5) {
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLongitude divdouble( coordinate2Start,1000000);
alias mars.levelist = roundedMarsLevelist ;
alias mars.latitude = roundedMarsLatitude ;
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
if(coordinateIndexNumber == 5)
{
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLongitude divdouble( coordinate2Start,1000000);
alias mars.levelist = roundedMarsLevelist ;
alias mars.longitude = roundedMarsLongitude ;
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
# section
if (coordinateIndexNumber == 3) { alias mars.section = tsectionNumber3; }
if (coordinateIndexNumber == 4) { alias mars.section = tsectionNumber4; }
if (coordinateIndexNumber == 5) { alias mars.section = tsectionNumber5; }
alias mars.levelist = roundedMarsLevelist ;
alias mars.longitude = roundedMarsLongitude ;
}
# section
if(coordinateIndexNumber == 3) { alias mars.section = tsectionNumber3;}
if(coordinateIndexNumber == 4) { alias mars.section = tsectionNumber4;}
if(coordinateIndexNumber == 5) { alias mars.section = tsectionNumber5;}
# range
if(averaging1Flag == P_INST){
if(
(marsType == TYPE_OR)
# range
if (averaging1Flag == P_INST) {
if ((marsType == TYPE_OR)
||(marsType == TYPE_FC)
||(marsType == TYPE_CF)
||(marsType == TYPE_PF)
||(marsType == TYPE_FF)
||(marsType == TYPE_OF)
)
||(marsType == TYPE_OF))
{
if( coordinate4Flag == 1){
if (coordinate4Flag == 1){
meta marsRange evaluate((coordinate4OfLastGridPoint - coordinate4OfFirstGridPoint)/3600);
}else{
} else {
meta marsRange evaluate((coordinate3OfLastGridPoint - coordinate3OfFirstGridPoint)/3600);
}
alias mars.range = marsRange;
alias mars.range = marsRange;
}
}
}
# product
alias mars.product = coordAveragingTims;
# date
if(marsType == TYPE_OR && averaging1Flag == P_INST){
if (marsType == TYPE_OR && averaging1Flag == P_INST) {
#remove mars.date;
alias mars.date = verificationDate;
#remove mars.step;
constant stepZero = 0;
alias mars.step =stepZero;
}
}
}
}