项目作者: bwbj
项目描述 :
project netcdf file with lat/lon and sea ice parameter into PolarSteoregraphic(-45) and EASE-Grid2.0, then plot it
高级语言:
项目地址: git://github.com/bwbj/One-stop-website-for-current-state-of-Polar-sea-ice-ocean-and-ice-sheet.git
proj_carto_PS_EG
this suite of programs aim to:
- Projecting sea ice parameter into Polar Stereographic and EASE-Grid.2.0 from latitude and longitude array of same size, then export NetCDF and GeoTIFF(optional) files. Scale original data if range is too short.
- Creating a map in Polar Stereographic projection, and set fix color-ramp upper limit to make same parameter comparable.

Function statement:
proj_PS_EG_main
main_body function to recall other utilities.
- Construct necessary input and output file and parameter augment.
- Recall margin_nan(nc_path, parameter) then return three array of lat / lon / parameter, convert lat and /lon to PS and EG coordinates via polarstereo_fwd() and latlon2ease_isprs().
- Recall regular_grid() to make equally-spaced grid of coordinates in PS and EG projection, based on which resampling original parameter by griddata() and ‘nearest’ strategy .
- Write output file of NetCDF and GeoTIFF(useless finally), delete first if file with same name already exits.
- Recall carto_png() to map the parameter in PS projection, then write the figure into PNG file.
proj_PS_EG_test
same function as proj_PS_EG_main(), but without input augment, works as another branch for convenience of debugging.
readme_test
traverse all NetCDF files in specified input_path directory and feed them into proj_PS_EG_main as input.
Projection Calculation
polarstereo_fwd() convert lat/lon to XY coordinates in Polar Stereographic projection, such as:
[~, radius_thresh] = polarstereo_fwd(out_bound, proj_lon, major_axis, eccentricity, true_lat, proj_lon);
polarstereo_inv() convert XY coordinates in Polar Stereographic projection to lat/lon, such as:
[lat_cor, lon_cor] = polarstereo_inv([X_pad(end, 1), X_pad(end, end), X_pad(1, 1)],…
[Y_pad(end, 1), Y_pad(end, end), Y_pad(1, 1)], major_axis, eccentricity, true_lat, proj_lon);
For above two function, please refer to:
https://cn.mathworks.com/matlabcentral/fileexchange/32907-polar-stereographic-coordinate-transformation--map-to-lat-lon-
and
https://cn.mathworks.com/matlabcentral/fileexchange/32950-polar-stereographic-coordinate-transformation--lat-lon-to-map-
latlon2ease_isprs() convert lat/lon to XY coordinates in EASE-Grid2.0 projecion, such as:
For its specification, please refer to <2014-ISPRS-Mary J. Brodzik -EASE-Grid 2.0: Incremental but Significant Improvements for Earth-Gridded Data Sets> and - Polar and out-bound(So far 50°N/S is sufficient to represent existing datasets.) are needed to construct m_proj object.
- Colormap should keep consistent for same kinds of parameter, otherwise the maps in time-series are not comparable.
- Distance comparisons are made between 2out-bound radius and dimension of datasets in certain projection, then the original parameter array is expanded to the larger one, or keep itself if dimension is larger than 2out-bound radius. All above is to ensure area inside the out-bound circle, whether it has valid data or not, is filled with deep blue, area outside is filled with white at the same time. Besides, all pixel further than out-bound radius was set to non.
- To achieve the goals of 2 & 4, ‘CDataMapping’ property in image() function should be set as ‘scale’. At the same time, to suppress the maximum in dataset into deep-red instead of white, a scale factor slightly larger than 1.01 is necessary because initial colormap has jet(100) + white([1,1,2]).
- Out-bound circle’s longitudinal label’s property in m_grid() is different for Arctic and Antarctic.
- Set figure() property as ‘off’ temporarily, so the program export PNG file directly without showing figure explicitly.
M_grid_lt
ATTENTION! Teng Li 20170815 modified original m_grid script by commenting the graticule label of latitude to serve cartographic requirement of project manager(as well as other slight modification, such as font size, etc). Please save this file in the installing path of m_map library (same directory as original m_grid).
Write_netcdf
Construct netcdf schema with two dimensions and three variables, with their numerical type specified. Supplement projection information at last modifying.
Write_geotiff
Construct structure of projection information, whose format was specified by MATLAB, please use ‘geotiffread()’ to explore how this structure is organized if you want to know more. For ‘GeoKeyDirectoryTag’, please refer to GeoTIFF file foramt’s official websites for detail http://geotiff.maptools.org/spec/geotiff6.html .