ARCCSS-extremes / climpact

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

problems with threshold calculation #76

Open JinZarrin opened 3 years ago

JinZarrin commented 3 years ago

Dear developer, thanks for your kindness to supply me that convenient package to do my research. However, when I use my CMIP data to do the threshold calculation, it doesn't work and shows the error like the attached screenshot. I do not know how to solve it, what I want to get is just the precipitation-based indices, I'm not sure whether it is the reason that I do not supply the temperature data. Could you please kindly help me out?

截屏2021-04-30 上午12 35 38

heroldn commented 3 years ago

Try create the output folder you've specified before running the script. Something we should add in so the user doesn't have to do.

On 01/05/2021 01:56 JinZarrin ***@***.***> wrote:

Dear developer, thanks for your kindness to supply me that convenient package to do my research. However, when I use my CMIP data to do the threshold calculation, it doesn't work and shows the error like the attached screenshot. I do not know how to solve it, what I want to get is just the precipitation-based indices, I'm not sure whether it is the reason that I do not supply the temperature data. Could you please kindly help me out?

[截屏2021-04-30 上午12 35 38] https://user-images.githubusercontent.com/81920359/116721168-4275b480-a99a-11eb-96e7-eed07bed88d7.png

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/ARCCSS-extremes/climpact/issues/76 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAMODBHCDG4ZX6LPBWTTLLHKTANCNFSM434RD4IQ .
JinZarrin commented 3 years ago

Try create the output folder you've specified before running the script. Something we should add in so the user doesn't have to do. On 01/05/2021 01:56 JinZarrin @.***> wrote: Dear developer, thanks for your kindness to supply me that convenient package to do my research. However, when I use my CMIP data to do the threshold calculation, it doesn't work and shows the error like the attached screenshot. I do not know how to solve it, what I want to get is just the precipitation-based indices, I'm not sure whether it is the reason that I do not supply the temperature data. Could you please kindly help me out? [截屏2021-04-30 上午12 35 38] https://user-images.githubusercontent.com/81920359/116721168-4275b480-a99a-11eb-96e7-eed07bed88d7.png — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub #76 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAMODBHCDG4ZX6LPBWTTLLHKTANCNFSM434RD4IQ .

So that means I need to rewrite the code of "climpact.ncdf.thresholds.wrapper.r" to add a function for output folder creating? And can I ask when you will add in this function for download?

heroldn commented 3 years ago

You can just create the folder manually. So if you're writing the output to ./www/outputdata/ just make sure that folder already exists. But yes you could add a line to the script to do that for you.

On 01/05/2021 09:38 JinZarrin ***@***.***> wrote:

    > > 
    Try create the output folder you've specified before running the script. Something we should add in so the user doesn't have to do.
    …
    On 01/05/2021 01:56 JinZarrin @.***> wrote: Dear developer, thanks for your kindness to supply me that convenient package to do my research. However, when I use my CMIP data to do the threshold calculation, it doesn't work and shows the error like the attached screenshot. I do not know how to solve it, what I want to get is just the precipitation-based indices, I'm not sure whether it is the reason that I do not supply the temperature data. Could you please kindly help me out? [截屏2021-04-30 上午12 35 38] https://user-images.githubusercontent.com/81920359/116721168-4275b480-a99a-11eb-96e7-eed07bed88d7.png — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub #76 https://github.com/ARCCSS-extremes/climpact/issues/76 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAMODBHCDG4ZX6LPBWTTLLHKTANCNFSM434RD4IQ .

> 

So that means I need to rewrite the code of "climpact.ncdf.thresholds.wrapper.r" to add a function for output folder creating? And can I ask when you will add in this function for download?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/ARCCSS-extremes/climpact/issues/76#issuecomment-830461331 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAO3FYUUXHNCV6426L3TLM5PRANCNFSM434RD4IQ .
JinZarrin commented 3 years ago

You can just create the folder manually. So if you're writing the output to ./www/outputdata/ just make sure that folder already exists. But yes you could add a line to the script to do that for you. On 01/05/2021 09:38 JinZarrin @.> wrote: > > > Try create the output folder you've specified before running the script. Something we should add in so the user doesn't have to do. > … > On 01/05/2021 01:56 JinZarrin @.> wrote: Dear developer, thanks for your kindness to supply me that convenient package to do my research. However, when I use my CMIP data to do the threshold calculation, it doesn't work and shows the error like the attached screenshot. I do not know how to solve it, what I want to get is just the precipitation-based indices, I'm not sure whether it is the reason that I do not supply the temperature data. Could you please kindly help me out? [截屏2021-04-30 上午12 35 38] https://user-images.githubusercontent.com/81920359/116721168-4275b480-a99a-11eb-96e7-eed07bed88d7.png — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub #76 #76 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAMODBHCDG4ZX6LPBWTTLLHKTANCNFSM434RD4IQ . > > > So that means I need to rewrite the code of "climpact.ncdf.thresholds.wrapper.r" to add a function for output folder creating? And can I ask when you will add in this function for download? — You are receiving this because you commented. Reply to this email directly, view it on GitHub #76 (comment) , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAO3FYUUXHNCV6426L3TLM5PRANCNFSM434RD4IQ .

Thanks for your reply, that is what I did before the calculation. I first created a folder named "thresholds" on the desk and then copied its path to the code. When I run the code for the first time, it shows "Error in y[[d$q.path]] : no such index at level 1". And I ran the same code for the second time, it showed "Error in ncdf4::nc_create(thresholds.file, all.vars, force_v4 = TRUE) : Error in nc_create!"

Please kindly see the attached file. Note Apr 30, 2021 (2).pdf

heroldn commented 3 years ago

can you try write the file to the same directory as the script (ie. don't have a directory path in output.file) just to confirm this is to do with writing.

JinZarrin commented 3 years ago

can you try write the file to the same directory as the script (ie. don't have a directory path in output.file) just to confirm this is to do with writing.

I tried several times, and I figured out that with the first error "Error in y[[d$q.path]] : no such index at level 1", it just because I did not supply the tmax and tmin data. With the second error "Error in ncdf4::nc_create(thresholds.file, all.vars, force_v4 = TRUE) : Error in nc_create!", which is because of the existed nc.file created last time, the newly auto-created file not cover it. Now the question is how can I only calculate the precipitation-based thresholds? Because what I want to focus is just the extreme precipitation, and I do not have a downloded temperature data? Can you please give me some kind suggestions?

heroldn commented 3 years ago

Ok, a temporary workaround may be to simply copy your precip variable into two new fake tmax and tmin variables and feed that into the thresholds script. Let me know if that works.

On 01/05/2021 14:52 JinZarrin ***@***.***> wrote:

    > > 
    can you try write the file to the same directory as the script (ie. don't have a directory path in output.file) just to confirm this is to do with writing.

> 

I tried several times, and I figured out that with the first error "Error in y[[d$q.path]] : no such index at level 1", it just because I did not supply the tmax and tmin data. With the second error "Error in ncdf4::nc_create(thresholds.file, all.vars, force_v4 = TRUE) : Error in nc_create!", which is because of the existed nc.file created last time, the newly auto-created file not cover it. Now the question is how can I only calculate the precipitation-based thresholds? Because what I want to focus is just the extreme precipitation, and I do not have a downloded temperature data? Can you please give me some kind suggestions?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/ARCCSS-extremes/climpact/issues/76#issuecomment-830537702 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FANDYX2U5BJSA6LSK6DTLOCJJANCNFSM434RD4IQ .
JinZarrin commented 3 years ago

Ok, a temporary workaround may be to simply copy your precip variable into two new fake tmax and tmin variables and feed that into the thresholds script. Let me know if that works. On 01/05/2021 14:52 JinZarrin @.***> wrote: > > > can you try write the file to the same directory as the script (ie. don't have a directory path in output.file) just to confirm this is to do with writing. > > > I tried several times, and I figured out that with the first error "Error in y[[d$q.path]] : no such index at level 1", it just because I did not supply the tmax and tmin data. With the second error "Error in ncdf4::nc_create(thresholds.file, all.vars, force_v4 = TRUE) : Error in nc_create!", which is because of the existed nc.file created last time, the newly auto-created file not cover it. Now the question is how can I only calculate the precipitation-based thresholds? Because what I want to focus is just the extreme precipitation, and I do not have a downloded temperature data? Can you please give me some kind suggestions? — You are receiving this because you commented. Reply to this email directly, view it on GitHub #76 (comment) , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FANDYX2U5BJSA6LSK6DTLOCJJANCNFSM434RD4IQ .

Yeah, I tried it before, but it told me that the unit of precipitation can not convert to degree.

heroldn commented 3 years ago

you can use ncatted command to change the units. The examples section here should show how. https://linux.die.net/man/1/ncatted

On 01/05/2021 16:24 JinZarrin ***@***.***> wrote:

    > > 
    Ok, a temporary workaround may be to simply copy your precip variable into two new fake tmax and tmin variables and feed that into the thresholds script. Let me know if that works.
    …
    On 01/05/2021 14:52 JinZarrin @.***> wrote: > > > can you try write the file to the same directory as the script (ie. don't have a directory path in output.file) just to confirm this is to do with writing. > > > I tried several times, and I figured out that with the first error "Error in y[[d$q.path]] : no such index at level 1", it just because I did not supply the tmax and tmin data. With the second error "Error in ncdf4::nc_create(thresholds.file, all.vars, force_v4 = TRUE) : Error in nc_create!", which is because of the existed nc.file created last time, the newly auto-created file not cover it. Now the question is how can I only calculate the precipitation-based thresholds? Because what I want to focus is just the extreme precipitation, and I do not have a downloded temperature data? Can you please give me some kind suggestions? — You are receiving this because you commented. Reply to this email directly, view it on GitHub #76 (comment) https://github.com/ARCCSS-extremes/climpact/issues/76#issuecomment-830537702 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FANDYX2U5BJSA6LSK6DTLOCJJANCNFSM434RD4IQ .

> 

Yeah, I tried it before, but it told me that the unit of precipitation can not convert to degree.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/ARCCSS-extremes/climpact/issues/76#issuecomment-830563133 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAKMKCYFD7W7NSOYYEDTLONDHANCNFSM434RD4IQ .
JinZarrin commented 3 years ago

you can use ncatted command to change the units. The examples section here should show how. https://linux.die.net/man/1/ncatted On 01/05/2021 16:24 JinZarrin @.> wrote: > > > Ok, a temporary workaround may be to simply copy your precip variable into two new fake tmax and tmin variables and feed that into the thresholds script. Let me know if that works. > … > On 01/05/2021 14:52 JinZarrin @.> wrote: > > > can you try write the file to the same directory as the script (ie. don't have a directory path in output.file) just to confirm this is to do with writing. > > > I tried several times, and I figured out that with the first error "Error in y[[d$q.path]] : no such index at level 1", it just because I did not supply the tmax and tmin data. With the second error "Error in ncdf4::nc_create(thresholds.file, all.vars, force_v4 = TRUE) : Error in nc_create!", which is because of the existed nc.file created last time, the newly auto-created file not cover it. Now the question is how can I only calculate the precipitation-based thresholds? Because what I want to focus is just the extreme precipitation, and I do not have a downloded temperature data? Can you please give me some kind suggestions? — You are receiving this because you commented. Reply to this email directly, view it on GitHub #76 (comment) #76 (comment) , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FANDYX2U5BJSA6LSK6DTLOCJJANCNFSM434RD4IQ . > > > Yeah, I tried it before, but it told me that the unit of precipitation can not convert to degree. — You are receiving this because you commented. Reply to this email directly, view it on GitHub #76 (comment) , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW3FAKMKCYFD7W7NSOYYEDTLONDHANCNFSM434RD4IQ .

I copied a precipitation nc file, then NCO was used to rename the variable to "tasmax" and rewrite the unit to "K", I set I copied a precipitation nc file, then used NCO to rename the variable to "tasmax" and rewrite the unit to "K". Hopely, this fake temperature nc file works well in the thresholds script after setting "vars=c(tmax="tasmax", tmin="tasmax", prec="pr")". Thanks for your time and help.