As Doug Lipinski mentioned you need to:
1) find the contour
2) compute the arc length.
Find the contour
To find the contour you can use Marching Squares, where you rewrite
$$f(x,y) = f_0 \Leftrightarrow f(x,y) - f_0 = 0 \enspace .$$
You assign a primitive to each individual cell (each 4 cells can be considered to be the corners of a bilinear interpolation, for example). Thus, you consider the sign of the values at vertices; intersections occur on edges with sign change. There are 16 options for this, although just 4 topologically different
- No crossing: 4 edges with same sign
- Singlet: 1 edge with different sign
- Double adjacent
- Double opposite
In the double opposite case might be some ambiguities and the sign of the saddle point should be computed.
As a last step you determine the position of intersection (using interpolation along grid edges).
Compute the arc length
You want to perform the numeric integration to obtain the arc length, i.e.,
$$s = \int_{a}^{b} \sqrt { [x'(t)]^2 + [y'(t)]^2 }\, dt. $$
where $t$ is a parameter for $x(t)$ and $y(t)$.
Since your input is the numerical data for $x$ and $y$, you can directly proceed with the numerical integration. The simplest case is to connect your points with lines and add all those segments
$$s \approx \sum_{k=1}^{N} \sqrt{ (x_{k} - x_{k-1})^2 + (y_{k} - y_{k-1})^2}$$
An example in Python
import numpy as np
def arc_length(x, y):
npts = len(x)
arc = np.sqrt((x[1] - x[0])**2 + (y[1] - y[0])**2)
for k in range(1, npts):
arc = arc + np.sqrt((x[k] - x[k-1])**2 + (y[k] - y[k-1])**2)
return arc
# Parabolic segment
npts = 1000
a = 3.
h = 5.
x = np.linspace(-a, a, npts)
y = h*(1 - x**2/a**2)
analytic = np.sqrt(a**2 + 4*h**2) + a**2/(2*h)*np.arcsinh(2*h/a)
numeric = arc_length(x, y)
print analytic, numeric
# Semicircle
npts = 1000
x = np.linspace(-1, 1, npts)
y = np.sqrt(1 - x**2)
analytic = np.pi
numeric = arc_length(x, y)
print analytic, numeric
With output
12.1673133338 12.1881924551
3.14159265359 3.20484351644
You can use higher order derivatives (interpolations or B-Splines, as suggested by Model_Math) for more accurate results, but the concept is the same.