Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null values exist in some regions of the North #546

Open
yheng0821 opened this issue Apr 4, 2024 · 1 comment
Open

Null values exist in some regions of the North #546

yheng0821 opened this issue Apr 4, 2024 · 1 comment

Comments

@yheng0821
Copy link

yheng0821 commented Apr 4, 2024

Describe the bug

When I use the average temperature to calculate potential evapotranspiration, there are nulls in some areas in the north, even though the average temperature does not have a null in that location

To Reproduce

temperature:https://crudata.uea.ac.uk/cru/data/hrg/cru_ts_4.07/cruts.2304141047.v4.07/tmp/cru_ts4.07.2011.2020.tmp.dat.nc.gz
Since the data dimension of the CRU is (time, lat, lon), I performed the following operation:

import numpy as np
import xarray as xr
import netCDF4 as nc
import matplotlib.pyplot as plt

# Original files downloaded from the website
file = xr.open_dataset('cru_ts4.07.2011.2020.tmp.dat.nc.nc')

# Convert the data dimensions to ('lat', 'lon', 'time') and set the units to celsius (original units are degrees Celsius)
file['tmp'].attrs['units'] = 'celsius'
file['tmp'] = file['tmp'].transpose('lat', 'lon', 'time')
file.to_netcdf('tmp_lat_lon_time.nc')

# visualization
tmp = xr.open_dataset('tmp_lat_lon_time.nc')['tmp']
plt.imshow(tmp[::-1, :, 10])

image
Currently it looks like there are no exception nulls in the red box

Next, we begin to calculate the pet

process_climate_indices --index pet --periodicity monthly --netcdf_temp tmp_lat_lon_time.nc --var_name_temp tmp --output_file_base out/ --multiprocessing all_but_one

When the calculation is complete, read the pet file and again randomly visualize the values for one day

# visualization of the pet
pet = xr.open_dataset('out/_pet_thornthwaite.nc')['pet_thornthwaite']
plt.imshow(pet[::-1, :, 10])

image

Null values in the same places.

Desktop (please complete the following information):

  • OS: Win1064
  • climate-indices:2.0.0
  • numpy: 1.25.2
  • xarray:2013.1.0
  • matplotlib:3.8.3
  • netCDF4:1.6.5

I notice the CRU lats are [-89.75 -89.25 -88.75 -88.25 ... 88.75 89.25 89.75],lons are [-179.8 -179.2 -178.8 -178.2 ... 178.8 179.2 179.8].I don't understand why there are null values here, could it have something to do with the way pet is calculated?

@monocongo
Copy link
Owner

@yheng0821 Yes, Thornthwaite's algorithm for calculating potential evapotranspiration (PET) has limitations based on latitude because it relies heavily on temperature data and day length, which are influenced by latitude. Typically, the algorithm is most reliable between 20° and 55° latitude. Beyond these limits, especially in polar regions, the method becomes less accurate due to extreme variations in day length and temperature, which are not well accounted for in the model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants