Commit 172b4a61 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

rotuvb changed behavior in different versions [Bug #8084]

parent f8dfbbb3
......@@ -3,6 +3,10 @@
* Using CDI library version 1.9.2
* Version 1.9.2 release
2017-11-17 Uwe Schulzweida
* rotuvb changed behavior in different versions [Bug #8084]
2017-11-02 Uwe Schulzweida
* expr: nesting of ?: operator lost in cdo-1.9.1 [Bug #7992]
......
......@@ -32,7 +32,7 @@
static
void rot_uv_back(int gridID, double *us, double *vs)
{
double xpole, ypole, angle;
double xpole = 0, ypole = 0, angle = 0;
if ( gridInqType(gridID) == GRID_PROJECTION && gridInqProjType(gridID) == CDI_PROJ_RLL )
gridInqParamRLL(gridID, &xpole, &ypole, &angle);
......@@ -47,12 +47,16 @@ void rot_uv_back(int gridID, double *us, double *vs)
/* Convert lat/lon units if required */
char units[CDI_MAX_NAME];
gridInqXunits(gridID, units);
grid_to_degree(units, 1, &angle, "angle");
grid_to_degree(units, 1, &xpole, "xpole");
grid_to_degree(units, nlon, xvals, "grid center lon");
gridInqYunits(gridID, units);
grid_to_degree(units, 1, &ypole, "ypole");
grid_to_degree(units, nlat, yvals, "grid center lat");
if ( xpole > 180 ) xpole-=360;
if ( angle > 180 ) angle-=360;
double u, v;
for ( size_t ilat = 0; ilat < nlat; ilat++ )
for ( size_t ilon = 0; ilon < nlon; ilon++ )
......
#!/bin/sh
#
YACSRC=/Users/m214003/cdt/work/YAC/YAC/src
YACSRC=/Users/m214003/cdt/work/YAC/YAC-dev/src
#
FILES="*.c *.h"
#
......
......@@ -31,11 +31,9 @@ double lamrot_to_lam(double phirot, double lamrot, double polphi, double pollam,
if ( lamrot > 180.0 ) lamrot -= 360.0;
double zlamrot = DEG2RAD*lamrot;
if ( fabs(polgam) > 0 )
//X if ( polgam > 0 )
if ( polgam > 0 )
{
double zgam = -DEG2RAD*polgam;
//X double zgam = DEG2RAD*polgam;
double zgam = DEG2RAD*polgam;
zarg1 = sin(zlampol) *
(- zsinpol*cos(zphirot) * (cos(zlamrot)*cos(zgam) - sin(zlamrot)*sin(zgam))
+ zcospol*sin(zphirot))
......@@ -92,11 +90,9 @@ double phirot_to_phi(double phirot, double lamrot, double polphi, double polgam)
if ( lamrot > 180.0 ) lamrot -= 360.0;
double zlamrot = DEG2RAD*lamrot;
if ( fabs(polgam) > 0 )
//X if ( polgam > 0 )
if ( polgam > 0 )
{
double zgam = -DEG2RAD*polgam;
//X double zgam = DEG2RAD*polgam;
double zgam = DEG2RAD*polgam;
zarg = zsinpol*sin(zphirot) +
zcospol*cos(zphirot)*(cos(zlamrot)*cos(zgam) - sin(zgam)*sin(zlamrot));
}
......@@ -188,16 +184,17 @@ void usvs_to_uv(double us, double vs, double phi, double rla,
/* umrechnung von grad in bogenmass */
double zpolphi = polphi*DEG2RAD;
double zpollam = pollam*DEG2RAD;
if ( rla < 0.0 ) rla += 360.0;
//X if ( rla < 0.0 ) rla += 360.0;
// Added by Uwe Schulzweida (17/11/2017)
if ( pollam < 0 && rla < pollam ) rla += 360.0;
//if ( pollam < 0 && rla < 0 ) rla += 360.0;
double zrla = rla *DEG2RAD;
double pollamd = pollam;
if ( pollamd < 0.0 ) pollamd += 360.0;
/* laenge im rotierten system berechnen */
// laenge im rotierten system berechnen
double zrlas = lam_to_lamrot(phi, rla, polphi, pollam)*DEG2RAD;
/* winkel zbeta berechen (schnittwinkel der breitenkreise) */
// winkel zbeta berechen (schnittwinkel der breitenkreise)
double zarg = - sin(zpolphi)*sin(zrla-zpollam)*sin(zrlas) - cos(zrla-zpollam)*cos(zrlas);
if ( zarg > 1.0 ) zarg = 1.0;
if ( zarg < -1.0 ) zarg = -1.0;
......@@ -209,10 +206,10 @@ void usvs_to_uv(double us, double vs, double phi, double rla,
// if ( -(rla - (pollamd-180.0)) < 0 ) zbeta = -zbeta;
if ( (-(rla - (pollamd-180.0)) < 0) && (-(rla - (pollamd-180.0)) >= -180) ) zbeta = -zbeta;
/* us - wind transformieren */
// us - wind transformieren
*u = us*cos(zbeta) - vs*sin(zbeta);
/* vs - wind transformieren */
// vs - wind transformieren
*v = us*sin(zbeta) + vs*cos(zbeta);
}
......
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