Commit c496cb78 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added function streamGrbChangeModeUvRelativeToGrid().

parent b49bbfff
......@@ -1831,6 +1831,18 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
break;
}
}
if ( cdiGribChangeModeUvRelativeToGrid.active )
{
// this will overrule/change the UvRelativeToGrid flag;
// typically when the wind is rotated with respect to north pole
bool uvRelativeToGrid = bit_get(ISEC2_ResFlag, 3);
if ( uvRelativeToGrid && !cdiGribChangeModeUvRelativeToGrid.mode )
ISEC2_ResFlag -= 8;
else if ( !uvRelativeToGrid && cdiGribChangeModeUvRelativeToGrid.mode )
ISEC2_ResFlag += 8;
}
}
static
......
......@@ -15,7 +15,7 @@
// change if cdiGribChangeParameterID.active
struct cdiGribParamChange cdiGribChangeParameterID;
// Used only in CDO
// Used only for CDO module Selmulti
void streamGrbChangeParameterIdentification(int code, int ltype, int lev)
{
// NOTE this is a "PROXY" function for gribapiChangeParameterIdentification();
......@@ -29,6 +29,15 @@ void streamGrbChangeParameterIdentification(int code, int ltype, int lev)
cdiGribChangeParameterID.lev = lev;
}
struct cdiGribModeChange cdiGribChangeModeUvRelativeToGrid;
// Used only for CDO module WindTrans
void streamGrbChangeModeUvRelativeToGrid(int mode)
{
cdiGribChangeModeUvRelativeToGrid.active = true;
cdiGribChangeModeUvRelativeToGrid.mode = (mode > 0);
}
int grib1ltypeToZaxisType(int grib_ltype)
{
......
......@@ -30,9 +30,17 @@ struct cdiGribParamChange
bool active;
};
struct cdiGribModeChange
{
bool mode;
bool active;
};
extern struct cdiGribParamChange cdiGribChangeParameterID;
extern struct cdiGribModeChange cdiGribChangeModeUvRelativeToGrid;
void streamGrbChangeParameterIdentification(int code, int ltype, int lev);
void streamGrbChangeModeUvRelativeToGrid(int mode);
#endif /* _STREAM_GRB_H */
/*
......
......@@ -2677,6 +2677,13 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
GRIB_CHECK(my_grib_set_double(gh, "missingValue", vlistInqVarMissval(vlistID, varID)), 0);
}
if ( cdiGribChangeModeUvRelativeToGrid.active )
{
// this will overrule/change the UvRelativeToGrid flag;
// typically when the wind is rotated with respect to north pole
GRIB_CHECK(my_grib_set_long(gh, "uvRelativeToGrid", (long) cdiGribChangeModeUvRelativeToGrid.mode), 0);
}
GRIB_CHECK(grib_set_double_array(gh, "values", data, (size_t)datasize), 0);
/* get the size of coded message */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment