AusClimateService/indices

lon bnds selection on ERA5 data is not working properly

Closed this issue · 5 comments

ngben commented

I am trying to calculate indices in ERA5 using rt52 data and the whole BARPA domain (54S-14N, 88E-208E). If I put these lat lon bounds into run_icclim.py the output domain is not correct. I also tried lon_bnds 88.0 -152.0 which gives the same result. Could this issue be caused by ERA5 being split at 180 and spanning -180/180?

ncdump -c era5_rt52/GLO-r025/none/ERA5/historical/none/none/v1/climdex/tx/tx_GLO-r025_ERA5_historical_v1_year_19950101-20141231.nc output gives the following (cut for clarity):

/g/data/xv83/bxn599/ACS/data/era5/raw_test/mx2t/mx2t_era5_oper_sfc_20220701-20220731.nc --variable mx2t --lat_bnds -54.0 14.0 --lon_bnds 88.0 208.0 --time_agg max --hshift --drop_time_bounds tx /g/data/xv83/bxn599/ACS/icclim_indices/era5_rt52/GLO-r025/none/ERA5/historical/none/none/v1/climdex/tx/tx_GLO-r025_ERA5_historical_v1_year_19950101-20141231.nc"

lon = -180, -179.75, -179.5, -179.25, -179, -178.75, -178.5, -178.25, -178, -177.75, -177.5, -177.25, -177, -176.75, -176.5, -176.25, -176, -175.75, -175.5, -175.25, -175, -174.75, -174.5, -174.25, -174, -173.75, -173.5, -173.25, -173, -172.75, -172.5, -172.25, -172, -171.75, -171.5, -171.25, -171, -170.75, -170.5, -170.25, -170, -169.75, -169.5, -169.25, -169, -168.75, -168.5, -168.25, -168, -167.75, -167.5, -167.25, -167, -166.75, -166.5, -166.25, -166, -165.75, -165.5, -165.25, -165, -164.75, -164.5, -164.25, -164, -163.75, -163.5, -163.25, -163, -162.75, -162.5, -162.25, -162, -161.75, -161.5, -161.25, -161, -160.75, -160.5, -160.25, -160, -159.75, -159.5, -159.25, -159, -158.75, -158.5, -158.25, -158, -157.75, -157.5, -157.25, -157, -156.75, -156.5, -156.25, -156, -155.75, -155.5, -155.25, -155, -154.75, -154.5, -154.25, -154, -153.75, -153.5, -153.25, -153, -152.75, -152.5, -152.25, 88.25, 88.5, 88.75, 89, 89.25, 89.5, 89.75, 90, 90.25, 90.5, 90.75, 91, 91.25, 91.5, 91.75, 92, 92.25, 92.5, 92.75, 93, 93.25, 93.5, 93.75, 94, 94.25, 94.5, 94.75, 95, 95.25, 95.5, 95.75, 96, 96.25, 96.5, 96.75, 97, 97.25, 97.5, 97.75, 98, 98.25, 98.5, 98.75, 99, 99.25, 99.5, 99.75, 100, 100.25, 100.5, 100.75, 101, 101.25, 101.5, 101.75, 102, 102.25, 102.5, 102.75, 103, 103.25, 103.5, 103.75, 104, 104.25, 104.5, 104.75, 105, 105.25, 105.5, 105.75, 106, 106.25, 106.5, 106.75, 107, 107.25, 107.5, 107.75, 108, 108.25, 108.5, 108.75, 109, 109.25, 109.5, 109.75, 110, 110.25, 110.5, 110.75, 111, 111.25, 111.5, 111.75, 112, 112.25, 112.5, 112.75, 113, 113.25, 113.5, 113.75, 114, 114.25, 114.5, 114.75, 115, 115.25, 115.5, 115.75, 116, 116.25, 116.5, 116.75, 117, 117.25, 117.5, 117.75, 118, 118.25, 118.5, 118.75, 119, 119.25, 119.5, 119.75, 120, 120.25, 120.5, 120.75, 121, 121.25, 121.5, 121.75, 122, 122.25, 122.5, 122.75, 123, 123.25, 123.5, 123.75, 124, 124.25, 124.5, 124.75, 125, 125.25, 125.5, 125.75, 126, 126.25, 126.5, 126.75, 127, 127.25, 127.5, 127.75, 128, 128.25, 128.5, 128.75, 129, 129.25, 129.5, 129.75, 130, 130.25, 130.5, 130.75, 131, 131.25, 131.5, 131.75, 132, 132.25, 132.5, 132.75, 133, 133.25, 133.5, 133.75, 134, 134.25, 134.5, 134.75, 135, 135.25, 135.5, 135.75, 136, 136.25, 136.5, 136.75, 137, 137.25, 137.5, 137.75, 138, 138.25, 138.5, 138.75, 139, 139.25, 139.5, 139.75, 140, 140.25, 140.5, 140.75, 141, 141.25, 141.5, 141.75, 142, 142.25, 142.5, 142.75, 143, 143.25, 143.5, 143.75, 144, 144.25, 144.5, 144.75, 145, 145.25, 145.5, 145.75, 146, 146.25, 146.5, 146.75, 147, 147.25, 147.5, 147.75, 148, 148.25, 148.5, 148.75, 149, 149.25, 149.5, 149.75, 150, 150.25, 150.5, 150.75, 151, 151.25, 151.5, 151.75, 152, 152.25, 152.5, 152.75, 153, 153.25, 153.5, 153.75, 154, 154.25, 154.5, 154.75, 155, 155.25, 155.5, 155.75, 156, 156.25, 156.5, 156.75, 157, 157.25, 157.5, 157.75, 158, 158.25, 158.5, 158.75, 159, 159.25, 159.5, 159.75, 160, 160.25, 160.5, 160.75, 161, 161.25, 161.5, 161.75, 162, 162.25, 162.5, 162.75, 163, 163.25, 163.5, 163.75, 164, 164.25, 164.5, 164.75, 165, 165.25, 165.5, 165.75, 166, 166.25, 166.5, 166.75, 167, 167.25, 167.5, 167.75, 168, 168.25, 168.5, 168.75, 169, 169.25, 169.5, 169.75, 170, 170.25, 170.5, 170.75, 171, 171.25, 171.5, 171.75, 172, 172.25, 172.5, 172.75, 173, 173.25, 173.5, 173.75, 174, 174.25, 174.5, 174.75, 175, 175.25, 175.5, 175.75, 176, 176.25, 176.5, 176.75, 177, 177.25, 177.5, 177.75, 178, 178.25, 178.5, 178.75, 179, 179.25, 179.5, 179.75 ;

At the moment the script selects the desired grid points (which it looks like it has done correctly), but it leaves the longitude axis the same as the input file (e.g. if the input file is -180 to 180, it will stick with that).

Would you prefer the script to change the output data so the longitude axis is 0 to 360 in this case to avoid a big jump (e.g. from -152.25 to 88.25) in longitude axis values?

ngben commented

I think it would be best to change to 0 to 360 to avoid the jump. It'll make it easier (at least for me) when working with the output. Perhaps python can deal with it easily enough but I'm not sure about other software.

No problem - that's an easy fix.

@ngben - This should be fixed now: a95d2f2

I've basically added a little function avoid_cyclic that changes the longitude axis from -180 -> 180 to 0 -> 360 (or vice versa) if the requested lon_bnds cross over the end/cyclic point (e.g. like your 88E to 208E request crosses over the 180E end/cyclic point on a -180 to 180 longitude axis).

ngben commented

Thanks @DamienIrving! It seems to work fine, I'll close this issue now.