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

View File

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