ARCCSS-extremes / climpact

Calculate the ET-SCI climate extremes indices
GNU General Public License v3.0
48 stars 31 forks source link

Replacement has length zero ERROR #73

Open papecha opened 3 years ago

papecha commented 3 years ago

I have been trying to run some indices in climpact. After inputting the data and doing the quality check without any issues, I get the following error: replacement has length zero.

I followed the input data format instructions, below and example of the data:

2035 1 1 2.89799401081317 30.2150875999814 19.8415509905134 2035 1 2 2.52891992027539 30.3762683686756 19.8469264439174 2035 1 3 3.09308107368581 30.7897771926154 20.2718880789621 2035 1 4 5.19651662725664 30.3349272228423 20.0861886160715 2035 1 5 3.65224789815589 30.2943068731399 19.9605695452009 2035 1 6 2.62565375752664 30.0459519159226 19.7251395089286 2035 1 7 3.96472282117039 29.8333374023438 19.9244759695871 2035 1 8 4.67156036050125 29.8123006184896 19.8186875116257 2035 1 9 6.52078042205955 29.4209911528088 19.8531404041109 2035 1 10 3.94592474060898 29.5825817289807 19.7333487374442

heroldn commented 3 years ago

I suspect a function is falling over because of the data itself, not the format. Are you able to send a copy of the file?

papecha commented 3 years ago

@heroldn , yes thanks a lot. Here it is:

Dodoma_rcp85.txt

jujunjune-dev commented 3 years ago

Hi! I also having this error. By the way, is it possible to just check for precipitation indices?

D_1986-2005.txt

heroldn commented 3 years ago

Both, try again, I've added a check for when there are insufficient SPI/SPEI data to not calculate trends. Insufficient SPI/SPEI data also occurs when all values are zero (not just missing).

jujunjune-dev commented 3 years ago

Both, try again, I've added a check for when there are insufficient SPI/SPEI data to not calculate trends. Insufficient SPI/SPEI data also occurs when all values are zero (not just missing).

Thank you for looking into it. I tried but still having the same error.

jujunjune-dev commented 3 years ago

I tried to replace 0 with -99.9 but still facing the same error. May I know is it possible that I modify the data in order to avoid this error? What is the min. no of data require for SPI/SPEI?

heroldn commented 3 years ago

@jujunjune-dev I just tried your file and it worked for me. Are you using the online climpact and can you please take a screenshot?

heroldn commented 3 years ago

Same with yours @papecha, just tried your file at https://ccrc-extremes.shinyapps.io/climpact/ and it worked. Please take a screenshot if it's still not working for you.

carolinamarghidan commented 2 years ago

Hi, I get the same error using online climpact. When using offline climpact, the quality control works, but afterwards when I click on step 2, no lines are shown to fill in any user defined parameters.. Data is in the right format, but am only using temperature data so all precipitation values are -99.9. Would greatly appreciate any help... MaputoMZ.txt

heroldn commented 2 years ago

@carolinamarghidan a brief look at your QC data shows that you have a lot of missing data, and far more than climpact will accept:

Climpact permits a maximum of 3 missing days in any month, and a maximum of 15 missing days in any year. If any of these thresholds is exceeded then the month or year in question is not calculated. Further, if a month is missing then the corresponding year is also removed.

Climpact shouldn't crash like it does but I don't think it would generate any index output, see for example below from the QC data. All those red circles are missing days. image

carolinamarghidan commented 2 years ago

@heroldn thank you for your quick reply! I see, that was my worry as well.... then I will try to calculate the indices for this area using reanalysis data (era5-land), but also wanted to use this weather station. Perhaps I could still use this station data and perform simpler calculations in excell, rather than calculating the indices through climpact.

Thank you for the help!

heroldn commented 2 years ago

You can see what other stations might be available. And also check out climdex.org which has a subset of the climpact indices for stations (and gridded data based on stations). I don't know the purpose of your work but I might recommend starting there before resorting to reanalysis.

carolinamarghidan commented 2 years ago

@heroldn I am doing my MSc research on extreme heat events in Mozambique (at the ITC Faculty, University of Twente, in the Netherlands), focusing in particular on Maputo City. Very little is still known about such events in this context, so I am starting with an analysis on historical temp trends and heatwave characteristics, but unfortunately the station data contains so many gaps. I have one other station that is more complete, but there the time scale is only for 2018-2021.

I have checked the climdex.org indices for Maputo, but I think it would be better to do the analysis myself/ resorting to reanalysis - Do you think this would be complicated to calculate using climpact? Any other thoughts or resources are of course very much appreciated!

heroldn commented 2 years ago

There are remote sensing observations that could be used, generally speaking station data is much more reliable but if it doesn't exist (or is not complete as in your case) then I would look to remote sensing next (e.g. the CHIRTSdaily product for temperature, which uses remote sensing, reanalysis and station data I believe - but check). Obviously I'm not endorsing the use of any specific product, just giving very general advice. There are also daily precipitation datasets based on remote sensing but using this is more problematic than temperature (from either reanalysis or remote sensing) since the precipitation you're actually getting is an average over a whole grid cell, when you're in fact interested in a specific location - and precipitation can be highly spatially variable (temperature is more homogenous spatially so this is less of an issue).

Check out the UCARA climate data guide for lists of precip and temperature datasets.

On 23/12/2021 21:36 carolinamarghidan @.***> wrote:

@heroldn https://github.com/heroldn I am doing my MSc research on extreme heat events in Mozambique (at the ITC Faculty, University of Twente, in the Netherlands), focusing in particular on Maputo City. Very little is still known about such events in this context, so I am starting with an analysis on historical temp trends and heatwave characteristics, but unfortunately the station data contains so many gaps. I have one other station that is more complete, but there the time scale is only for 2018-2021.

I have checked the climdex.org indices for Maputo, but I think it would be better to do the analysis myself/ resorting to reanalysis - Do you think this would be complicated to calculate using climpact? Any other thoughts or resources are of course very much appreciated!

— Reply to this email directly, view it on GitHub https://github.com/ARCCSS-extremes/climpact/issues/73#issuecomment-1000223158 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAKE6VYJ2EXHY7DCTETUSL7ELANCNFSM43J37IAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you were mentioned.Message ID: @.***>

carolinamarghidan commented 2 years ago

Thank you - @heroldn! I have looked at the CHIRTSdaily product and it seems a more accurate dataset compared to ERA5 to calculate for extreme heat events across Africa (at least for 1983-2016). Thank you for pointing me towards this! I will try to use climpact with these .nc files. I am only calculating temperatures, so not looking at any precipitation data.