A hard disk drive that calculates an environmental condition, such as altitude, without a sensor. The disk drive includes a temperature sensor that senses a disk drive temperature and a humidity sensor that senses drive humidity. A controller of the disk drive determines whether a variation in a flying height of a head is due to a change in temperature and/or a change in humidity. If not, the controller calculates a change in altitude based on a difference between an estimated variation in flying height and the actual variation in flying height. The new calculated altitude can be used to vary disk drive operating parameters such as write parameters of the heads.