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,13 +114,11 @@ 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) {

View File

@ -21,7 +21,6 @@ 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";
@ -32,68 +31,52 @@ 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
{
# range
if(averaging1Flag == P_TAVG ){
if(
marsType == TYPE_OR
|| marsType == TYPE_FC || marsType == TYPE_FC
|| marsType == TYPE_FF || marsType == TYPE_FF
|| marsType == TYPE_FX || marsType == TYPE_FX)
)
{ {
meta marsRange evaluate((coordinate1End - coordinate1Start)/3600); meta marsRange evaluate((coordinate1End - coordinate1Start)/3600);
alias mars.range = marsRange; 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;}
# levelist latitude longitude
if(coordinate2Flag == GRIB_DEPTH){
meta marsLevelist divdouble( coordinate2Start,1000 ); meta marsLevelist divdouble( coordinate2Start,1000 );
meta roundedMarsLevelist round( marsLevelist ,1000); meta roundedMarsLevelist round( marsLevelist ,1000);
alias mars.levelist = roundedMarsLevelist ; alias mars.levelist = roundedMarsLevelist ;
} }
if(coordinate2Flag == GRIB_LONGITUDE){ if (coordinate2Flag == GRIB_LONGITUDE) {
meta marsLongitude divdouble( coordinate2Start,1000000 ); meta marsLongitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLongitude round( marsLongitude ,1000); meta roundedMarsLongitude round( marsLongitude ,1000);
alias mars.longitude = roundedMarsLongitude ; alias mars.longitude = roundedMarsLongitude ;
} }
if(coordinate2Flag == GRIB_LATITUDE){ if (coordinate2Flag == GRIB_LATITUDE) {
meta marsLatitude divdouble( coordinate2Start,1000000 ); meta marsLatitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLatitude round( marsLatitude ,1000); meta roundedMarsLatitude round( marsLatitude ,1000);
alias mars.latitude = roundedMarsLatitude ; 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 # date
if(averaging1Flag == 0) { alias mars.product = coordAveraging0;} if ( (marsType == TYPE_OR && averaging1Flag == P_TAVG)
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)
|| (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;
@ -101,18 +84,13 @@ if(horizontalCoordinateDefinition == 0)
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) {
if(coordinateIndexNumber== 3)
{
meta marsLatitude divdouble( coordinate1Start,1000000); meta marsLatitude divdouble( coordinate1Start,1000000);
meta marsLongitude divdouble( coordinate2Start,1000000); meta marsLongitude divdouble( coordinate2Start,1000000);
@ -121,11 +99,9 @@ if(horizontalCoordinateDefinition == 0)
alias mars.latitude = roundedMarsLatitude ; alias mars.latitude = roundedMarsLatitude ;
alias mars.longitude = roundedMarsLongitude ; alias mars.longitude = roundedMarsLongitude ;
} }
if(coordinateIndexNumber == 4) if (coordinateIndexNumber == 4) {
{
meta marsLevelist divdouble( coordinate1Start,1000); meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLatitude divdouble( coordinate2Start,1000000); meta marsLatitude divdouble( coordinate2Start,1000000);
@ -136,8 +112,7 @@ if(horizontalCoordinateDefinition == 0)
alias mars.latitude = roundedMarsLatitude ; alias mars.latitude = roundedMarsLatitude ;
} }
if(coordinateIndexNumber == 5) if (coordinateIndexNumber == 5) {
{
meta marsLevelist divdouble( coordinate1Start,1000); meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLongitude divdouble( coordinate2Start,1000000); meta marsLongitude divdouble( coordinate2Start,1000000);
@ -146,43 +121,34 @@ if(horizontalCoordinateDefinition == 0)
alias mars.levelist = roundedMarsLevelist ; alias mars.levelist = roundedMarsLevelist ;
alias mars.longitude = roundedMarsLongitude ; alias mars.longitude = roundedMarsLongitude ;
} }
# section # section
if (coordinateIndexNumber == 3) { alias mars.section = tsectionNumber3; }
if (coordinateIndexNumber == 4) { alias mars.section = tsectionNumber4; }
if (coordinateIndexNumber == 5) { alias mars.section = tsectionNumber5; }
if(coordinateIndexNumber == 3) { alias mars.section = tsectionNumber3;} # range
if(coordinateIndexNumber == 4) { alias mars.section = tsectionNumber4;} if (averaging1Flag == P_INST) {
if(coordinateIndexNumber == 5) { alias mars.section = tsectionNumber5;} if ((marsType == TYPE_OR)
# 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;