It looks like you are using the code from this tutorial
Are you certain there is a reed switch(and not a hall sensor) in the anemometer. Is your reed switch wired like shown in the tutorial Step 1.
Have you confirmed Step 4, that you can indeed read 0 and 1023 as you turn the anemometer.