Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $ source activate radolan
```
Note, shapelib is not available at the moment within the conda environment.

## Library and ececutables
## Library and Executables

The project produces a libradolan, which is installed to /usr/local/lib
together with it's headers at /usr/local/include. In addition, the following
Expand Down
21 changes: 7 additions & 14 deletions include/radolan/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,15 @@

/* Prefix for Radolan constants, data types and methods is 'RD' */

#define RD_HEADER_LENGTH 138
#define RD_DIM_LON 900
#define RD_DIM_LAT 900

#define RD_SECONDARY_VALUE_BIT 0x01 // 0b0000000000000001
#define RD_ERROR_BIT 0x02 // 0b0000000000000010
#define RD_NEGATIVE_SIGN_BIT 0x04 // 0b0000000000000100
#define RD_CLUTTER_BIT 0x08 // 0b0000000000001000

#define RD_CLUTTER_VALUE -2490.0f
#define RD_ERROR_VALUE -2500.0f

#define RX_CLUTTER_VALUE 0xF9
#define RX_ERROR_VALUE 0xFA

#define RD_DBZ_BASEVALUE -32.5
#define RD_DBZ_OUTSIDEVALUE 92.5
#define RD_CLUTTER_VALUE -2490.0f
#define RD_ERROR_VALUE -2500.0f
#define RX_ERROR_VALUE 0xFA
#define RD_DBZ_OUTSIDEVALUE 92.5

#ifdef __cplusplus
extern "C"
Expand Down Expand Up @@ -91,13 +83,14 @@ extern "C"
RD_EZ,
RD_EH,
RD_EB,
RD_EW
RD_EW,
RD_FZ
} RDScanType;

/** \var typedef RDRadarFormat
* Radar format as denoted in Chapter 1.1 of the Radolan v2.1 spec.
*/
typedef enum {R100km=1,R128km=2} RDRadarFormat;
typedef enum {R100km=1, R128km=2, R150km=3} RDRadarFormat;

/** Quantification as denoted in Chapter 1.1 of the Radolan v2.1 spec. */
typedef enum {RAVOQ_HV,RAVOQ_HV_ConfidenceEstimate,RAVOQ,Winterrath} RDQuantification;
Expand Down
15 changes: 9 additions & 6 deletions src/classes/coordinate_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ namespace Radolan
const double RDCoordinateSystem::MESH_WIDTH(1.0);

RDCoordinateSystem::RDCoordinateSystem(RDScanType type) {
m_scanType = type;
updateGridInfo();
this->setScanType(type);
}

RDCoordinateSystem::~RDCoordinateSystem() {
Expand All @@ -57,7 +56,6 @@ namespace Radolan
updateGridInfo();
}


void RDCoordinateSystem::updateGridInfo() {
switch (this->m_scanType) {

Expand All @@ -68,13 +66,18 @@ namespace Radolan
m_radolanGridCountVertical = 1500;
m_originGeographical = rdGeographicalPoint(9.0f, 51.0f);
m_offset = rdCartesianPoint(600.0f, 800.0f);
}
break;
} break;

default: {
case RD_FZ:
m_radolanGridCountHorizontal = 450;
m_radolanGridCountVertical = 450;
m_originGeographical = rdGeographicalPoint(9.0f, 51.0f);
m_offset = rdCartesianPoint(450.0f, 450.0f);

default: {
m_radolanGridCountHorizontal = 900;
m_radolanGridCountVertical = 900;
m_originGeographical = rdGeographicalPoint(9.0f, 51.0f);
m_offset = rdCartesianPoint(450.0f, 450.0f);
}
}
Expand Down
89 changes: 36 additions & 53 deletions src/classes/netcdf_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#include <radolan/netcdf_converter.h>

#ifdef __cplusplus
namespace Radolan
{
namespace Radolan {
#endif

#define ADD_DIMENSION_Z 0
Expand Down Expand Up @@ -183,20 +182,20 @@ namespace Radolan
// start point and counters for writing
// the buffer to netcdf

#if ADD_DIMENSION_Z
#if ADD_DIMENSION_Z
// z,y,x
vector<size_t> startp(3, 0);
vector<size_t> countp(3, 0);
countp[0] = 1;
countp[1] = scan->dimLat;
countp[2] = scan->dimLon;
#else
#else
// y,x
vector<size_t> startp(2, 0);
vector<size_t> countp(2, 0);
countp[0] = scan->dimLat;
countp[1] = scan->dimLon;
#endif
#endif

// Re-package data: x and y are switched around in the data (following
// the cf-metadata convention)
Expand Down Expand Up @@ -297,64 +296,48 @@ namespace Radolan
y.putAtt("valid_max", ncFloat, yData[scan->dimLon - 1]);
free(yData);

#if ADD_DIMENSION_Z
#if ADD_DIMENSION_Z
// write z-Axis information
float *zData = (float *) malloc(sizeof (float) * 1);
zData[0] = 0.0;
z.putVar(zData);
z.putAtt("valid_min", ncFloat, zData[0]);
z.putAtt("valid_max", ncFloat, zData[0]);
free(zData);
#endif
#endif
return file;
}

const char *
Radolan2NetCDF::getStandardName(RDScanType scanType) {
const char *result = NULL;
switch (scanType) {
case
RD_RX:
case
RD_EX:
case RD_RX:
case RD_EX:
case RD_FZ:
result = "reflectivity";
break;
case
RD_RZ:
case
RD_RY:
case
RD_RV:
case
RD_EZ:
case
RD_RH:
case
RD_RB:
case
RD_RW:
case
RD_RL:
case
RD_RU:
case
RD_RS:
case
RD_RQ:
case
RD_SQ:
case
RD_SH:
case
RD_SF:
case RD_RZ:
case RD_RY:
case RD_RV:
case RD_EZ:
case RD_RH:
case RD_RB:
case RD_RW:
case RD_RL:
case RD_RU:
case RD_RS:
case RD_RQ:
case RD_SQ:
case RD_SH:
case RD_SF:
result = "rainrate";
break;
default:
result = "unknown";
break;
}
return
result;
return result;
}

void
Expand All @@ -363,9 +346,9 @@ namespace Radolan
int dimLon = file->getDim("x").getSize();
int dimLat = file->getDim("y").getSize();

#if ADD_DIMENSION_Z
#if ADD_DIMENSION_Z
int dimZ = file->getDim("z").getSize();
#endif
#endif

// int dimT = file->get_dim(NcToken("time"))->size();
NcVar data = file->getVar("reflectivity");
Expand All @@ -374,35 +357,35 @@ namespace Radolan
product.getValues(typeIdentifier);
RDScanType scanType = RDScanTypeFromString(typeIdentifier.c_str());

#if ADD_DIMENSION_Z
#if ADD_DIMENSION_Z
float values[dimZ][dimLat][dimLon];
#else
#else
float values[dimLat][dimLon];
#endif
#endif
data.getVar(values);

#if ADD_DIMENSION_Z
#if ADD_DIMENSION_Z
for (int iz = 0; iz < dimZ; iz++)
{
#endif
#endif
for (int iy = 0; iy < dimLat; iy++) {
if (iy % latVertices == 0) {
for (int ix = 0; ix < dimLon; ix++) {
if (ix % lonVertices == 0) {
#if ADD_DIMENSION_Z
#if ADD_DIMENSION_Z
float value = values[iz][iy][ix];
#else
#else
float value = values[iy][ix];
#endif
#endif
std::cout << (RDIsCleanMeasurementAndNotMin(scanType, value) ? "*" : " ");
}
}
std::cout << std::endl;
}
}
#if ADD_DIMENSION_Z
#if ADD_DIMENSION_Z
std::cout << std::endl;
}
#endif
#endif
}
}
Loading