CEMPD / VERDI

This is the repo for the VERDI project, written in java.
GNU General Public License v3.0
16 stars 13 forks source link

create ascii file from tileplot variable from the command line and obtain projection information for GIS from shapefile with same name #332

Open lizadams opened 8 months ago

lizadams commented 8 months ago

Describe the bug Projection information is not saved when saving variable information from a tile plot using ascii format from the command line. It is available at the top of the file when saving from the gui.

To Reproduce Steps to reproduce the behavior:

  1. Create a tile plot ./verdi.command -f $cwd/data/model/CCTM47_aac_spr06.12k.CONC.2006113.O3.ncf -s "O3[1]" -g tile
  2. Click on File > Export As Image/GIS
  3. Select name in Save As text box as ozone
  4. Select ASCII as the File Format
  5. Exit

Expected behavior cat ozone.asc When saving the ascii file from the gui, the top of the file contains the following information.

ncols 98 nrows 110 xllcorner -1.41600e+06 yllcorner -696000 cellsize 12000.0 NODATA_value -9999.0 0.0673905 0.0670518 0.0678343 0.0714933 0.0721743 0.0723521 0.0723628 0.0716080 0.0712018 0.0713046 0.0715053 0.0706815 0.0707447 0.0698938 0.0679396 0.0678840 0.0702346 0.0719731 0.0710497 0.0705922 0.0707587 0.0701048 0.0695556 0.0680646 0.0682396 0.0683228 0.0677354 0.0677105 0.0672405 0.0680479 0.0671431 0.0665232 0.0665867 0.0652284 0.0641645 0.0609215 0.0660184 0.0729519 0.0731665 0.0731936 0.0740846 0.0730665 0.0731765 0.0739741

When you save using the following command line option ./verdi.command -f $cwd/data/model/CCTM47_aac_spr06.12k.CONC.2006113.O3.ncf -s "O3[1]" -g tile -save2ascii $cwd/ozone.cli.asc -quit

Then the file output is of a different format: ./verdi.command -f $cwd/data/model/CCTM47_aac_spr06.12k.CONC.2006113.O3.ncf -s "O3[1]" -g tile -save2ascii $cwd/ozone.cli.asc

cat ozone.cli.asc

"Tile Probe: O3[1] (1, 1, 1 - 98, 1 - 110)" Y,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98 1,0.05153941363096237,0.05198071897029877,0.05232636258006096,0.052306897938251495,0.05240609124302864,0.05262250080704689,0.05268995463848114,0.05316111817955971,0.05362606793642044,0.0538458451628685,0.05428161099553108,0.05476885288953781,0.05482390150427818,0.055143069475889206,0.056226808577775955,0.05736694484949112,0.05755554512143135,0.0583982989192009,0.05914485454559326,0.059180308133363724,0.05912591889500618,0.05896548926830292,0.058850549161434174,0.05749578773975372,0.05633653700351715,0.057069189846515656,0.05715515464544296,0.05722464621067047,0.05804986134171486,0.05760649964213371,0.057398147881031036,0.05892327055335045,0.059149064123630524,0.05908510088920593,0.060123711824417114,0.06012614816427231,0.06034191697835922,0.06086967512965202,0.06102697178721428,0.061074480414390564,0.06082504987716675,0.06093691661953926,0.060828980058431625,0.0628865584731102,0.06395664811134338,0.06394921988248825,0.06481121480464935,0.06536665558815002,0.06351026147603989,0.06292349100112915,0.06313914805650711,0.06322331726551056,0.06291322410106659,0.06284542381763458,0.06290999799966812,0.06393613666296005,0.06387770920991898,0.06408362835645676,0.06613340973854065,0.06606398522853851,0.06596691161394119,0.0679367333650589,0.06741441786289215,0.06764499098062515,0.0693579614162445,0.06972607225179672,0.06976162642240524,0.07185278832912445,0.07270196080207825,0.0723111554980278,0.070078045129776,0.0700555220246315,0.0699421614408493,0.06914334744215012,0.0689915120601654,0.06891454756259918,0.0678599551320076,0.06828218698501587,0.06843023747205734,0.06877056509256363,0.06857455521821976,0.06888900697231293,0.06884121894836426,0.06887107342481613,0.06875975430011749,0.0676107257604599,0.06759228557348251,0.06732814013957977,0.06318158656358719,0.062214527279138565,0.06228265538811684,0.06323616951704025,0.06338950991630554,0.06337607651948929,0.064142607152462,0.06412360817193985,0.06378137320280075,0.06221222132444382

  1. We need to fix the bug so that the ascii format exported by the GUI and the CLI are the same.

If you export the file to shapefile using GUI you get the projection information. IF you export to ascii from the GUI with the same name as shapefile that ascii get the projection information from the shapefile and its opens in right position using any GIS software. When saving to ascii it is a raster format. When saving to a shapefile it is a vector format which shows what the projection is.

  1. We need to update the documentation to give instructions on how to save both the shapefile and the ascii file to allow users to use the ascii in a GIS system.

This makes save to ascii a two step process, to save the projection information to shapefile and then save to ascii using the same file name. The goal is to load ascii and get the correct projection information to use in any GIS system.

  1. Or, when we save to an asc file, we need to also save the projection file.

For this example, the ozone.prj file contains:

PROJCS["unknown", GEOGCS["GCS_unknown", DATUM["D_unknown", SPHEROID["unknown", 6370000.0, 0.0]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian", -97.0], PARAMETER["latitude_of_origin", 40.0], PARAMETER["standard_parallel_1", 45.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], PARAMETER["scale_factor", 1.0], PARAMETER["standard_parallel_2", 33.0], UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH]]