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

minor improvement on documentation "Loading Iris Cubes.rst" #6232

Closed
wants to merge 1 commit into from

Conversation

Qinqing-Li
Copy link

🚀 Pull Request

Description

  • Made some of the wording clearer
  • Modified the first example, on iris.load() function

Consult Iris pull request check list

@CLAassistant
Copy link

CLAassistant commented Nov 18, 2024

CLA assistant check
All committers have signed the CLA.

@ESadek-MO ESadek-MO self-requested a review November 20, 2024 10:08
Copy link
Contributor

@ESadek-MO ESadek-MO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Qinqing-Li,

Thank you so much for getting involved! We really appreciate external collaborators taking the time to help improve Iris!

I'm a bit uncertain of the motivation behind this pull request. What made you decide to change the existing docs? A lot of the changes you've made don't necessarily make sense to me, would you mind explaining them?

If you believe your changes are important and improve the quality of the documentation, please don't get discouraged, and feel free to disagree with my comments!

If you're wanting to contribute to Iris generally, there are a number of easier entry points:

  • Convert tests from unittest to pytest #6212: We're in the process of converting our tests from unittest style to pytest. We have some handy documentation here and here. Contributing a file or two (or more) would be a huge help, and I'd do my best to support you in this.
  • We have plenty of docstrings in our code, and some of them could do with some code examples added to them. If you're interested in this, I'd have a look at some of our existing docstring examples, and then use those as a template to make your own additions.
  • Finally, you can always check out Good First Issues. These are some issues that we think would offer an easier entry into Iris, so have a look and see if there's anything you'd like to have a crack at!

@@ -4,37 +4,30 @@
Loading Iris Cubes
===================

To load a single file into a **list** of Iris cubes
the :py:func:`iris.load` function is used::
Start by loading a data file into our notebook. Supported file types include common meteorological formats such as ``.pp``, ``.nc``, and ``.grib2``. The :py:func:`iris.load` function returns a :class:`iris.cube.CubeList` object, which is essentially a list of :class:`iris.cube.Cube` objects.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start by loading a data file into our notebook.
This is a bit misleading, iris can be used in notebooks, but also just in any editor that supports python.

Supported file types include common meteorological formats such as ``.pp``, ``.nc``, and ``.grib2``.
What was your motivation in removing this from a note? Personally, it feels a bit of a tangential point, which tends to suit "note" functionality.

The :py:func:``iris.load`` function returns a :class:``iris.cube.CubeList`` object, which is essentially a list of :class:``iris.cube.Cube`` objects.
Again, what was your motivation in removing this from a note? This also feels a bit tangential point, so I would leave this as a note.

Comment on lines -10 to -12
import iris
filename = '/path/to/file'
cubes = iris.load(filename)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was your motivation for removing this example?

Comment on lines -14 to -16
Iris will attempt to return **as few cubes as possible**
by collecting together multiple fields with a shared standard name
into a single multidimensional cube.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems directly relevant to the example below, what were your reasons behind moving this?

Comment on lines +25 to +27
Iris will attempt to return **as few cubes as possible**
by collecting together multiple fields with a shared standard name
into a single multidimensional cube.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this before comments of the example confuses this a bit, in my opinion. It'd be better to have all mentions of the example as soon after said example as possible.

Comment on lines +29 to +30

The output shows that there were 2 cubes as a result of loading the file, they were:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is only really necessary if there is extra discussion between this and the example, which I would be against.

Comment on lines +16 to +18
>>>file_path = '/path/to/file/uk_hires.pp'
>>>uk_hires_cubes = iris.load(file_path)
>>>print(uk_hires_cubes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code doesn't work, whereas the original code is fully functional.

Comment on lines +22 to +23
>>>print(uk_hires_cubes[1:])
0: surface_altitude / (m) (grid_latitude: 204; grid_longitude: 187)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this is accurate, I'm not sure what additional value it adds

Comment on lines +47 to +48
Currently there is support for CF NetCDF, GRIB 1 & 2, PP and FieldsFiles
file formats with a framework for this to be extended to custom formats.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What made you decide to move this?

Comment on lines 12 to +13

In order to find out what has been loaded, the result can be printed:
An example of using the :py:func:`iris.load` function::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example below is not just iris.load, but also of printing the cube list.

@@ -4,37 +4,30 @@
Loading Iris Cubes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of things to note, across the whole pull request.

  • Super long sentences all on one line can be hard to read; IDEs often don't wrap these. However, with .rst, continuing a sentence across multiple lines doesn't change how it's rendered, but does make it easier to read from IDEs. As such, we tend to limit lines to 80 characters, and split anything longer over multiple lines.
  • Adding a space after >>> makes it easier to read, i.e. >>> print('hello') is better than >>>print('hello').
  • We tend to lean away from the imperative. Examples offer particular uses of functions etc., so rather than saying "do this ...", we'll say "to do this, ...". It's a subtle change, but it does make a difference to how it's understood.

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.83%. Comparing base (5bd3351) to head (7f2e6ed).
Report is 54 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6232   +/-   ##
=======================================
  Coverage   89.83%   89.83%           
=======================================
  Files          88       88           
  Lines       23315    23315           
  Branches     4338     4338           
=======================================
  Hits        20945    20945           
  Misses       1644     1644           
  Partials      726      726           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ESadek-MO
Copy link
Contributor

Hi @Qinqing-Li, I'm closing this issue as there doesn't seem to be any movement on it.
Please feel free to reopen it if you want to continue with this!

@ESadek-MO ESadek-MO closed this Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants