[ncl-talk] About Relative Humidity
Marston Johnston
shejo284 at gmail.com
Fri Sep 29 00:43:39 MDT 2017
Hi NCL users,
I’m a long-time programmer and have learned over the years that asking a question in a user forum requires some learning about what to do and what not to do. It takes some time to learn the does and don’t when asking a question as well as how to formulate a good question that will get a fast response from a lot of people.
Just because you have a question doesn’t mean you should ask it here in the NCL forum. Not all questions are questions for NCL. NCL is one of the best documented programming code out there. The users and developers are some of the best I’ve come across, which is why I try and read/answer questions when I can. But lately I’ve seen a series of questions that simply require the person to read the error message and/or exercise some good programming and debugging practices as well as reading the documentation in order to solve their problem. This is a part of programming – a part of good programming.
Below are some tips I borrowed from Stack Overflow on just this topic. I would strongly recommend NCL users – especially those new to programming to read these tips before posting a question in the future. I’ve done some editing to make more NCL specific. I’ve left some links that I think can help.
What topics can I ask about here?
The best NCL questions have a bit of source code in them and meta data of the variable with which you are having problems, but if your question generally covers…
a specific programming problem, or
a software algorithm, or
software tools commonly used by programmers; and is
a practical, answerable problem that is unique to software development
Please look around to see if your question has been asked before. It’s also OK to ask and answer your own question. Questions which are too broad, unclear, or incomplete are difficult to answer.
Some questions are still off-topic, even if they fit into one of the categories listed above:
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example.
Questions about a problem that can no longer be reproduced or that was caused by a simple typographical error. While similar questions may be on-topic here, these are often resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting.
Questions asking for work help must include a summary of the work you've done so far to solve the problem, and a description of the difficulty you are having solving it.
Questions about general computing hardware and software are off-topic for NCL unless they directly involve tools used primarily for programming.
Questions on professional server, networking, or related infrastructure administration are off-topic for NCL unless they directly involve programming or programming tools.
How do I ask a good question?
We’d love to help you. To improve your chances of getting an answer, here are some tips:
Search, and research
...and keep track of what you find. Even if you don't find a useful answer elsewhere on the site, including links to related questions that haven't helped can help others in understanding how your question is different from the rest.
Write a title that summarizes the specific problem
The title is the first thing potential answerers will see, and if your title isn't interesting, they won't read the rest. So, make it count:
Pretend you're talking to a busy colleague and have to sum up your entire question in one sentence: what details can you include that will help someone identify and solve your problem? Include any error messages, key APIs, or unusual circumstances that make your question different from similar questions already on the site.
Spelling, grammar and punctuation are important! Remember, this is the first part of your question others will see - you want to make a good impression. If you're not comfortable writing in English, ask a friend to proof-read it for you.
If you're having trouble summarizing the problem, write the title last - sometimes writing the rest of the question first can make it easier to describe the problem.
Examples:
Bad: NCL Confusion
Good: Why does using float instead of int give me different results when all of my inputs are integers?
Introduce the problem before you post any code
In the body of your question, start by expanding on the summary you put in the title. Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself. The first paragraph in your question is the second thing most readers will see, so make it as engaging and informative as possible.
Help others reproduce the problem
Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire program! Not only is this likely to get you in trouble if you're posting your employer's code, it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines:
Include just enough code to allow others to reproduce the problem. For help with this, read How to create a Minimal, Complete, and Verifiable example.
If it is possible to create a live example of the problem that you can link to (for example, on http://sqlfiddle.com/ or http://jsbin.com/) then do so - but also include the code in your question itself. Not everyone can access external sites, and the links may break over time.
Proof-read before posting!
Now that you're ready to ask your question, take a deep breath and read through it from start to finish. Pretend you're seeing it for the first time: does it make sense? Try reproducing the problem yourself, in a fresh environment and make sure you can do so using only the information included in your question. Add any details you missed and read through it again. Now is a good time to make sure that your title still describes the problem!
Post the question and respond to feedback
After you post, leave the question open in your browser for a bit, and see if anyone comments. If you missed an obvious piece of information, be ready to respond by editing your question to include it. If someone posts an answer, be ready to try it out and provide feedback!
Look for help asking for help
In spite of all your efforts, you may find your questions poorly-received. Don't despair! Learning to ask a good question is a worthy pursuit, and not one you'll master overnight. Here are some additional resources that you may find useful:
Writing the perfect question
How to debug small programs
Meta discussions on asking questions
How to ask questions the smart way — long but good advice.
Cheers,
/M
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marston S. Ward, PhD
Department of Earth Sciences
University of Gothenburg, Sweden
Email: marston.johnston at gu.se
SkypeID: marston.johnston
Phone: +46-31-7864901
Only the fruitful thing is true!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: isakhar sakhar isakhar <isakhar.inside13 at gmail.com>
Date: Friday, 29 September 2017 at 03:29
To: Dennis Shea <shea at ucar.edu>
Cc: Marston Johnston <shejo284 at gmail.com>, "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] About Relative Humidity
Dear Mr.Dennis Shea
Thank you very much for reply me.
I want to obtain the result of Relative Humidity in ASCII file base on website https://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_rh.shtml by using Example 1.
I already changed the code as you recommend above but still not working.
Best regards,
Soares
On Fri, Sep 29, 2017 at 10:02 AM, Dennis Shea <shea at ucar.edu> wrote:
You should examine the error message and the line at which it occurs.
RH: [Time | ntim] x [bottom_top | klevel] x [south_north | ny] x [west_east | nx]
-----
You have
do it = 0,ntimes-1
print (sprintf("%5.2f",it)+""\
+sprintf("%19.2f",RH(it(0,:,:,:)))+"") ; <====== you have indexed 'it'
end do
---
Change to:
print (sprintf("%5.2f",it)+""\
+sprintf("%19.2f",RH(it,:,:,:))
At each 'it' you are printing a 3D array ... point by point.
I have no idea why you would want to do that
On Thu, Sep 28, 2017 at 6:50 PM, isakhar sakhar isakhar <isakhar.inside13 at gmail.com> wrote:
Hi Mr. Marston
Yes, I have tried many times to solve the problems before send it here. Do you have any idea about the code I attached?
Thank you
Soares
On Tue, Sep 26, 2017 at 3:55 PM, Marston Johnston <shejo284 at gmail.com> wrote:
The error message is quite clear. Did you try and address the problem as it states?
fatal:Number of subscripts do not match number of dimensions of variable,(4) Subscripts used, (1) Subscripts expected
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 43 in file RH_WRF.ncl
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marston S. Ward, PhD
Department of Earth Sciences
University of Gothenburg, Sweden
Email: marston.johnston at gu.se
SkypeID: marston.johnston
Phone: +46-31-7864901
Only the fruitful thing is true!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: ncl-talk <ncl-talk-bounces at ucar.edu> on behalf of isakhar sakhar isakhar <isakhar.inside13 at gmail.com>
Date: Tuesday, 26 September 2017 at 07:50
To: <ncl-talk at ucar.edu>
Subject: [ncl-talk] About Relative Humidity
Dear NCL Team
I am interesting to know Relative Humidity base on website https://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_rh.shtml by using Example 1 but it didn't work.
What is still go wrong with the code. Here I attach the code.
Best regards,
Soares
Variable: RH
Type: float
Total Size: 419208372 bytes
104802093 values
Number of Dimensions: 4
Dimensions and sizes: [Time | 289] x [bottom_top | 37] x [south_north | 99] x [west_east | 99]
Coordinates:
Number Of Attributes: 2
units : %
description : Relative Humidity
fatal:Number of subscripts do not match number of dimensions of variable,(4) Subscripts used, (1) Subscripts expected
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 43 in file RH_WRF.ncl
_______________________________________________ ncl-talk mailing list ncl-talk at ucar.edu List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170929/f822a186/attachment.html>
More information about the ncl-talk
mailing list