Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
9b97c4ad
Commit
9b97c4ad
authored
Jan 20, 2010
by
Uwe Schulzweida
Browse files
Merstat: added support for generic grids
parent
b0c5b850
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
9b97c4ad
2010-01-20 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Zonstat: added support for generic grids
* Merstat: added support for generic grids
2010-01-14 Frank Kaspar <Frank.Kaspar@dwd.de>
* import_cmsaf: added more corrections for wrong projection parameter
...
...
src/Merstat.c
View file @
9b97c4ad
...
...
@@ -44,7 +44,7 @@ void *Merstat(void *argument)
int
operfunc
;
int
streamID1
,
streamID2
;
int
vlistID1
,
vlistID2
;
int
gridID1
,
gridID2
,
lastgrid
=
-
1
;
int
gridID1
,
gridID2
=
-
1
,
lastgrid
=
-
1
;
int
wstatus
=
FALSE
;
int
code
=
0
,
oldcode
=
0
;
int
nlonmax
;
...
...
@@ -111,11 +111,18 @@ void *Merstat(void *argument)
index
=
0
;
gridID1
=
vlistGrid
(
vlistID1
,
index
);
if
(
gridInqType
(
gridID1
)
!=
GRID_LONLAT
&&
gridInqType
(
gridID1
)
!=
GRID_GAUSSIAN
)
cdoAbort
(
"Unsupported gridtype: %s"
,
gridNamePtr
(
gridInqType
(
gridID1
)));
gridID2
=
gridToMeridional
(
gridID1
);
if
(
gridInqType
(
gridID1
)
==
GRID_LONLAT
||
gridInqType
(
gridID1
)
==
GRID_GAUSSIAN
||
gridInqType
(
gridID1
)
==
GRID_GENERIC
)
{
gridID2
=
gridToMeridional
(
gridID1
);
}
else
{
cdoAbort
(
"Unsupported gridtype: %s"
,
gridNamePtr
(
gridInqType
(
gridID1
)));
}
vlistChangeGridIndex
(
vlistID2
,
index
,
gridID2
);
streamID2
=
streamOpenWrite
(
cdoStreamName
(
1
),
cdoFiletype
());
...
...
src/Zonstat.c
View file @
9b97c4ad
...
...
@@ -44,7 +44,7 @@ void *Zonstat(void *argument)
int
operfunc
;
int
streamID1
,
streamID2
;
int
vlistID1
,
vlistID2
;
int
gridID1
,
gridID2
;
int
gridID1
,
gridID2
=
-
1
;
int
nlatmax
;
int
index
,
ngrids
;
int
recID
,
nrecs
;
...
...
@@ -105,12 +105,17 @@ void *Zonstat(void *argument)
index
=
0
;
gridID1
=
vlistGrid
(
vlistID1
,
index
);
if
(
gridInqType
(
gridID1
)
!=
GRID_LONLAT
&&
gridInqType
(
gridID1
)
!=
GRID_GAUSSIAN
&&
!
(
gridInqType
(
gridID1
)
==
GRID_GENERIC
&&
gridInqYsize
(
gridID1
)
>
1
)
)
cdoAbort
(
"Unsupported gridtype: %s"
,
gridNamePtr
(
gridInqType
(
gridID1
)));
if
(
gridInqType
(
gridID1
)
==
GRID_LONLAT
||
gridInqType
(
gridID1
)
==
GRID_GAUSSIAN
||
gridInqType
(
gridID1
)
==
GRID_GENERIC
)
{
gridID2
=
gridToZonal
(
gridID1
);
}
else
{
cdoAbort
(
"Unsupported gridtype: %s"
,
gridNamePtr
(
gridInqType
(
gridID1
)));
}
gridID2
=
gridToZonal
(
gridID1
);
for
(
index
=
0
;
index
<
ngrids
;
index
++
)
vlistChangeGridIndex
(
vlistID2
,
index
,
gridID2
);
...
...
src/grid.c
View file @
9b97c4ad
...
...
@@ -68,13 +68,9 @@ int gridToZonal(int gridID1)
gridsize
=
gridInqYsize
(
gridID1
);
gridID2
=
gridCreate
(
gridtype
,
gridsize
);
if
(
gridtype
!=
GRID_LONLAT
&&
gridtype
!=
GRID_GAUSSIAN
&&
(
gridtype
==
GRID_GENERIC
&&
gridsize
<=
1
)
)
{
Error
(
func
,
"Gridtype %s unsupported!"
,
gridNamePtr
(
gridtype
));
}
else
if
(
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_GAUSSIAN
||
gridtype
==
GRID_GENERIC
)
{
gridDefXsize
(
gridID2
,
1
);
gridDefYsize
(
gridID2
,
gridsize
);
...
...
@@ -91,6 +87,10 @@ int gridToZonal(int gridID1)
free
(
yvals
);
}
}
else
{
Error
(
func
,
"Gridtype %s unsupported!"
,
gridNamePtr
(
gridtype
));
}
return
(
gridID2
);
}
...
...
@@ -108,29 +108,28 @@ int gridToMeridional(int gridID1)
gridsize
=
gridInqXsize
(
gridID1
);
gridID2
=
gridCreate
(
gridtype
,
gridsize
);
switch
(
gridtype
)
if
(
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_GAUSSIAN
||
gridtype
==
GRID_GENERIC
)
{
case
GRID_LONLAT
:
case
GRID_GAUSSIAN
:
{
gridDefXsize
(
gridID2
,
gridsize
);
gridDefYsize
(
gridID2
,
1
);
gridDefXsize
(
gridID2
,
gridsize
);
gridDefYsize
(
gridID2
,
1
);
xvals
=
(
double
*
)
malloc
(
gridsize
*
sizeof
(
double
));
if
(
gridInqXvals
(
gridID1
,
NULL
)
)
{
xvals
=
(
double
*
)
malloc
(
gridsize
*
sizeof
(
double
));
gridInqXvals
(
gridID1
,
xvals
);
gridDefXvals
(
gridID2
,
xvals
);
gridDefYvals
(
gridID2
,
&
yval
);
gridInqXvals
(
gridID1
,
xvals
);
gridDefXvals
(
gridID2
,
xvals
);
free
(
xvals
);
free
(
xvals
);
}
break
;
}
default:
{
Error
(
func
,
"Gridtype %s unsupported!"
,
gridNamePtr
(
gridtype
));
break
;
}
gridDefYvals
(
gridID2
,
&
yval
);
}
else
{
Error
(
func
,
"Gridtype %s unsupported!"
,
gridNamePtr
(
gridtype
));
}
return
(
gridID2
);
...
...
@@ -1319,18 +1318,18 @@ int gridWeights(int gridID, double *grid_wgts)
}
else
{
if
(
gridtype
!
=
GRID_LONLAT
&&
gridtype
!
=
GRID_GAUSSIAN
&&
gridtype
!
=
GRID_LCC
&&
gridtype
!
=
GRID_GME
&&
gridtype
!
=
GRID_CURVILINEAR
&&
gridtype
!
=
GRID_CELL
)
if
(
gridtype
=
=
GRID_LONLAT
||
gridtype
=
=
GRID_GAUSSIAN
||
gridtype
=
=
GRID_LCC
||
gridtype
=
=
GRID_GME
||
gridtype
=
=
GRID_CURVILINEAR
||
gridtype
=
=
GRID_CELL
)
{
a_status
=
1
;
a_status
=
gridGenArea
(
gridID
,
grid_area
)
;
}
else
{
a_status
=
gridGenArea
(
gridID
,
grid_area
)
;
a_status
=
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment