Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
ebca586c
Commit
ebca586c
authored
Nov 19, 2015
by
Uwe Schulzweida
Browse files
Magplot cleanup
parent
211c0fd5
Changes
11
Hide whitespace changes
Inline
Side-by-side
config/default
View file @
ebca586c
...
...
@@ -81,6 +81,8 @@ case "${HOSTNAME}" in
--with-grib_api=
$HOME
/local/gribapi-1.13.0
\
--with-netcdf=
$HOME
/local
\
--with-hdf5=
$HOME
/local
\
--with-libxml2=/usr
\
--with-magics=
$HOME
/local/magics-2.25.3
\
--with-proj=/opt/local"
if
test
"
$COMP
"
=
icc
;
then
...
...
src/CdoMagicsMapper.c
View file @
ebca586c
#if defined(HAVE_CONFIG_H)
# include "config.h"
/* HAVE_LIBMAGICS */
#endif
...
...
@@ -7,27 +8,27 @@
#define PARAM_COUNT sizeof( mapper ) / sizeof ( CdoMagicsMapper )
/* extern int SetMagicsParameterValue( char *param_name, char *param_type, char *param_value ) */
/* extern int SetMagicsParameterValue(
const
char *param_name,
const
char *param_type,
const
char *param_value ) */
int
Set_magics_param_CCOLS
(
char
*
user_name
,
char
*
param_value
);
int
Reset_magics_param_CCOLS
(
char
*
user_name
);
int
Set_magics_param_CCOLS
(
const
char
*
user_name
,
const
char
*
param_value
);
int
Reset_magics_param_CCOLS
(
const
char
*
user_name
);
int
Set_magics_param_CLEVS
(
char
*
user_name
,
char
*
param_value
);
int
Reset_magics_param_CLEVS
(
char
*
user_name
);
int
Set_magics_param_CLEVS
(
const
char
*
user_name
,
const
char
*
param_value
);
int
Reset_magics_param_CLEVS
(
const
char
*
user_name
);
int
Set_magics_param_CTABLE
(
char
*
user_name
,
char
*
param_value
);
int
Reset_magics_param_CTABLE
(
char
*
user_name
);
int
Set_magics_param_CTABLE
(
const
char
*
user_name
,
const
char
*
param_value
);
int
Reset_magics_param_CTABLE
(
const
char
*
user_name
);
/* Define an array of Mapper structures to sort. */
typedef
struct
{
char
*
cdo_name
;
char
*
magics_name
;
char
*
magics_type
;
int
(
*
Set_magics_param
)(
char
*
user_name
,
char
*
param_value
);
/* Function to Update the Corresponding Magics parameters */
int
(
*
Reset_magics_param
)(
char
*
user_name
);
/* Function to Reset the Corresponding Magics parameters */
const
char
*
cdo_name
;
const
char
*
magics_name
;
const
char
*
magics_type
;
int
(
*
Set_magics_param
)(
const
char
*
user_name
,
const
char
*
param_value
);
/* Function to Update the Corresponding Magics parameters */
int
(
*
Reset_magics_param
)(
const
char
*
user_name
);
/* Function to Reset the Corresponding Magics parameters */
}
CdoMagicsMapper
;
...
...
@@ -58,93 +59,90 @@ CdoMagicsMapper mapper[] =
}
};
int
Compare
(
CdoMagicsMapper
*
Parameter_one
,
CdoMagicsMapper
*
Parameter_two
);
void
PrintResult
(
const
CdoMagicsMapper
*
c
);
int
Set_magics_param_CCOLS
(
char
*
user_name
,
char
*
param_value
)
int
Set_magics_param_CCOLS
(
const
char
*
user_name
,
const
char
*
param_value
)
{
if
(
user_name
==
NULL
)
return
1
;
printf
(
"Setting the CCOLS magics params
\n
"
);
if
(
user_name
==
NULL
)
return
1
;
printf
(
"Setting the CCOLS magics params
\n
"
);
SetMagicsParameterValue
(
"contour_shade_colour_method"
,
"string"
,
"list"
);
SetMagicsParameterValue
(
"contour_shade_colour_list"
,
"stringarray"
,
param_value
);
SetMagicsParameterValue
(
"contour_shade_colour_method"
,
"string"
,
"list"
);
SetMagicsParameterValue
(
"contour_shade_colour_list"
,
"stringarray"
,
param_value
);
#if 0
#endif
return
0
;
return
0
;
}
int
Reset_magics_param_CCOLS
(
char
*
user_name
)
int
Reset_magics_param_CCOLS
(
const
char
*
user_name
)
{
printf
(
"Re-Setting the CCOLS magics params
\n
"
);
return
0
;
(
void
)
user_name
;
printf
(
"Re-Setting the CCOLS magics params
\n
"
);
return
0
;
}
int
Set_magics_param_CLEVS
(
char
*
user_name
,
char
*
param_value
)
int
Set_magics_param_CLEVS
(
const
char
*
user_name
,
const
char
*
param_value
)
{
if
(
user_name
==
NULL
)
return
1
;
if
(
user_name
==
NULL
)
return
1
;
SetMagicsParameterValue
(
"contour_level_selection_type"
,
"string"
,
"level_list"
);
SetMagicsParameterValue
(
"contour_level_list"
,
"floatarray"
,
param_value
);
SetMagicsParameterValue
(
"contour_level_selection_type"
,
"string"
,
"level_list"
);
SetMagicsParameterValue
(
"contour_level_list"
,
"floatarray"
,
param_value
);
return
0
;
return
0
;
}
int
Reset_magics_param_CLEVS
(
char
*
user_name
)
int
Reset_magics_param_CLEVS
(
const
char
*
user_name
)
{
SetMagicsParameterValue
(
"contour_level_selection_type"
,
"string"
,
"count"
);
printf
(
"Re-Setting the CLEVS magics params
\n
"
);
return
0
;
(
void
)
user_name
;
SetMagicsParameterValue
(
"contour_level_selection_type"
,
"string"
,
"count"
);
printf
(
"Re-Setting the CLEVS magics params
\n
"
);
return
0
;
}
int
Set_magics_param_CTABLE
(
char
*
user_name
,
char
*
param_value
)
int
Set_magics_param_CTABLE
(
const
char
*
user_name
,
const
char
*
param_value
)
{
if
(
user_name
==
NULL
)
return
1
;
printf
(
"Setting the CTABLE magics params
\n
"
);
(
void
)
param_value
;
if
(
user_name
==
NULL
)
return
1
;
printf
(
"Setting the CTABLE magics params
\n
"
);
#if 0
#if defined(HAVE_LIBMAGICS)
SetMagicsParameterValue( "contour_level_list", "floatarray", param_value );
SetMagicsParameterValue( "contour_level_list", "floatarray", param_value );
#endif
#endif
return
0
;
return
0
;
}
int
Reset_magics_param_CTABLE
(
char
*
user_name
)
int
Reset_magics_param_CTABLE
(
const
char
*
user_name
)
{
printf
(
"Re-Setting the CTABLE magics params
\n
"
);
return
0
;
(
void
)
user_name
;
printf
(
"Re-Setting the CTABLE magics params
\n
"
);
return
0
;
}
/* This is the comparison function used for sorting and searching. */
int
Compare
(
CdoMagicsMapper
*
p1
,
CdoMagicsMapper
*
p2
)
int
Compare
(
const
void
*
p1
,
const
void
*
p2
)
{
return
strcmp
(
p1
->
cdo_name
,
p2
->
cdo_name
);
return
strcmp
(
((
CdoMagicsMapper
*
)
p1
)
->
cdo_name
,
((
CdoMagicsMapper
*
)
p2
)
->
cdo_name
);
}
/* Print information about a critter. */
void
PrintResult
(
const
CdoMagicsMapper
*
c
)
{
printf
(
"CDO Name:%s
\t
MAGICS Name:%s
\t
MAGICS Type:%s
\n
"
,
c
->
cdo_name
,
c
->
magics_name
,
c
->
magics_type
);
printf
(
"CDO Name:%s
\t
MAGICS Name:%s
\t
MAGICS Type:%s
\n
"
,
c
->
cdo_name
,
c
->
magics_name
,
c
->
magics_type
);
}
...
...
@@ -153,34 +151,32 @@ void PrintResult ( const CdoMagicsMapper *c )
/* int GetMagicsParameterInfo( const char *user_name, char **magics_name, char **magics_type ) */
int
GetMagicsParameterInfo
(
const
char
*
user_name
,
char
*
param_value
)
{
static
int
once
=
1
;
int
ret_flag
=
0
;
CdoMagicsMapper
target
,
*
result
;
target
.
cdo_name
=
(
char
*
)
user_name
;
if
(
once
)
{
qsort
(
mapper
,
PARAM_COUNT
,
sizeof
(
CdoMagicsMapper
),
(
void
*
)
Compare
);
once
=
0
;
}
result
=
bsearch
(
&
target
,
mapper
,
PARAM_COUNT
,
sizeof
(
CdoMagicsMapper
),
(
void
*
)
Compare
);
if
(
result
)
{
result
->
Set_magics_param
(
result
->
cdo_name
,
param_value
);
/*
*magics_name = result->magics_name;
*magics_type = result->magics_type;
*/
}
else
{
/* Call the Reset functions of all the features to Reset the magics params to default in the calling function */
ret_flag
=
1
;
}
return
ret_flag
;
static
int
once
=
1
;
int
ret_flag
=
0
;
CdoMagicsMapper
target
,
*
result
;
target
.
cdo_name
=
(
char
*
)
user_name
;
if
(
once
)
{
qsort
(
mapper
,
PARAM_COUNT
,
sizeof
(
CdoMagicsMapper
),
Compare
);
once
=
0
;
}
result
=
bsearch
(
&
target
,
mapper
,
PARAM_COUNT
,
sizeof
(
CdoMagicsMapper
),
Compare
);
if
(
result
)
{
result
->
Set_magics_param
(
result
->
cdo_name
,
param_value
);
/*
*magics_name = result->magics_name;
*magics_type = result->magics_type;
*/
}
else
{
/* Call the Reset functions of all the features to Reset the magics params to default in the calling function */
ret_flag
=
1
;
}
return
ret_flag
;
}
src/Maggraph.c
View file @
ebca586c
...
...
@@ -32,7 +32,7 @@ extern xmlNode *magics_node;
#define DBG 0
char
*
line_colours
[]
=
{
"red"
,
"green"
,
"blue"
,
"yellow"
,
"cyan"
,
"magenta"
,
const
char
*
line_colours
[]
=
{
"red"
,
"green"
,
"blue"
,
"yellow"
,
"cyan"
,
"magenta"
,
"avocado"
,
"beige"
,
"brick"
,
"brown"
,
"burgundy"
,
"charcoal"
,
"chestnut"
,
"coral"
,
"cream"
,
"evergreen"
,
"gold"
,
...
...
@@ -52,13 +52,13 @@ char *line_colours[] = { "red", "green", "blue", "yellow", "cyan", "magenta"
"bluishpurple"
,
"purple"
,
};
char
*
graph_params
[]
=
{
"ymin"
,
"ymax"
,
"sigma"
,
"stat"
,
"obsv"
,
"device"
};
const
char
*
graph_params
[]
=
{
"ymin"
,
"ymax"
,
"sigma"
,
"stat"
,
"obsv"
,
"device"
};
int
graph_param_count
=
sizeof
(
graph_params
)
/
sizeof
(
char
*
);
int
num_colours
=
sizeof
(
line_colours
)
/
sizeof
(
char
*
);
void
VerifyGraphParameters
(
int
num_param
,
char
**
param_names
);
int
compareDateOrTimeStr
(
char
*
datetimestr1
,
char
*
datetimestr2
,
char
*
sep_char
);
int
compareDateOrTimeStr
(
char
*
datetimestr1
,
char
*
datetimestr2
,
const
char
*
sep_char
);
extern
int
checkdevice
();
extern
int
IsNumeric
();
...
...
@@ -77,10 +77,10 @@ void maggraph(const char *plotfile, const char *varname,const char *varunits, lo
char
*
lines
[
1
];
char
*
temp_str
;
char
**
split_str
=
NULL
;
char
*
sep_char
=
"="
;
const
char
*
sep_char
=
"="
;
char
**
date_time_str
[
nfiles
];
char
min_date_time_str
[
1024
],
max_date_time_str
[
1024
];
int
min_index
,
max_index
;
int
min_index
=
0
,
max_index
=
0
;
char
vdatestr
[
32
],
vtimestr
[
32
],
legend_text_data
[
256
];
char
vdatestr1
[
32
],
vtimestr1
[
32
];
char
vdatestr2
[
32
],
vtimestr2
[
32
];
...
...
@@ -458,6 +458,7 @@ void maggraph(const char *plotfile, const char *varname,const char *varunits, lo
split_str_count
=
0
;
sep_char
=
"-"
;
split_str_count
=
StringSplitWithSeperator
(
max_date_time_str
,
sep_char
,
&
split_str
);
(
void
)
split_str_count
;
num_years
=
atoi
(
split_str
[
0
]
);
num_months
=
atoi
(
split_str
[
1
]
);
num_days
=
atoi
(
split_str
[
2
]
);
...
...
@@ -706,7 +707,7 @@ void maggraph(const char *plotfile, const char *varname,const char *varunits, lo
}
int
compareDateOrTimeStr
(
char
*
datetimestr1
,
char
*
datetimestr2
,
char
*
sep_char
)
int
compareDateOrTimeStr
(
char
*
datetimestr1
,
char
*
datetimestr2
,
const
char
*
sep_char
)
{
int
split_str_count1
,
split_str_count2
;
...
...
@@ -788,9 +789,7 @@ void quit_MAGICS( )
void
*
Maggraph
(
void
*
argument
)
{
const
char
*
ofilename
;
char
varname
[
CDI_MAX_NAME
],
units
[
CDI_MAX_NAME
];
char
**
pnames
=
NULL
;
int
varID
,
levelID
;
int
gridID
;
int
nrecs
;
...
...
@@ -799,24 +798,21 @@ void *Maggraph(void *argument)
int
vlistID
,
vlistID0
=
-
1
;
int
nmiss
;
int
taxisID
;
int
**
vdate
=
NULL
,
**
vtime
=
NULL
;
int
fileID
,
nfiles
;
long
*
nts
,
nts_alloc
;
int
nparam
=
0
;
double
**
datatab
=
NULL
;
int
fileID
;
long
nts_alloc
;
double
val
;
int
i
;
cdoInitialize
(
argument
);
nparam
=
operatorArgc
();
pnames
=
operatorArgv
();
int
nparam
=
operatorArgc
();
char
**
pnames
=
operatorArgv
();
if
(
nparam
)
VerifyGraphParameters
(
nparam
,
pnames
);
nfiles
=
cdoStreamCnt
()
-
1
;
ofilename
=
cdoStreamName
(
nfiles
)
->
args
;
int
nfiles
=
cdoStreamCnt
()
-
1
;
const
char
*
ofilename
=
cdoStreamName
(
nfiles
)
->
args
;
if
(
DBG
)
{
...
...
@@ -824,10 +820,10 @@ void *Maggraph(void *argument)
fprintf
(
stderr
,
" files %s
\n
"
,
ofilename
);
}
datatab
=
(
double
**
)
Malloc
(
nfiles
*
sizeof
(
double
*
));
vdate
=
(
int
**
)
Malloc
(
nfiles
*
sizeof
(
int
*
));
vtime
=
(
int
**
)
Malloc
(
nfiles
*
sizeof
(
int
*
));
nts
=
(
long
*
)
Malloc
(
nfiles
*
sizeof
(
long
));
double
**
datatab
=
(
double
**
)
Malloc
(
nfiles
*
sizeof
(
double
*
));
int
**
vdate
=
(
int
**
)
Malloc
(
nfiles
*
sizeof
(
int
*
));
int
**
vtime
=
(
int
**
)
Malloc
(
nfiles
*
sizeof
(
int
*
));
long
*
nts
=
(
long
*
)
Malloc
(
nfiles
*
sizeof
(
long
));
for
(
fileID
=
0
;
fileID
<
nfiles
;
fileID
++
)
{
...
...
@@ -960,7 +956,7 @@ void VerifyGraphParameters( int num_param, char **param_names )
int
i
,
j
;
int
found
=
FALSE
,
syntax
=
TRUE
,
halt_flag
=
FALSE
,
split_str_count
;
char
**
split_str
=
NULL
;
char
*
sep_char
=
"="
;
const
char
*
sep_char
=
"="
;
char
*
temp_str
;
for
(
i
=
0
;
i
<
num_param
;
++
i
)
...
...
src/Magplot.c
View file @
ebca586c
...
...
@@ -33,16 +33,16 @@ subpage_upper_right_longitude
int
CONTOUR
,
SHADED
,
GRFILL
;
char
*
contour_params
[]
=
{
"min"
,
"max"
,
"count"
,
"interval"
,
"list"
,
"colour"
,
"thickness"
,
"style"
,
"RGB"
,
"device"
,
"step_freq"
,
"file_split"
,
"lat_min"
,
"lat_max"
,
"lon_min"
,
"lon_max"
,
"projection"
};
const
char
*
contour_params
[]
=
{
"min"
,
"max"
,
"count"
,
"interval"
,
"list"
,
"colour"
,
"thickness"
,
"style"
,
"RGB"
,
"device"
,
"step_freq"
,
"file_split"
,
"lat_min"
,
"lat_max"
,
"lon_min"
,
"lon_max"
,
"projection"
};
int
contour_param_count
=
sizeof
(
contour_params
)
/
sizeof
(
char
*
);
char
*
shaded_params
[]
=
{
"min"
,
"max"
,
"count"
,
"interval"
,
"list"
,
"colour_min"
,
"colour_max"
,
"colourtable"
,
"RGB"
,
"colour_triad"
,
"device"
,
"step_freq"
,
"file_split"
,
"lat_min"
,
"lat_max"
,
"lon_min"
,
"lon_max"
,
"projection"
};
const
char
*
shaded_params
[]
=
{
"min"
,
"max"
,
"count"
,
"interval"
,
"list"
,
"colour_min"
,
"colour_max"
,
"colourtable"
,
"RGB"
,
"colour_triad"
,
"device"
,
"step_freq"
,
"file_split"
,
"lat_min"
,
"lat_max"
,
"lon_min"
,
"lon_max"
,
"projection"
};
int
shaded_param_count
=
sizeof
(
shaded_params
)
/
sizeof
(
char
*
);
char
*
grfill_params
[]
=
{
"min"
,
"max"
,
"count"
,
"interval"
,
"list"
,
"colour_min"
,
"colour_max"
,
"colourtable"
,
"resolution"
,
"RGB"
,
"colour_triad"
,
"device"
,
"step_freq"
,
"file_split"
,
"lat_min"
,
"lat_max"
,
"lon_min"
,
"lon_max"
,
"projection"
};
const
char
*
grfill_params
[]
=
{
"min"
,
"max"
,
"count"
,
"interval"
,
"list"
,
"colour_min"
,
"colour_max"
,
"colourtable"
,
"resolution"
,
"RGB"
,
"colour_triad"
,
"device"
,
"step_freq"
,
"file_split"
,
"lat_min"
,
"lat_max"
,
"lon_min"
,
"lon_max"
,
"projection"
};
int
grfill_param_count
=
sizeof
(
grfill_params
)
/
sizeof
(
char
*
);
char
*
STD_COLOUR_TABLE
[]
=
{
"red"
,
"green"
,
"blue"
,
"yellow"
,
"cyan"
,
"magenta"
,
"black"
,
"avocado"
,
const
char
*
STD_COLOUR_TABLE
[]
=
{
"red"
,
"green"
,
"blue"
,
"yellow"
,
"cyan"
,
"magenta"
,
"black"
,
"avocado"
,
"beige"
,
"brick"
,
"brown"
,
"burgundy"
,
"charcoal"
,
"chestnut"
,
"coral"
,
"cream"
,
"evergreen"
,
"gold"
,
"grey"
,
...
...
@@ -69,10 +69,10 @@ int STD_COLOUR_COUNT = sizeof( STD_COLOUR_TABLE )/sizeof( char* );
int
USR_COLOUR_COUNT
=
0
;
char
*
STYLE_TABLE
[]
=
{
"SOLID"
,
"DASH"
,
"DOT"
,
"CHAIN_DASH"
,
"CHAIN_DOT"
};
const
char
*
STYLE_TABLE
[]
=
{
"SOLID"
,
"DASH"
,
"DOT"
,
"CHAIN_DASH"
,
"CHAIN_DOT"
};
int
STYLE_COUNT
=
sizeof
(
STYLE_TABLE
)
/
sizeof
(
char
*
);
char
*
DEVICE_TABLE
[]
=
{
"PS"
,
"EPS"
,
"PDF"
,
"PNG"
,
"GIF"
,
"GIF_ANIMATION"
,
"JPEG"
,
"SVG"
,
"KML"
};
const
char
*
DEVICE_TABLE
[]
=
{
"PS"
,
"EPS"
,
"PDF"
,
"PNG"
,
"GIF"
,
"GIF_ANIMATION"
,
"JPEG"
,
"SVG"
,
"KML"
};
int
DEVICE_COUNT
=
sizeof
(
DEVICE_TABLE
)
/
sizeof
(
char
*
);
...
...
@@ -80,7 +80,7 @@ int DEVICE_COUNT = sizeof( DEVICE_TABLE )/ sizeof( char *);
*/
/** The following projections are having some issues to be clarified with Magics++ **/
char
*
PROJECTION_TABLE
[]
=
{
"cylindrical"
,
"polar_stereographic"
,
"polar_north"
,
"geos"
,
"meteosat"
,
"meteosat_57E"
,
"lambert"
,
"EPSG3857"
,
"goode"
,
"collignon"
,
"mollweide"
,
"robinson"
,
"bonne"
,
"google"
,
"efas"
,
"EPSG4326"
,
"lambert_north_atlantic"
,
"mercator"
};
const
char
*
PROJECTION_TABLE
[]
=
{
"cylindrical"
,
"polar_stereographic"
,
"polar_north"
,
"geos"
,
"meteosat"
,
"meteosat_57E"
,
"lambert"
,
"EPSG3857"
,
"goode"
,
"collignon"
,
"mollweide"
,
"robinson"
,
"bonne"
,
"google"
,
"efas"
,
"EPSG4326"
,
"lambert_north_atlantic"
,
"mercator"
};
int
PROJECTION_COUNT
=
sizeof
(
PROJECTION_TABLE
)
/
sizeof
(
char
*
);
...
...
@@ -106,7 +106,7 @@ int COUNT = 10, isRGB = FALSE, THICKNESS = 1, NUM_LEVELS = 0, FILE_SPLIT = FAL
double
YMIN
=
1.0e+200
,
YMAX
=
-
1.0e+200
,
INTERVAL
=
8
.
0
,
RESOLUTION
=
10
.
0
f
,
*
LEV_LIST
=
NULL
;
double
LAT_MIN
=
1.0e+200
,
LAT_MAX
=
-
1.e+200
;
double
LON_MIN
=
1.0e+200
,
LON_MAX
=
-
1.e+200
;
char
*
COLOUR
=
NULL
,
*
COLOUR_MIN
=
NULL
,
*
COLOUR_MAX
=
NULL
,
*
STYLE
=
NULL
,
*
DEVICE
=
NULL
,
*
COLOUR_TRIAD
=
NULL
,
*
PROJECTION
=
NULL
;
const
char
*
COLOUR
=
NULL
,
*
COLOUR_MIN
=
NULL
,
*
COLOUR_MAX
=
NULL
,
*
STYLE
=
NULL
,
*
DEVICE
=
NULL
,
*
COLOUR_TRIAD
=
NULL
,
*
PROJECTION
=
NULL
;
static
...
...
@@ -117,11 +117,9 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
double
dlon
=
0
,
dlat
=
0
;
char
plotfilename
[
4096
];
char
*
titlename
;
int
j
,
split_str_count
,
split_str_count1
;
char
*
sep_char
=
"="
;
char
**
split_str
=
NULL
,
**
split_str1
=
NULL
;
char
*
temp_str
=
NULL
;
char
orig_char
=
';'
,
rep_char
=
','
;
int
j
,
split_str_count
;
const
char
*
sep_char
=
"="
;
char
**
split_str
=
NULL
;
char
tempname
[
256
];
...
...
@@ -165,7 +163,7 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
if
(
!
strcmp
(
split_str
[
0
],
"list"
)
)
{
for
(
j
=
0
;
j
<
split_str_count
1
;
j
++
)
for
(
j
=
0
;
j
<
split_str_count
;
j
++
)
fprintf
(
stderr
,
"LIST %f
\n
"
,
LEV_LIST
[
j
]
);
}
...
...
@@ -221,19 +219,19 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
/* Set the input data arrays to magics++ */
mag_set2r
(
"input_field"
,
array
,
nlon
,
nlat
);
/*
mag_setc("input_field_organization", "REGULAR");
mag_set2r("input_field_latitudes", grid_center_lat, nlon, nlat);
mag_set2r("input_field_longitudes", grid_center_lon, nlon, nlat);
mag_setc("input_field_organization", "
NON
REGULAR");
mag_set2r("input_field_latitudes", grid_center_lat, nlon, nlat);
mag_set2r("input_field_longitudes", grid_center_lon, nlon, nlat);
*/
mag_setc
(
"input_field_organization"
,
"REGULAR"
);
mag_setr
(
"input_field_initial_latitude"
,
grid_center_lat
[
0
]);
mag_setr
(
"input_field_latitude_step"
,
dlat
);
mag_setr
(
"input_field_initial_longitude"
,
grid_center_lon
[
0
]);
mag_setr
(
"input_field_longitude_step"
,
dlon
);
/* magics_template_parser( magics_node ); */
/* results_template_parser(results_node, varname ); */
...
...
@@ -309,7 +307,7 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
if
(
COLOUR_MAX
)
mag_setc
(
"contour_shade_max_level_colour"
,
COLOUR_MAX
);
if
(
INTERVAL
!=
8
.
0
f
)
if
(
IS_NOT_EQUAL
(
INTERVAL
,
8
.
0
f
)
)
{
mag_setc
(
"contour_level_selection_type"
,
"INTERVAL"
);
mag_setr
(
"contour_interval"
,
INTERVAL
);
...
...
@@ -355,7 +353,7 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
if
(
DBG
)
{
mag_enqc
(
"output_name"
,
&
tempname
);
mag_enqc
(
"output_name"
,
(
char
*
)
&
tempname
);
fprintf
(
stderr
,
" SHADED Done %s!
\n
"
,
tempname
);
fprintf
(
stderr
,
" SHADED Done!
\n
"
);
}
...
...
@@ -400,7 +398,7 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
mag_setc
(
"contour_line_colour"
,
COLOUR
);
if
(
INTERVAL
!=
8
.
0
f
)
if
(
IS_NOT_EQUAL
(
INTERVAL
,
8
.
0
f
)
)
{
mag_setc
(
"contour_level_selection_type"
,
"INTERVAL"
);
mag_setr
(
"contour_interval"
,
INTERVAL
);
...
...
@@ -484,7 +482,7 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
if
(
COLOUR_MAX
)
mag_setc
(
"contour_shade_max_level_colour"
,
COLOUR_MAX
);
if
(
INTERVAL
!=
8
.
0
f
)
if
(
IS_NOT_EQUAL
(
INTERVAL
,
8
.
0
f
)
)
{
mag_setc
(
"contour_level_selection_type"
,
"INTERVAL"
);
mag_setr
(
"contour_interval"
,
INTERVAL
);
...
...
@@ -508,7 +506,7 @@ void magplot( const char *plotfile, int operatorID, const char *varname, const c
mag_set1c
(
"contour_shade_colour_list"
,(
const
char
**
)
USR_COLOUR_TABLE
,
USR_COLOUR_COUNT
);
}
if
(
RESOLUTION
!=
10
.
0
f
)
if
(
IS_NOT_EQUAL
(
RESOLUTION
,
10
.
0
f
)
)
mag_setr
(
"contour_shade_cell_resolution"
,
RESOLUTION
);
if
(
COLOUR_TRIAD
)
...
...
@@ -585,63 +583,44 @@ void quit_MAGICS( )
void
*
Magplot
(
void
*
argument
)
{
int
operatorID
;
int
varID
,
recID
;
int
gridsize
;
int
gridID
;
int
nrecs
;
int
levelID
;
int
tsID
;
int
streamID
;
int
vlistID
;
int
nmiss
;
int
nlon
,
nlat
;
int
nlev
;
int
zaxisID
,
taxisID
;
int
vdate
,
vtime
;
int
nparam
=
0
;
int
i
;
char
**
pnames
=
NULL
;
char
varname
[
CDI_MAX_NAME
];
double
missval
;
double
*
array
=
NULL
;
double
*
grid_center_lat
=
NULL
,
*
grid_center_lon
=
NULL
;
char
units
[
CDI_MAX_NAME
];
char
vdatestr
[
32
],
vtimestr
[
32
],
datetimestr
[
64
];
cdoInitialize
(
argument
);
int
nparam
=
operatorArgc
();
char
**
pnames
=
operatorArgv
();
nparam
=
operatorArgc
();
pnames
=
operatorArgv
();
CONTOUR
=
cdoOperatorAdd
(
"contour"
,
0
,
0
,
NULL
);
SHADED
=
cdoOperatorAdd
(
"shaded"
,
0
,
0
,
NULL
);
GRFILL
=
cdoOperatorAdd
(
"grfill"
,
0
,
0
,
NULL
);
int
CONTOUR
=
cdoOperatorAdd
(
"contour"
,
0
,
0
,
NULL
);
int
SHADED
=
cdoOperatorAdd
(
"shaded"
,
0
,
0
,
NULL
);
int
GRFILL
=
cdoOperatorAdd
(
"grfill"
,
0
,
0
,
NULL
);
operatorID
=
cdoOperatorID
();
int
operatorID
=
cdoOperatorID
();
if
(
nparam
)
{
if
(
DBG
)
{
for
(
i
=
0
;
i
<
nparam
;
i
++
)
for
(
int
i
=
0
;
i
<
nparam
;
i
++
)
fprintf
(
stderr
,
"Param %d is %s!
\n
"
,
i
+
1
,
pnames
[
i
]
);
}
VerifyPlotParameters
(
nparam
,
pnames
,
operatorID
);
}
streamID
=
streamOpenRead
(
cdoStreamName
(
0
));
int
streamID
=
streamOpenRead
(
cdoStreamName
(
0
));
vlistID
=
streamInqVlist
(
streamID
);
taxisID
=
vlistInqTaxis
(
vlistID
);
int
vlistID
=
streamInqVlist
(
streamID
);
int
taxisID
=
vlistInqTaxis
(
vlistID
);
varID
=
0
;
gridID
=
vlistInqVarGrid
(
vlistID
,
varID
);
zaxisID
=
vlistInqVarZaxis
(
vlistID
,
varID
);
missval
=
vlistInqVarMissval
(
vlistID
,
varID
);
int
varID
=
0
;
int
gridID
=
vlistInqVarGrid
(
vlistID
,
varID
);
// int
zaxisID = vlistInqVarZaxis(vlistID, varID);
// double
missval = vlistInqVarMissval(vlistID, varID);
if
(
gridInqType
(
gridID
)
==
GRID_GME
)
cdoAbort
(
"GME grid unspported!"
);
if
(
gridInqType
(
gridID
)
==
GRID_UNSTRUCTURED
)
cdoAbort
(
"Unstructured grid unspported!"
);
...
...
@@ -649,14 +628,14 @@ void *Magplot(void *argument)
if
(
gridInqType
(
gridID
)
!=
GRID_CURVILINEAR
)
gridID
=
gridToCurvilinear
(
gridID
,
1
);
gridsize
=
gridInqSize
(
gridID
);
nlon
=
gridInqXsize
(
gridID
);
nlat
=
gridInqYsize
(
gridID
);
nlev
=
zaxisInqSize
(
zaxisID
);
int
gridsize
=
gridInqSize
(
gridID
);
int
nlon
=
gridInqXsize
(
gridID
);
int
nlat
=
gridInqYsize
(
gridID
);
//int
nlev = zaxisInqSize(zaxisID);
array
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
grid_center_lat
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
grid_center_lon
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
double
*
array
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
double
*
grid_center_lat
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
double
*
grid_center_lon
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
gridInqYvals
(
gridID
,
grid_center_lat
);
gridInqXvals
(
gridID
,
grid_center_lon
);
...
...
@@ -667,7 +646,7 @@ void *Magplot(void *argument)
gridInqYunits
(
gridID
,
units
);
grid_to_degree
(
units
,
gridsize
,
grid_center_lat
,
"grid center lat"
);
tsID
=
0
;
int
tsID
=
0
;
/* HARDCODED THE FILE NAME .. TO BE SENT AS COMMAND LINE ARGUMENT FOR THE MAGICS OPERATOR */
/*
...
...
@@ -716,8 +695,8 @@ void *Magplot(void *argument)
}
}
vdate
=
taxisInqVdate
(
taxisID
);
vtime
=
taxisInqVtime
(
taxisID
);
int
vdate
=
taxisInqVdate
(
taxisID
);
int
vtime
=
taxisInqVtime
(
taxisID