Skip to content

Commit 6fe7ca4

Browse files
authored
Update get_latitude_and_longitude.qmd
1 parent 78c4da5 commit 6fe7ca4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

how-to-guides/get_latitude_and_longitude.qmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
title: "How to get latitude and longitude for the grid cells of a NetCDF file"
33
author: Andrew P. Barrett
44
date: last-modified
5+
execute:
6+
freeze: auto
57
---
68

79
## Problem
@@ -44,4 +46,4 @@ For all datasets on projected grids, latitude and longitudes for grid cells will
4446

4547
If you want the latitudes and longitudes of the corners of grid cells, x and y coordinates can be incremented by half the grid cells width and height, and the resoluting projected coordinates passed to `transform.transformer`.
4648

47-
It is worth considering if you really need to have latitude and longitude arrays for your dataset. One reason that CF-conventions were changed, was that 2D arrays of geographic coordinates can increase the file size, especially for high resolution datasets. Projected coordinates as vectors take up much less space. Plotting tools such as `cartopy` can make maps without latitude and longitude. If you need to extract cell values for specific geographic coordinates, for example for a weather station or buoy, it is quicker and easier to transform these coordinates into the projected coordinate system of the dataset. The `xarray.Dataset.sel` or `xarray.DataArray.sel` methods can then be used to select the data for that location.
49+
It is worth considering if you really need to have latitude and longitude arrays for your dataset. One reason that CF-conventions were changed, was that 2D arrays of geographic coordinates can increase the file size, especially for high resolution datasets. Projected coordinates as vectors take up much less space. Plotting tools such as `cartopy` can make maps without latitude and longitude. If you need to extract cell values for specific geographic coordinates, for example for a weather station or buoy, it is quicker and easier to transform these coordinates into the projected coordinate system of the dataset. The `xarray.Dataset.sel` or `xarray.DataArray.sel` methods can then be used to select the data for that location.

0 commit comments

Comments
 (0)